Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Use sycl.hpp workaround only if compiler doesn't have it #439

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions SYCL/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,21 @@
else:
arch_flag = ""

# extra_include points to sycl/sycl.hpp location to workaround compiler
# versions which supports only CL/sycl.hpp
config.substitutions.append( ('%clangxx', ' '+ config.dpcpp_compiler + ' ' + config.cxx_flags + ' ' + arch_flag + ' ' + ( "/I" if cl_options else "-I") + config.extra_include ) )
config.substitutions.append( ('%clang', ' ' + config.dpcpp_compiler + ' ' + config.c_flags + ( "/I" if cl_options else "-I") + config.extra_include ) )
# Add an extra include directory which points to a fake sycl/sycl.hpp (which just points to CL/sycl.hpp)
# location to workaround compiler versions which do not provide this header
check_sycl_hpp_file='sycl_hpp_include.cpp'
with open(check_sycl_hpp_file, 'w') as fp:
fp.write('#include <sycl/sycl.hpp>\n')
fp.write('int main() {}')

extra_sycl_include = ""
sycl_hpp_available = subprocess.getstatusoutput(config.dpcpp_compiler+' -fsycl ' + check_sycl_hpp_file)
if sycl_hpp_available != 0:
extra_sycl_include = " " + ("/I" if cl_options else "-I") + config.extra_include

config.substitutions.append( ('%clangxx', ' '+ config.dpcpp_compiler + ' ' + config.cxx_flags + ' ' + arch_flag + extra_sycl_include) )
config.substitutions.append( ('%clang', ' ' + config.dpcpp_compiler + ' ' + config.c_flags + extra_sycl_include) )

config.substitutions.append( ('%threads_lib', config.sycl_threads_lib) )

# Configure device-specific substitutions based on availability of corresponding
Expand Down