-
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 6 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 |
---|---|---|
|
@@ -39,6 +39,7 @@ def run( | |
verbose=False, | ||
cmake_opts="", | ||
target="intel", | ||
arch=None, | ||
onemkl_interfaces=False, | ||
onemkl_interfaces_dir=None, | ||
): | ||
|
@@ -104,6 +105,16 @@ def run( | |
# Always builds using oneMKL interfaces for the cuda target | ||
onemkl_interfaces = True | ||
|
||
if target == "hip": | ||
antonwolfy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if not arch: | ||
raise ValueError("--arch is required when --target=hip") | ||
cmake_args += [ | ||
"-DDPNP_TARGET_HIP=ON", | ||
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. For what do we need to define two variables? Can it be combined in a single one, like in dpctl: 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. Additionally,
For these reasons, I think it is most sensible to move away from 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. @ndgrigorian it is a great suggestion. |
||
f"-DHIP_TARGETS={arch}", | ||
] | ||
# Always builds using oneMKL interfaces for the hip target | ||
onemkl_interfaces = True | ||
|
||
if onemkl_interfaces: | ||
cmake_args += [ | ||
"-DDPNP_USE_ONEMKL_INTERFACES=ON", | ||
|
@@ -177,6 +188,12 @@ def run( | |
default="intel", | ||
type=str, | ||
) | ||
driver.add_argument( | ||
"--arch", | ||
help="Architecture for HIP target", | ||
dest="arch", | ||
type=str, | ||
) | ||
driver.add_argument( | ||
"--onemkl-interfaces", | ||
help="Build using oneMKL Interfaces", | ||
|
@@ -244,6 +261,7 @@ def run( | |
verbose=args.verbose, | ||
cmake_opts=args.cmake_opts, | ||
target=args.target, | ||
arch=args.arch, | ||
onemkl_interfaces=args.onemkl_interfaces, | ||
onemkl_interfaces_dir=args.onemkl_interfaces_dir, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume there is no support for multiple values:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=[X]
completelylist of aliases:
https://intel.github.io/llvm/UsersManual.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I am using
HIP_TARGETS
instead ofHIP_TARGET
because oneMath requiresHIP_TARGETS
to be definedhttps://github.com/uxlfoundation/oneMath/blob/4ad4dfb5db834117248ad5f8fbded5cfc1097005/CMakeLists.txt#L73
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The 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 comment
The 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,
In the next PR I will suggest an update for CUDA