Skip to content

Commit

Permalink
Merge branch 'cl21_trunk'
Browse files Browse the repository at this point in the history
# 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
kpet committed Jul 30, 2019
2 parents be80a7f + 996dd65 commit 4c31b69
Show file tree
Hide file tree
Showing 726 changed files with 17,937 additions and 10 deletions.
4 changes: 3 additions & 1 deletion build_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def install_android_cmake():
print "input: "
if get_input():
print("installing android-cmake")
subprocess.call(['git', 'clone', 'https://github.com/taka-no-me/android-cmake'])
#subprocess.call(['git', 'clone', 'https://github.com/taka-no-me/android-cmake'])
# Use a newer fork of android-cmake which has been updated to support Clang. GCC is deprecated in newer NDKs and C11 atomics conformance doesn't build with NDK > 10.
subprocess.call(['git', 'clone', 'https://github.com/daewoong-jang/android-cmake'])
args.android_cmake = os.path.join(args.src_dir,"android-cmake")
else:
exit()
Expand Down
7 changes: 3 additions & 4 deletions readme-spir-v-binaries.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
To run the 2.2 conformance tests test suite for the C++ features you need
SPIR-V binaries.
To run the conformance tests you need SPIR-V binaries.

If you are using a conformance package then the binaries are included in the
If you are using a conformance package then the binaries are included in the
package. If you are using conformance tests from gitlab repositories then the
binaries need to be picked up from Khronos SVN URL mentioned below:

Expand Down Expand Up @@ -39,4 +38,4 @@ Branch: opencl22
5. OpenCL ICD (with 2.2 support)
OpenCL ICD
Repository: https://gitlab.khronos.org/opencl/icd
Branch: dev_cl22
Branch: dev_cl22
7 changes: 7 additions & 0 deletions test_common/harness/kernelHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ cl_device_fp_config get_default_rounding_mode( cl_device_id device );
return 0; \
}

#define PASSIVE_REQUIRE_FP16_SUPPORT(device) \
if (!is_extension_available(device, "cl_khr_fp16")) \
{ \
log_info("\n\tNote: device does not support fp16. Skipping test...\n"); \
return 0; \
}

/* Prints out the standard device header for all tests given the device to print for */
extern int printDeviceHeader( cl_device_id device );

Expand Down
3 changes: 2 additions & 1 deletion test_conformance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ add_subdirectory( workgroups )
add_subdirectory( pipes )
add_subdirectory( device_timer )
add_subdirectory( clcpp )
add_subdirectory( spirv_new )
add_subdirectory( spir )

set(CSV_FILES
Expand Down Expand Up @@ -90,4 +91,4 @@ foreach(FILE ${PY_FILES})
endforeach()
foreach(FILE test_conformance/${PY_FILES})

endforeach()
endforeach()
7 changes: 7 additions & 0 deletions test_conformance/build_script_binary.py
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
43 changes: 43 additions & 0 deletions test_conformance/build_script_spirv.py
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)
53 changes: 53 additions & 0 deletions test_conformance/generate_spirv_offline.py
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()



Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Workgroups,workgroups/test_workgroups -offlineCompiler spir_v cache .
# OpenCL 2.1 tests
#####################################
Device timer,device_timer/test_device_timer
SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin

#########################################
# Extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ SPIR,spir/test_spir
Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST
Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps
Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps
Subgroups,subgroups/test_subgroups
Subgroups,subgroups/test_subgroups
8 changes: 7 additions & 1 deletion test_conformance/opencl_conformance_tests_full.csv
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,17 @@ Pipes,pipes/test_pipes
SVM,SVM/test_SVM
Workgroups,workgroups/test_workgroups

#####################################
# OpenCL 2.1 tests
#####################################
Device timer,device_timer/test_device_timer
SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin

#########################################
# Extensions
#########################################
SPIR,spir/test_spir
Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST
Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps
Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps
Subgroups,subgroups/test_subgroups
Subgroups,subgroups/test_subgroups
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# OpenCL Conformance Test Suite (full version)
# OpenCL Conformance Test Suite (no math and no conversion)
#

# #########################################
Expand Down Expand Up @@ -33,6 +33,8 @@ Allocations (single maximum),allocations/test_allocations single 5 all
Allocations (total maximum),allocations/test_allocations multiple 5 all
VecAlign, vec_align/test_vecalign
VecStep, vec_step/test_vecstep
Printf,printf/test_printf
Device Partitioning,device_partition/test_device_partition

# #########################################
# Buffers and images
Expand Down Expand Up @@ -88,5 +90,36 @@ OpenCL-GL Sharing,gl/test_gl
Select,select/test_select
Contractions,contractions/contractions
Integer Ops,integer_ops/test_integer_ops
Half Ops,half/Test_half
Half Ops,half/test_half

# #########################################
# Compatibility with Previous Versions
# #########################################
Basic 1.2,compatibility/test_conformance/basic/test_basic
API 1.2,compatibility/test_conformance/api/test_api

#####################################
# OpenCL 2.0 tests
#####################################
C11 Atomics,c11_atomics/test_c11_atomics
Execution Model,device_execution/test_device_execution
Generic Address Space,generic_address_space/test_generic_address_space
Non Uniform Work Groups,non_uniform_work_group/test_non_uniform_work_group
Pipes,pipes/test_pipes
SVM,SVM/test_SVM
Workgroups,workgroups/test_workgroups

#####################################
# OpenCL 2.1 tests
#####################################
Device timer,device_timer/test_device_timer
SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin

#########################################
# Extensions
#########################################
SPIR,spir/test_spir
Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST
Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps
Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps
Subgroups,subgroups/test_subgroups
38 changes: 38 additions & 0 deletions test_conformance/spirv_new/CMakeLists.txt
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)
13 changes: 13 additions & 0 deletions test_conformance/spirv_new/README.txt
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]
```
Loading

0 comments on commit 4c31b69

Please sign in to comment.