forked from KhronosGroup/OpenCL-CTS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # .travis.yml # CMakeLists.txt # CMakeVendor.txt # README.md # build_android.py # build_lnx.sh # build_win.bat # readme-spir-v-binaries.txt # test_common/harness/kernelHelpers.c # test_common/harness/kernelHelpers.h # test_conformance/CMakeLists.txt # test_conformance/opencl_conformance_tests_21_full_spirv.csv # test_conformance/opencl_conformance_tests_21_legacy_wimpy.csv # test_conformance/opencl_conformance_tests_full.csv # test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv # test_conformance/opencl_conformance_tests_quick.csv # test_conformance/run_conformance.py
- Loading branch information
Showing
726 changed files
with
17,937 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Script parameters: | ||
# 1 - input file | ||
# 2 - output file | ||
# 3 - architecture: 32 or 64 | ||
# 4 - one of the strings: binary, source, spir_v | ||
# 5 - OpenCL version: 12, 20 | ||
# 6 - build options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Script parameters: | ||
# 1 - input file | ||
# 2 - output file | ||
# 3 - architecture: 32 or 64 | ||
# 4 - one of the strings: binary, source, spir_v | ||
# 5 - OpenCL version: 12, 20 | ||
# 6 - build options | ||
|
||
import os | ||
import sys | ||
|
||
if len(sys.argv)<5: | ||
print 'Usage: "build_script_spirv.py <input> <output> <arch> <output_type> <opencl_version> [build_options]"' | ||
exit(1) | ||
|
||
input_file = sys.argv[1] | ||
output_file = sys.argv[2] | ||
arch = sys.argv[3] | ||
output_type = sys.argv[4] | ||
ocl_version = sys.argv[5] | ||
build_options = '' | ||
|
||
if len(sys.argv) == 5: | ||
build_options = sys.argv[6] | ||
|
||
if arch == '32': | ||
arch_string = '' | ||
spir_arch = '__i386__' | ||
else: | ||
arch_string = '64' | ||
spir_arch = '__x86_64__' | ||
|
||
if ocl_version == '20': | ||
oclc_version = '200' | ||
spir_version = '2.0' | ||
else: | ||
oclc_version = '120' | ||
spir_version = '1.2' | ||
|
||
command = '%LLVMPATH%\\bin\\clang.exe -cc1 -include headers\\opencl_SPIR-' + spir_version + '.h -cl-std=CL' + spir_version +' -D__OPENCL_C_VERSION__=' + oclc_version + ' -fno-validate-pch -D__OPENCL_VERSION__=' + oclc_version + ' -x cl -cl-kernel-arg-info -O0 -emit-llvm-bc -triple spir' + arch_string + '-unknown-unknown -D' + spir_arch + ' -Dcl_khr_3d_image_writes -Dcl_khr_byte_addressable_store -Dcl_khr_d3d10_sharing -Dcl_khr_d3d11_sharing -Dcl_khr_depth_images -Dcl_khr_dx9_media_sharing -Dcl_khr_fp64 -Dcl_khr_global_int32_base_atomics -Dcl_khr_global_int32_extended_atomics -Dcl_khr_gl_depth_images -Dcl_khr_gl_event -Dcl_khr_gl_msaa_sharing -Dcl_khr_gl_sharing -Dcl_khr_icd -Dcl_khr_image2d_from_buffer -Dcl_khr_local_int32_base_atomics -Dcl_khr_local_int32_extended_atomics -Dcl_khr_mipmap_image -Dcl_khr_mipmap_image_writes -Dcl_khr_fp16 ' + build_options + ' -Dcl_khr_spir ' + input_file + ' -o intermediate.spir' | ||
os.system(command) | ||
command = '%LLVMPATH%\\bin\\llvm-spirv.exe intermediate.spir -o ' + output_file | ||
os.system(command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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>"' | ||
exit(1) | ||
|
||
input_dir = sys.argv[1] | ||
arch = sys.argv[2] | ||
|
||
def generate_spirv(): | ||
print "generating spirv" | ||
ocl_version = '12'; | ||
build_options = '' | ||
|
||
if os.path.exists(input_dir): | ||
for root, dirs, files in os.walk(input_dir): | ||
for file in files: | ||
if file.endswith('.cl'): | ||
options_file_name = file[:-2] + "options" | ||
ocl_version = '12' | ||
if os.path.exists(os.path.join(root, options_file_name)): | ||
optFile = open (os.path.join(root, options_file_name), 'rU') | ||
for line in optFile: | ||
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]) | ||
|
||
command_line = ".\\build_script_spirv.py " + input_string + " " + output_string + "spv" + arch + " " + arch + " spir_v " + ocl_version + " \"" + build_options + " \"" | ||
print command_line | ||
os.system(command_line) | ||
return 0 | ||
|
||
def main(): | ||
try: | ||
generate_spirv() | ||
except Exception: | ||
traceback.print_exc(file=sys.stdout) | ||
sys.exit(0) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
###################################################################################################### | ||
#Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved. | ||
# | ||
#This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. | ||
#This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to | ||
#third parties, and may not be reproduced, republished, distributed, transmitted, displayed, | ||
#broadcast or otherwise exploited in any manner without the express prior written permission | ||
#of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce, | ||
#disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, | ||
#in whole or in part other than under the terms of the Khronos Adopters Agreement | ||
#or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient. | ||
###################################################################################################### | ||
|
||
set(MODULE_NAME SPIRV_NEW) | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
file(GLOB SPIRV_NEW_SOURCES "*.cpp") | ||
|
||
set(TEST_HARNESS_SOURCES | ||
../../test_common/harness/crc32.c | ||
../../test_common/harness/errorHelpers.c | ||
../../test_common/harness/threadTesting.c | ||
../../test_common/harness/testHarness.c | ||
../../test_common/harness/kernelHelpers.c | ||
../../test_common/harness/typeWrappers.cpp | ||
../../test_common/harness/mt19937.c | ||
../../test_common/harness/conversions.c | ||
../../test_common/harness/msvc9.c | ||
../../test_common/harness/rounding_mode.c | ||
../../test_common/harness/os_helpers.cpp | ||
../../test_common/harness/parseParameters.cpp | ||
../../test_conformance/math_brute_force/reference_math.c | ||
../../test_conformance/math_brute_force/Utility.c | ||
) | ||
|
||
set(${MODULE_NAME}_SOURCES ${SPIRV_NEW_SOURCES} ${TEST_HARNESS_SOURCES}) | ||
|
||
include(../CMakeCommon.txt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
test_conformance/spirv_new README | ||
================================== | ||
|
||
The text versions of the spirv files are present in `conformance-tests/test_conformance/spriv_new/spirv_txt`. | ||
These text files have been used to generate the binaries in `spirv_bin` using the assembler from `spirv-tools`. | ||
|
||
The absolute path to `spirv_bin` needs to be passed after `-ILPath` token for the test to find the SPIRV binaries. | ||
|
||
An example invocation looks like the following: | ||
|
||
``` | ||
./test_conformance/spirv_new/test_conformance_spirv_new -ILPath /home/user/workspace/conformance-tests/test_conformance/spirv_new/spirv_bin/ [other options] | ||
``` |
Oops, something went wrong.