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 sys
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import re
|
import re
|
||||||
import string
|
|
||||||
import shutil
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
if len(sys.argv)<2:
|
if len(sys.argv) != 3:
|
||||||
print 'Usage: "generate_spirv_offline.py <input> <32|64>"'
|
print('Usage: "generate_spirv_offline.py <compilation_cache_dir> <32|64>"')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
input_dir = sys.argv[1]
|
compilation_cache_dir = sys.argv[1]
|
||||||
arch = sys.argv[2]
|
arch = sys.argv[2]
|
||||||
|
|
||||||
def generate_spirv():
|
def generate_spirv():
|
||||||
print "generating spirv"
|
print("Generating SPIR-V files")
|
||||||
ocl_version = '12';
|
ocl_version = '12';
|
||||||
build_options = ''
|
build_options = ''
|
||||||
|
|
||||||
if os.path.exists(input_dir):
|
if os.path.exists(compilation_cache_dir):
|
||||||
for root, dirs, files in os.walk(input_dir):
|
for root, dirs, files in os.walk(compilation_cache_dir):
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith('.cl'):
|
if file.endswith('.cl'):
|
||||||
options_file_name = file[:-2] + "options"
|
options_file_name = file[:-2] + "options"
|
||||||
@@ -30,12 +31,18 @@ def generate_spirv():
|
|||||||
if re.search("-cl-std=CL2.0", line):
|
if re.search("-cl-std=CL2.0", line):
|
||||||
ocl_version = '20'
|
ocl_version = '20'
|
||||||
build_options = re.sub("-cl-std=CL2.0", "", line)
|
build_options = re.sub("-cl-std=CL2.0", "", line)
|
||||||
print build_options
|
print(build_options)
|
||||||
input_string = os.path.join(root, file)
|
source_filename = os.path.join(root, file)
|
||||||
output_string = os.path.join(root, file[:-2])
|
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 + " \""
|
command_line = (".\\build_script_spirv.py" +
|
||||||
print command_line
|
" " + source_filename +
|
||||||
|
" " + output_filename +
|
||||||
|
" " + arch +
|
||||||
|
" spir_v" +
|
||||||
|
" " + ocl_version +
|
||||||
|
'"' + build_options + '"')
|
||||||
|
print(command_line)
|
||||||
os.system(command_line)
|
os.system(command_line)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user