-
Notifications
You must be signed in to change notification settings - Fork 808
[SYCL][CUDA] Fix LIT testing with CUDA devices #1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ | |
llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir]) | ||
|
||
backend=lit_config.params.get('SYCL_BE', "PI_OPENCL") | ||
lit_config.note("Backend: {BACKEND}".format(BACKEND=backend)) | ||
|
||
get_device_count_by_type_path = os.path.join(config.llvm_tools_dir, "get_device_count_by_type") | ||
|
||
|
@@ -119,11 +120,11 @@ def getDeviceCount(device_type): | |
if getDeviceCount("cpu")[0]: | ||
found_at_least_one_device = True | ||
lit_config.note("Found available CPU device") | ||
cpu_run_substitute = "env SYCL_DEVICE_TYPE=CPU " | ||
cpu_run_substitute = "env SYCL_DEVICE_TYPE=CPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=backend) | ||
|
||
cpu_check_substitute = "| FileCheck %s" | ||
config.available_features.add('cpu') | ||
if platform.system() == "Linux": | ||
cpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=CPU " | ||
cpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=CPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=backend) | ||
cpu_check_on_linux_substitute = "| FileCheck %s" | ||
else: | ||
lit_config.warning("CPU device not found") | ||
|
@@ -144,18 +145,15 @@ def getDeviceCount(device_type): | |
if gpu_count > 0: | ||
found_at_least_one_device = True | ||
lit_config.note("Found available GPU device") | ||
gpu_run_substitute = " env SYCL_DEVICE_TYPE=GPU " | ||
gpu_run_substitute = " env SYCL_DEVICE_TYPE=GPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=backend) | ||
gpu_check_substitute = "| FileCheck %s" | ||
config.available_features.add('gpu') | ||
if cuda: | ||
config.available_features.add('cuda') | ||
gpu_run_substitute += " SYCL_BE=PI_CUDA " | ||
|
||
if platform.system() == "Linux": | ||
gpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=GPU " | ||
gpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=GPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=backend) | ||
gpu_check_on_linux_substitute = "| FileCheck %s" | ||
if cuda: | ||
gpu_run_on_linux_substitute += " SYCL_BE=PI_CUDA " | ||
else: | ||
lit_config.warning("GPU device not found") | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,45 +5,29 @@ set(CMAKE_CXX_EXTENSIONS OFF) | |
add_executable(get_device_count_by_type get_device_count_by_type.cpp) | ||
add_dependencies(get_device_count_by_type ocl-headers ocl-icd) | ||
|
||
if( SYCL_BUILD_PI_CUDA ) | ||
|
||
find_package(CUDA 10.1 REQUIRED) | ||
|
||
add_library(cudadrv SHARED IMPORTED) | ||
|
||
set_target_properties( | ||
cudadrv PROPERTIES | ||
IMPORTED_LOCATION ${CUDA_CUDA_LIBRARY} | ||
INTERFACE_INCLUDE_DIRECTORIES ${CUDA_INCLUDE_DIRS} | ||
) | ||
|
||
target_compile_definitions(get_device_count_by_type | ||
PUBLIC $<$<BOOL:${SYCL_BUILD_PI_CUDA}>:USE_PI_CUDA> | ||
) | ||
|
||
target_include_directories( get_device_count_by_type | ||
PUBLIC | ||
${CUDA_INCLUDE_DIRS} | ||
) | ||
target_link_libraries(get_device_count_by_type | ||
PUBLIC OpenCL-Headers cudadrv | ||
) | ||
endif() | ||
|
||
target_link_libraries(get_device_count_by_type | ||
PRIVATE OpenCL::Headers | ||
PRIVATE ${OpenCL_LIBRARIES} | ||
PRIVATE | ||
OpenCL::Headers | ||
${OpenCL_LIBRARIES} | ||
$<$<BOOL:${SYCL_BUILD_PI_CUDA}>:cudadrv> | ||
) | ||
target_compile_definitions(get_device_count_by_type | ||
PRIVATE | ||
$<$<BOOL:${SYCL_BUILD_PI_CUDA}>:USE_PI_CUDA> | ||
) | ||
|
||
add_executable(sycl-check sycl-check.cpp) | ||
add_dependencies(sycl-check sycl) | ||
target_include_directories(sycl-check PRIVATE "${sycl_inc_dir}") | ||
target_link_libraries(sycl-check | ||
PRIVATE sycl | ||
PRIVATE OpenCL::Headers | ||
PRIVATE ${OpenCL_LIBRARIES}) | ||
PRIVATE | ||
sycl | ||
OpenCL::Headers | ||
${OpenCL_LIBRARIES}) | ||
|
||
#Minimum supported version of Intel's OCL GPU and CPU devices | ||
target_compile_definitions(sycl-check | ||
PRIVATE MIN_INTEL_OCL_GPU_VERSION=\"18.47.11882\" | ||
PRIVATE MIN_INTEL_OCL_CPU_VERSION=\"18.1.0.0901\",\"7.6.0.1202\" | ||
PRIVATE | ||
MIN_INTEL_OCL_GPU_VERSION=\"18.47.11882\" | ||
MIN_INTEL_OCL_CPU_VERSION=\"18.1.0.0901\",\"7.6.0.1202\" | ||
) |
Uh oh!
There was an error while loading. Please reload this page.