Skip to content

[SYCL][HIP] Fix max constant memory device query #5168

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

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

npmiller
Copy link
Contributor

This fixes the Basic/info.cpp test for HIP AMD.

The issue here is that AMD GPU report a very large constant memory
(confirmed using clinfo as well). But the HIP entry point to query
that information takes a int*. So the value will show up as negative,
even though it's the correct value.

So remove the assertion on if the value is positive and cast it back to
unsigned before returning it.

This fixes the `Basic/info.cpp` test for HIP AMD.

The issue here is that AMD GPU report a very large constant memory
(confirmed using `clinfo` as well). But the HIP entry point to query
that information takes a `int*`. So the value will show up as negative,
even though it's the correct value.

So remove the assertion on if the value is positive and cast it back to
`unsigned` before returning it.
npmiller added a commit to npmiller/llvm-test-suite that referenced this pull request Dec 17, 2021
return getInfo(param_value_size, param_value, param_value_size_ret,
pi_uint64(constant_memory));
pi_uint64(static_cast<unsigned int>(constant_memory)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you just make the constant_memory be unsigned int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is hipDeviceGetAttribute takes a int *, so we do need a cast, either here, or I can make constant_memory a unsigned int and cast the pointer when calling hipDeviceGetAttribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make constant_memory a unsigned int and cast the pointer when calling hipDeviceGetAttribute

Let's do so. Not sure the cast would be really needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested, however a cast is still needed, without it complains with the following:

llvm/sycl/plugins/hip/pi_hip.cpp:1320:31: error: invalid conversion from ‘unsigned int*’ to ‘int*’ [-fpermissive]
         hipDeviceGetAttribute(&constant_memory,
                               ^~~~~~~~~~~~~~~~

@npmiller npmiller requested a review from a team as a code owner January 4, 2022 10:40
@npmiller npmiller requested a review from smaslov-intel January 4, 2022 10:55
@bader bader merged commit 1e55cf3 into intel:sycl Jan 11, 2022
bader pushed a commit to intel/llvm-test-suite that referenced this pull request Jan 11, 2022
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants