-
Notifications
You must be signed in to change notification settings - Fork 23
Enable dpnp build on AMD GPU #2302
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 27 commits
72bc4d4
5f11917
c07e0a7
323bbb4
e111ce1
ccc7b72
efbab02
310cd82
c3adf4e
574ea90
d6c5925
5bca529
b858ae2
273113e
c4da3ef
e6c280e
b27a8a1
2238372
5e2cc3d
2eaf883
0877a32
395871e
54f44cd
e57ccf8
c2ebe72
7a89e0f
07639f6
d2e5792
a278f13
e2351ee
f41e5d8
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 | ||||
---|---|---|---|---|---|---|
|
@@ -75,27 +75,62 @@ option(DPNP_USE_ONEMKL_INTERFACES | |||||
"Build DPNP with oneMKL Interfaces" | ||||||
OFF | ||||||
) | ||||||
set(HIP_TARGETS "" CACHE STRING "HIP architecture for target") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume there is no support for multiple values:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At some point, it was clear in docs that only one architecture was supported at a time, but now it isn't as clear and should be tested Also, there is new information in the extension guide
It shows that the command
is equivalent to
so maybe both dpctl and dpnp can simplify by removing the need for list of aliases: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aliases list seems to claim only one alias is supported at a time. So probably only one architecture at once is possible? That would be my guess There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it only declaration of cmake variable which doesn't impact oneMath, isn't that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
According to OneMath documentation HIP_TARGETS must be set for ROCm builds There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is a great suggestion.
In this PR I will implement using aliases for AMD, |
||||||
|
||||||
set(_dpnp_sycl_targets) | ||||||
set(_use_onemkl_interfaces OFF) | ||||||
vlad-perevezentsev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
set(_use_onemkl_interfaces_cuda OFF) | ||||||
set(_use_onemkl_interfaces_hip OFF) | ||||||
|
||||||
set(_dpnp_sycl_target_compile_options) | ||||||
set(_dpnp_sycl_target_link_options) | ||||||
|
||||||
if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") | ||||||
if(DPNP_TARGET_CUDA) | ||||||
set(_dpnp_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown") | ||||||
set(_use_onemkl_interfaces_cuda ON) | ||||||
else() | ||||||
if(DEFINED ENV{DPNP_TARGET_CUDA}) | ||||||
set(_dpnp_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown") | ||||||
set(_use_onemkl_interfaces_cuda ON) | ||||||
endif() | ||||||
endif() | ||||||
if(DPNP_TARGET_CUDA) | ||||||
set(_dpnp_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown") | ||||||
set(_use_onemkl_interfaces_cuda ON) | ||||||
endif() | ||||||
|
||||||
if (NOT "x${HIP_TARGETS}" STREQUAL "x") | ||||||
set(_use_onemkl_interfaces_hip ON) | ||||||
|
||||||
if ("x${_dpnp_sycl_targets}" STREQUAL "x") | ||||||
set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},spir64-unknown-unknown") | ||||||
else() | ||||||
set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},${_dpnp_sycl_targets}") | ||||||
endif() | ||||||
endif() | ||||||
else() | ||||||
set(_dpnp_sycl_targets ${DPNP_SYCL_TARGETS}) | ||||||
set(_dpnp_sycl_targets ${DPNP_SYCL_TARGETS}) | ||||||
|
||||||
if ("${DPNP_SYCL_TARGETS}" MATCHES "nvptx64-nvidia-cuda") | ||||||
set(_use_onemkl_interfaces ON) | ||||||
vlad-perevezentsev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
set(_use_onemkl_interfaces_cuda ON) | ||||||
endif() | ||||||
|
||||||
if ("${DPNP_SYCL_TARGETS}" MATCHES "amd_gpu_") | ||||||
set(_use_onemkl_interfaces ON) | ||||||
vlad-perevezentsev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
set(_use_onemkl_interfaces_hip ON) | ||||||
antonwolfy marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
if ("x${HIP_TARGETS}" STREQUAL "x") | ||||||
message(FATAL_ERROR "HIP_TARGETS must be specified when using HIP backend") | ||||||
endif() | ||||||
endif() | ||||||
|
||||||
if ("${DPNP_SYCL_TARGETS}" MATCHES "amdgcn-amd-amdhsa") | ||||||
message(FATAL_ERROR | ||||||
"Legacy target 'amdgcn-amd-amdhsa' is not supported. " | ||||||
"Use alias form 'amd_gpu_<arch>' instead" | ||||||
) | ||||||
endif() | ||||||
endif() | ||||||
|
||||||
if(_dpnp_sycl_targets) | ||||||
if (_dpnp_sycl_targets) | ||||||
message(STATUS "Compiling for -fsycl-targets=${_dpnp_sycl_targets}") | ||||||
list(APPEND _dpnp_sycl_target_compile_options -fsycl-targets=${_dpnp_sycl_targets}) | ||||||
list(APPEND _dpnp_sycl_target_link_options -fsycl-targets=${_dpnp_sycl_targets}) | ||||||
endif() | ||||||
|
||||||
set(_use_onemkl_interfaces OFF) | ||||||
if(DPNP_USE_ONEMKL_INTERFACES) | ||||||
set(_use_onemkl_interfaces ON) | ||||||
else() | ||||||
|
@@ -107,13 +142,20 @@ endif() | |||||
if(_use_onemkl_interfaces) | ||||||
set(BUILD_FUNCTIONAL_TESTS False) | ||||||
set(BUILD_EXAMPLES False) | ||||||
set(ENABLE_MKLGPU_BACKEND True) | ||||||
set(ENABLE_MKLCPU_BACKEND True) | ||||||
|
||||||
if(_use_onemkl_interfaces_cuda) | ||||||
set(ENABLE_CUBLAS_BACKEND True) | ||||||
set(ENABLE_CUSOLVER_BACKEND True) | ||||||
set(ENABLE_CUFFT_BACKEND True) | ||||||
# set(ENABLE_CURAND_BACKEND True) | ||||||
set(ENABLE_MKLGPU_BACKEND True) | ||||||
set(ENABLE_MKLCPU_BACKEND True) | ||||||
endif() | ||||||
if(_use_onemkl_interfaces_hip) | ||||||
set(ENABLE_ROCBLAS_BACKEND True) | ||||||
set(ENABLE_ROCSOLVER_BACKEND True) | ||||||
set(ENABLE_ROCFFT_BACKEND True) | ||||||
# set(ENABLE_ROCRAND_BACKEND True) | ||||||
endif() | ||||||
|
||||||
vlad-perevezentsev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
if(DPNP_ONEMKL_INTERFACES_DIR) | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.