| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f1f1283 commit 1d3b890
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -91,6 +91,10 @@ Lastly, the SDK will build targeting `spir64` IR by default. This will | |||
| 91 | 91 | work on most devices, but won’t work on NVIDIA (for example). To that | |
| 92 | 92 | end, you can specify `-DCOMPUTECPP_BITCODE=target`, which can be any of | |
| 93 | 93 | `spir[64]`, `spirv[64]` or `ptx64`. | |
| 94 | + It is possible to specify multiple targets to `COMPUTECPP_BITCODE`, | ||
| 95 | + as a CMake list. | ||
| 96 | + Note that only the Professional Edition of ComputeCpp | ||
| 97 | + supports building multiple device targets. | ||
| 94 | 98 | ||
| 95 | 99 | If you would like to crosscompile the SDK targeting some other platform, | |
| 96 | 100 | there are toolchain files available in the cmake/toolchains directory. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,7 @@ if(MSVC) | |||
| 26 | 26 | COMMAND ${_stl_test_command} | |
| 27 | 27 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |
| 28 | 28 | RESULT_VARIABLE ComputeCpp_STL_CHECK_RESULT | |
| 29 | - ERROR_QUIET | ||
| 29 | + ERROR_VARIABLE ComputeCpp_STL_CHECK_ERROR_OUTPUT | ||
| 30 | 30 | OUTPUT_QUIET) | |
| 31 | 31 | if(NOT ${ComputeCpp_STL_CHECK_RESULT} EQUAL 0) | |
| 32 | 32 | # Try disabling compiler version checks | |
@@ -35,7 +35,7 @@ if(MSVC) | |||
| 35 | 35 | -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH | |
| 36 | 36 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |
| 37 | 37 | RESULT_VARIABLE ComputeCpp_STL_CHECK_RESULT | |
| 38 | - ERROR_QUIET | ||
| 38 | + ERROR_VARIABLE ComputeCpp_STL_CHECK_ERROR_OUTPUT | ||
| 39 | 39 | OUTPUT_QUIET) | |
| 40 | 40 | if(NOT ${ComputeCpp_STL_CHECK_RESULT} EQUAL 0) | |
| 41 | 41 | # Try again with __CUDACC__ and _HAS_CONDITIONAL_EXPLICIT=0. This relaxes the restritions in the MSVC headers | |
@@ -46,11 +46,12 @@ if(MSVC) | |||
| 46 | 46 | -D__CUDACC__ | |
| 47 | 47 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |
| 48 | 48 | RESULT_VARIABLE ComputeCpp_STL_CHECK_RESULT | |
| 49 | - ERROR_QUIET | ||
| 49 | + ERROR_VARIABLE ComputeCpp_STL_CHECK_ERROR_OUTPUT | ||
| 50 | 50 | OUTPUT_QUIET) | |
| 51 | 51 | if(NOT ${ComputeCpp_STL_CHECK_RESULT} EQUAL 0) | |
| 52 | 52 | message(FATAL_ERROR "compute++ cannot consume hosted STL headers. This means that compute++ can't \ | |
| 53 | - compile a simple program in this platform and will fail when used in this system.") | ||
| 53 | + compile a simple program in this platform and will fail when used in this system. \ | ||
| 54 | + \n ${ComputeCpp_STL_CHECK_ERROR_OUTPUT}") | ||
| 54 | 55 | else() | |
| 55 | 56 | list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH | |
| 56 | 57 | -D_HAS_CONDITIONAL_EXPLICIT=0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,3 +16,13 @@ set(IR_MAP_custom-spirv64 spv) | |||
| 16 | 16 | set(IR_MAP_custom-spirv32 spv) | |
| 17 | 17 | set(IR_MAP_ptx64 s) | |
| 18 | 18 | set(IR_MAP_amdgcn s) | |
| 19 | + | ||
| 20 | + # Retrieves the filename extension of the IR output of compute++ | ||
| 21 | + function(get_sycl_target_extension output) | ||
| 22 | + set(syclExtension ${IR_MAP_${COMPUTECPP_BITCODE}}) | ||
| 23 | + if(NOT syclExtension) | ||
| 24 | + # Needed when using multiple device targets | ||
| 25 | + set(syclExtension "bc") | ||
| 26 | + endif() | ||
| 27 | + set(${output} ${syclExtension} PARENT_SCOPE) | ||
| 28 | + endfunction() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ separate_arguments(COMPUTECPP_USER_FLAGS) | |||
| 38 | 38 | mark_as_advanced(COMPUTECPP_USER_FLAGS) | |
| 39 | 39 | ||
| 40 | 40 | set(COMPUTECPP_BITCODE "spir64" CACHE STRING | |
| 41 | - "Bitcode type to use as SYCL target in compute++") | ||
| 41 | + "Bitcode types to use as SYCL targets in compute++.") | ||
| 42 | 42 | mark_as_advanced(COMPUTECPP_BITCODE) | |
| 43 | 43 | ||
| 44 | 44 | set(SYCL_LANGUAGE_VERSION "2017" CACHE STRING "SYCL version to use. Defaults to 1.2.1.") | |
@@ -153,8 +153,12 @@ if(CMAKE_CROSSCOMPILING) | |||
| 153 | 153 | list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -target ${COMPUTECPP_TARGET_TRIPLE}) | |
| 154 | 154 | endif() | |
| 155 | 155 | ||
| 156 | - list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -sycl-target ${COMPUTECPP_BITCODE}) | ||
| 157 | 156 | list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -DSYCL_LANGUAGE_VERSION=${SYCL_LANGUAGE_VERSION}) | |
| 157 | + | ||
| 158 | + foreach (bitcode IN ITEMS ${COMPUTECPP_BITCODE}) | ||
| 159 | + list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -sycl-target ${bitcode}) | ||
| 160 | + endforeach() | ||
| 161 | + | ||
| 158 | 162 | message(STATUS "compute++ flags - ${COMPUTECPP_DEVICE_COMPILER_FLAGS}") | |
| 159 | 163 | ||
| 160 | 164 | include(ComputeCppCompilerChecks) | |
@@ -238,7 +242,8 @@ function(__build_ir) | |||
| 238 | 242 | # using the same source file will be generated with a different rule. | |
| 239 | 243 | set(baseSyclName ${CMAKE_CURRENT_BINARY_DIR}/${SDK_BUILD_IR_TARGET}_${sourceFileName}) | |
| 240 | 244 | set(outputSyclFile ${baseSyclName}.sycl) | |
| 241 | - set(outputDeviceFile ${baseSyclName}.${IR_MAP_${COMPUTECPP_BITCODE}}) | ||
| 245 | + get_sycl_target_extension(targetExtension) | ||
| 246 | + set(outputDeviceFile ${baseSyclName}.${targetExtension}) | ||
| 242 | 247 | set(depFileName ${baseSyclName}.sycl.d) | |
| 243 | 248 | ||
| 244 | 249 | set(include_directories "$<TARGET_PROPERTY:${SDK_BUILD_IR_TARGET},INCLUDE_DIRECTORIES>") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments