mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 08:19:02 +00:00
Fix line endings in generate_spirv_offline.py
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
4d891b67bd
commit
147d159fec
@@ -1,53 +1,53 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import shutil
|
import shutil
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
if len(sys.argv)<2:
|
if len(sys.argv)<2:
|
||||||
print 'Usage: "generate_spirv_offline.py <input> <32|64>"'
|
print 'Usage: "generate_spirv_offline.py <input> <32|64>"'
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
input_dir = sys.argv[1]
|
input_dir = sys.argv[1]
|
||||||
arch = sys.argv[2]
|
arch = sys.argv[2]
|
||||||
|
|
||||||
def generate_spirv():
|
def generate_spirv():
|
||||||
print "generating spirv"
|
print "generating spirv"
|
||||||
ocl_version = '12';
|
ocl_version = '12';
|
||||||
build_options = ''
|
build_options = ''
|
||||||
|
|
||||||
if os.path.exists(input_dir):
|
if os.path.exists(input_dir):
|
||||||
for root, dirs, files in os.walk(input_dir):
|
for root, dirs, files in os.walk(input_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"
|
||||||
ocl_version = '12'
|
ocl_version = '12'
|
||||||
if os.path.exists(os.path.join(root, options_file_name)):
|
if os.path.exists(os.path.join(root, options_file_name)):
|
||||||
optFile = open (os.path.join(root, options_file_name), 'rU')
|
optFile = open (os.path.join(root, options_file_name), 'rU')
|
||||||
for line in optFile:
|
for line in optFile:
|
||||||
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)
|
input_string = os.path.join(root, file)
|
||||||
output_string = os.path.join(root, file[:-2])
|
output_string = os.path.join(root, file[:-2])
|
||||||
|
|
||||||
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 " + input_string + " " + output_string + "spv" + arch + " " + arch + " spir_v " + ocl_version + " \"" + build_options + " \""
|
||||||
print command_line
|
print command_line
|
||||||
os.system(command_line)
|
os.system(command_line)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
generate_spirv()
|
generate_spirv()
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user