diff --git a/SYCL/Basic/device_code_dae.cpp b/SYCL/Basic/device_code_dae.cpp index 52eb03d9bb..b88d670b14 100644 --- a/SYCL/Basic/device_code_dae.cpp +++ b/SYCL/Basic/device_code_dae.cpp @@ -1,6 +1,6 @@ // NOTE A temporary test before this compilation flow is enabled by default in // driver -// UNSUPPORTED: cuda +// UNSUPPORTED: cuda,cl_options // CUDA does not support SPIR-V. // RUN: %clangxx -fsycl-device-only -Xclang -fenable-sycl-dae -Xclang -fsycl-int-header=int_header.h %s -c -o device_code.bc -I %sycl_include -Wno-sycl-strict // RUN: %clangxx -include int_header.h -g -c %s -o host_code.o -I %sycl_include -Wno-sycl-strict diff --git a/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp b/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp index a0113ccf78..5fee447eb6 100644 --- a/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp +++ b/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp @@ -7,20 +7,20 @@ //===----------------------------------------------------------------------===// // REQUIRES: aoc, accelerator -// REQUIRES: system-windows +// REQUIRES: system-windows, cl_options /// E2E test for AOCX creation/use/run for FPGA // Produce an archive with device (AOCX) image. To avoid appending objects to // leftover archives, remove one if exists. // RUN: rm %t_image.a || true -// RUN: %clang_cl -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.lib +// RUN: %clangxx -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.lib // Produce a host object -// RUN: %clang_cl -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp -c -o %t.obj +// RUN: %clangxx -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp -c -o %t.obj // AOCX with source -// RUN: %clang_cl -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp %t_image.lib -o %t_aocx_src.out +// RUN: %clangxx -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp %t_image.lib -o %t_aocx_src.out // AOCX with object -// RUN: %clang_cl -fsycl -fintelfpga %t.obj %t_image.lib -o %t_aocx_obj.out +// RUN: %clangxx -fsycl -fintelfpga %t.obj %t_image.lib -o %t_aocx_obj.out // // RUN: env SYCL_DEVICE_TYPE=ACC %t_aocx_src.out // RUN: env SYCL_DEVICE_TYPE=ACC %t_aocx_obj.out diff --git a/SYCL/Basic/fpga_tests/fpga_queue.cpp b/SYCL/Basic/fpga_tests/fpga_queue.cpp index a1e1f34917..bf82e1f625 100644 --- a/SYCL/Basic/fpga_tests/fpga_queue.cpp +++ b/SYCL/Basic/fpga_tests/fpga_queue.cpp @@ -1,6 +1,6 @@ -// REQUIRES: opencl +// REQUIRES: opencl, opencl_icd -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out %opencl_lib // RUN: %HOST_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out diff --git a/SYCL/Basic/handler/interop_task.cpp b/SYCL/Basic/handler/interop_task.cpp index 4e12b996d1..f4a46fd86c 100644 --- a/SYCL/Basic/handler/interop_task.cpp +++ b/SYCL/Basic/handler/interop_task.cpp @@ -1,5 +1,5 @@ -// REQUIRES: opencl -// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL +// REQUIRES: opencl, opencl_icd +// RUN: %clangxx -fsycl %s -o %t.out %opencl_lib // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out diff --git a/SYCL/Basic/sampler/sampler.cpp b/SYCL/Basic/sampler/sampler.cpp index e7948042f8..4b2f7f01b5 100644 --- a/SYCL/Basic/sampler/sampler.cpp +++ b/SYCL/Basic/sampler/sampler.cpp @@ -1,4 +1,5 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-dead-args-optimization %s -o %t.out -L %opencl_libs_dir -lOpenCL +// REQUIRES: opencl, opencl_icd +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-dead-args-optimization %s -o %t.out %opencl_lib // RUN: %HOST_RUN_PLACEHOLDER %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out diff --git a/SYCL/Basic/sampler/sampler_ocl.cpp b/SYCL/Basic/sampler/sampler_ocl.cpp index 5d6a0c9185..a00ea467ea 100644 --- a/SYCL/Basic/sampler/sampler_ocl.cpp +++ b/SYCL/Basic/sampler/sampler_ocl.cpp @@ -1,6 +1,6 @@ -// REQUIRES: opencl +// REQUIRES: opencl, opencl_icd -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out %opencl_lib // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out diff --git a/SYCL/Config/kernel_from_file.cpp b/SYCL/Config/kernel_from_file.cpp index 83b12e5c23..46ece0ee88 100644 --- a/SYCL/Config/kernel_from_file.cpp +++ b/SYCL/Config/kernel_from_file.cpp @@ -1,4 +1,4 @@ -// UNSUPPORTED: cuda +// UNSUPPORTED: cuda,cl_options // CUDA does not support SPIR-V. // RUN: %clangxx -fsycl-device-only -fno-sycl-use-bitcode -Xclang -fsycl-int-header=%t.h -c %s -o %t.spv -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning -Wno-sycl-strict diff --git a/SYCL/DeviceLib/separate_compile_test.cpp b/SYCL/DeviceLib/separate_compile_test.cpp index 1aabbd94e8..7d41de5e40 100644 --- a/SYCL/DeviceLib/separate_compile_test.cpp +++ b/SYCL/DeviceLib/separate_compile_test.cpp @@ -13,3 +13,4 @@ // RUN: %clangxx %t_fp64_host.o %t_fp64_device.o -o %t_fp64.out -lsycl // RUN: %CPU_RUN_PLACEHOLDER %t_fp64.out // RUN: %ACC_RUN_PLACEHOLDER %t_fp64.out +// UNSUPPORTED: cl_options diff --git a/SYCL/InorderQueue/in_order_buffs_ocl.cpp b/SYCL/InorderQueue/in_order_buffs_ocl.cpp index c5d1f07dd0..9c62f3a2b8 100644 --- a/SYCL/InorderQueue/in_order_buffs_ocl.cpp +++ b/SYCL/InorderQueue/in_order_buffs_ocl.cpp @@ -1,5 +1,5 @@ // REQUIRES: opencl_icd,opencl -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out %opencl_lib // RUN: %ACC_RUN_PLACEHOLDER %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out diff --git a/SYCL/InorderQueue/in_order_dmemll_ocl.cpp b/SYCL/InorderQueue/in_order_dmemll_ocl.cpp index d7b1d44996..94e8ea4679 100644 --- a/SYCL/InorderQueue/in_order_dmemll_ocl.cpp +++ b/SYCL/InorderQueue/in_order_dmemll_ocl.cpp @@ -1,5 +1,5 @@ // REQUIRES: opencl_icd,opencl -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out -L %opencl_libs_dir -lOpenCL +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out %opencl_lib // RUN: %CPU_RUN_PLACEHOLDER %t1.out // RUN: %ACC_RUN_PLACEHOLDER %t1.out // RUN: %GPU_RUN_PLACEHOLDER %t1.out diff --git a/SYCL/InorderQueue/prop.cpp b/SYCL/InorderQueue/prop.cpp index 97095f3bf2..8d687d406a 100644 --- a/SYCL/InorderQueue/prop.cpp +++ b/SYCL/InorderQueue/prop.cpp @@ -1,5 +1,5 @@ // REQUIRES: opencl_icd,opencl -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out -L %opencl_libs_dir -lOpenCL +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out %opencl_lib // RUN: %CPU_RUN_PLACEHOLDER %t1.out // RUN: %ACC_RUN_PLACEHOLDER %t1.out // RUN: %GPU_RUN_PLACEHOLDER %t1.out diff --git a/SYCL/KernelAndProgram/kernel-and-program-interop.cpp b/SYCL/KernelAndProgram/kernel-and-program-interop.cpp index d722a33207..a6010928b9 100644 --- a/SYCL/KernelAndProgram/kernel-and-program-interop.cpp +++ b/SYCL/KernelAndProgram/kernel-and-program-interop.cpp @@ -1,6 +1,6 @@ // REQUIRES: opencl, opencl_icd -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -L %opencl_libs_dir -lOpenCL +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out %opencl_lib // RUN: %HOST_RUN_PLACEHOLDER %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out diff --git a/SYCL/Regression/cache_test.cpp b/SYCL/Regression/cache_test.cpp index e68ec5ee24..ef2ec73bd3 100644 --- a/SYCL/Regression/cache_test.cpp +++ b/SYCL/Regression/cache_test.cpp @@ -2,6 +2,7 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // REQUIRES: level_zero +// UNSUPPORTED: cl_options #include #include diff --git a/SYCL/Regression/msvc_crt.cpp b/SYCL/Regression/msvc_crt.cpp index b877ca58a5..5dca26ad9f 100644 --- a/SYCL/Regression/msvc_crt.cpp +++ b/SYCL/Regression/msvc_crt.cpp @@ -1,14 +1,14 @@ -// RUN: %clang_cl -fsycl /MD -o %t1.exe %s +// RUN: %clangxx -fsycl /MD -o %t1.exe %s // RUN: %HOST_RUN_PLACEHOLDER %t1.exe // RUN: %CPU_RUN_PLACEHOLDER %t1.exe // RUN: %GPU_RUN_PLACEHOLDER %t1.exe // RUN: %ACC_RUN_PLACEHOLDER %t1.exe -// RUN: %clang_cl -fsycl /MDd -o %t2.exe %s +// RUN: %clangxx -fsycl /MDd -o %t2.exe %s // RUN: %HOST_RUN_PLACEHOLDER %t2.exe // RUN: %CPU_RUN_PLACEHOLDER %t2.exe // RUN: %GPU_RUN_PLACEHOLDER %t2.exe // RUN: %ACC_RUN_PLACEHOLDER %t2.exe -// REQUIRES: system-windows +// REQUIRES: system-windows, cl_options //==-------------- msvc_crt.cpp - SYCL MSVC CRT test -----------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/SYCL/SeparateCompile/test.cpp b/SYCL/SeparateCompile/test.cpp index 076de5fc0e..358337546a 100644 --- a/SYCL/SeparateCompile/test.cpp +++ b/SYCL/SeparateCompile/test.cpp @@ -1,4 +1,4 @@ -// UNSUPPORTED: cuda +// UNSUPPORTED: cuda,cl_options // CUDA does not support SPIR-V. // // >> ---- compile src1 diff --git a/SYCL/USM/source_kernel_indirect_access.cpp b/SYCL/USM/source_kernel_indirect_access.cpp index 3b22339df1..32d06204c2 100644 --- a/SYCL/USM/source_kernel_indirect_access.cpp +++ b/SYCL/USM/source_kernel_indirect_access.cpp @@ -1,8 +1,8 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -lOpenCL %s -o %t1.out +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %opencl_lib %s -o %t1.out // RUN: %CPU_RUN_PLACEHOLDER %t1.out // RUN: %GPU_RUN_PLACEHOLDER %t1.out // RUN: %ACC_RUN_PLACEHOLDER %t1.out -// REQUIRES: opencl +// REQUIRES: opencl,opencl_icd #include #include diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 3dc0a3911d..b12d997d34 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -34,7 +34,23 @@ # test_exec_root: The root path where tests should be run. config.test_exec_root = config.sycl_obj_root -llvm_config.use_clang() +# Cleanup environment variables which may affect tests +possibly_dangerous_env_vars = ['COMPILER_PATH', 'RC_DEBUG_OPTIONS', + 'CINDEXTEST_PREAMBLE_FILE', 'LIBRARY_PATH', + 'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH', + 'OBJC_INCLUDE_PATH', 'OBJCPLUS_INCLUDE_PATH', + 'LIBCLANG_TIMING', 'LIBCLANG_OBJTRACKING', + 'LIBCLANG_LOGGING', 'LIBCLANG_BGPRIO_INDEX', + 'LIBCLANG_BGPRIO_EDIT', 'LIBCLANG_NOTHREADS', + 'LIBCLANG_RESOURCE_USAGE', + 'LIBCLANG_CODE_COMPLETION_LOGGING'] +# Clang/Win32 may refer to %INCLUDE%. vsvarsall.bat sets it. +if platform.system() != 'Windows': + possibly_dangerous_env_vars.append('INCLUDE') + +for name in possibly_dangerous_env_vars: + if name in llvm_config.config.environment: + del llvm_config.config.environment[name] # Propagate some variables from the host environment. llvm_config.with_system_environment(['PATH', 'OCL_ICD_FILENAMES', @@ -77,9 +93,20 @@ config.substitutions.append( ('%sycl_libs_dir', config.sycl_libs_dir ) ) config.substitutions.append( ('%sycl_include', config.sycl_include ) ) + +# check if compiler supports CL command line options +cl_options=False +sp = subprocess.getstatusoutput(config.dpcpp_compiler+' /help') +if sp[0] == 0: + cl_options=True + config.available_features.add('cl_options') + if config.opencl_libs_dir: - config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) ) - config.available_features.add('opencl_icd') + if cl_options: + config.substitutions.append( ('%opencl_lib', ' '+config.opencl_libs_dir+'/OpenCL.lib') ) + else: + config.substitutions.append( ('%opencl_lib', '-L'+config.opencl_libs_dir+' -lOpenCL') ) + config.available_features.add('opencl_icd') config.substitutions.append( ('%opencl_include_dir', config.opencl_include_dir) ) llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir]) @@ -108,15 +135,14 @@ esimd_run_substitute = "env SYCL_BE={SYCL_BE} SYCL_DEVICE_TYPE=GPU SYCL_PROGRAM_COMPILE_OPTIONS=-vc-codegen".format(SYCL_BE=config.sycl_be) config.substitutions.append( ('%ESIMD_RUN_PLACEHOLDER', esimd_run_substitute) ) + config.substitutions.append( ('%clangxx-esimd', config.dpcpp_compiler + ' ' + '-fsycl-explicit-simd' + ' ' + config.cxx_flags ) ) - config.substitutions.append( ('%clangxx', ' '+ config.dpcpp_compiler + ' ' + config.cxx_flags ) ) config.substitutions.append( ('%clang', ' ' + config.dpcpp_compiler + ' ' + config.c_flags ) ) config.substitutions.append( ('%threads_lib', config.sycl_threads_lib) ) - # Configure device-specific substitutions based on availability of corresponding # devices/runtimes diff --git a/cmake/caches/clang_fsycl.cmake b/cmake/caches/clang_fsycl.cmake index b35fcf023d..72e366bf8f 100644 --- a/cmake/caches/clang_fsycl.cmake +++ b/cmake/caches/clang_fsycl.cmake @@ -1,4 +1,4 @@ # Default open source clang configuration with SYCL support. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -set(CMAKE_CXX_FLAGS "-fsycl" CACHE STRING "") +set(CMAKE_CXX_FLAGS "" CACHE STRING "") diff --git a/cmake/caches/clang_fsycl_cuda.cmake b/cmake/caches/clang_fsycl_cuda.cmake index 549f426ab0..ff324abbed 100644 --- a/cmake/caches/clang_fsycl_cuda.cmake +++ b/cmake/caches/clang_fsycl_cuda.cmake @@ -1,4 +1,4 @@ # Default open source clang configuration with SYCL support. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -set(CMAKE_CXX_FLAGS "-fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -Xsycl-target-backend --cuda-gpu-arch=sm_32" CACHE STRING "") +set(CMAKE_CXX_FLAGS "-fsycl-targets=nvptx64-nvidia-cuda-sycldevice -Xsycl-target-backend --cuda-gpu-arch=sm_32" CACHE STRING "")