mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Cleanup generate_spirv_offline.py
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
147d159fec
commit
982e3ed79c
35
test_conformance/generate_spirv_offline.py
Normal file → Executable file
35
test_conformance/generate_spirv_offline.py
Normal file → Executable file
@@ -1,25 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import string
|
||||
import shutil
|
||||
import traceback
|
||||
|
||||
if len(sys.argv)<2:
|
||||
print 'Usage: "generate_spirv_offline.py <input> <32|64>"'
|
||||
if len(sys.argv) != 3:
|
||||
print('Usage: "generate_spirv_offline.py <compilation_cache_dir> <32|64>"')
|
||||
exit(1)
|
||||
|
||||
input_dir = sys.argv[1]
|
||||
compilation_cache_dir = sys.argv[1]
|
||||
arch = sys.argv[2]
|
||||
|
||||
def generate_spirv():
|
||||
print "generating spirv"
|
||||
print("Generating SPIR-V files")
|
||||
ocl_version = '12';
|
||||
build_options = ''
|
||||
|
||||
if os.path.exists(input_dir):
|
||||
for root, dirs, files in os.walk(input_dir):
|
||||
if os.path.exists(compilation_cache_dir):
|
||||
for root, dirs, files in os.walk(compilation_cache_dir):
|
||||
for file in files:
|
||||
if file.endswith('.cl'):
|
||||
options_file_name = file[:-2] + "options"
|
||||
@@ -30,12 +31,18 @@ def generate_spirv():
|
||||
if re.search("-cl-std=CL2.0", line):
|
||||
ocl_version = '20'
|
||||
build_options = re.sub("-cl-std=CL2.0", "", line)
|
||||
print build_options
|
||||
input_string = os.path.join(root, file)
|
||||
output_string = os.path.join(root, file[:-2])
|
||||
print(build_options)
|
||||
source_filename = os.path.join(root, file)
|
||||
output_filename = os.path.join(root, file[:-2]) + "spv" + arch
|
||||
|
||||
command_line = ".\\build_script_spirv.py " + input_string + " " + output_string + "spv" + arch + " " + arch + " spir_v " + ocl_version + " \"" + build_options + " \""
|
||||
print command_line
|
||||
command_line = (".\\build_script_spirv.py" +
|
||||
" " + source_filename +
|
||||
" " + output_filename +
|
||||
" " + arch +
|
||||
" spir_v" +
|
||||
" " + ocl_version +
|
||||
'"' + build_options + '"')
|
||||
print(command_line)
|
||||
os.system(command_line)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user