Skip to content

[SYCL][HIP] Add assert support #6424

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 1 commit into from
Aug 2, 2022
Merged

[SYCL][HIP] Add assert support #6424

merged 1 commit into from
Aug 2, 2022

Conversation

npmiller
Copy link
Contributor

@npmiller npmiller commented Jul 11, 2022

This patch adds an implementation of __assert_fail for HIP. It is
implemented in IR because the function needs to take pointers with no
address space and OpenCL compilation makes them private. It is
implemented using the OCKL printf functions provided by HIP.

In addition this patch also fixes SYCL_EXTERNAL for HIP, the AMDGPU
backend runs some dead code elimination and would simply delete
SYCL_EXTERNAL functions, and so this patch prevents the AMDGPU backend
from deleting SYCL_EXTERNAL functions, identifying them through
the sycl-module-id attribute (as done in other places such as
sycl-post-link). This issue showed up in some of the assert tests that
use multiple translation units, and this patch also fixes the sycl-external.cpp test.

Matching llvm-test-suite update: intel/llvm-test-suite#1083

This patch adds an implementation of `__assert_fail` for HIP. It is
implemented in IR because the function needs to take pointers with no
address space and OpenCL compilation makes them private. It is
implemented using the OCKL printf functions provided by HIP.

In addition this patch also fixes `SYCL_EXTERNAL` for HIP, the AMDGPU
backend runs some dead code elimination and would simply delete
`SYCL_EXTERNAL` functions, and so this patch prevents the AMDGPU backend
from deleting `SYCL_EXTERNAL` functions, identifying them through
the `sycl-module-id` attribute (as done in other places such as
`sycl-post-link`). This issue showed up in some of the assert tests that
use multiple translation units.
@cperkinsintel
Copy link
Contributor

/verify with intel/llvm-test-suite#1083

@npmiller
Copy link
Contributor Author

Did it succeed the run with the llvm-test-suite PR? Is that the last entry "Jenkins/llvm-test-suite"?

The other entries look as expected, except for the CUDA failure, has that test been flaky? I don't really see how this patch could cause any failures for the CUDA plugin.

@bader
Copy link
Contributor

bader commented Jul 19, 2022

/verify with intel/llvm-test-suite#1083

intel/llvm-test-suite#1083 enables execution of some tests on HIP platform. AFAIK, Jenkins covers only OpenCL and Level Zero "platforms", so running this testing does not give any additional information unfortunately.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Nice! LGTM!

@npmiller
Copy link
Contributor Author

npmiller commented Aug 1, 2022

Okay, I've re-run this a lot locally with intel/llvm-test-suite#1083 and I'm not seeing any flakiness in the assert tests, it's slightly different than the CUDA asserts because the HIP driver will abort before getting back to the HIP plugin, so there is no output from the HIP plugin printed.

Given that and since we can't get more information from the Jenkins testing for HIP at the moment, would it be okay to merge the PRs as-is and we can revisit if the tests turn out to be flaky on the CI?

Copy link
Contributor

@asudarsa asudarsa left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Thanks

@bader
Copy link
Contributor

bader commented Aug 2, 2022

@npmiller, I'm merging it assuming that your local testing is clean.
We will monitor pre-commit testing results to see if there are any issues with this patch.

@bader bader merged commit ade1870 into intel:sycl Aug 2, 2022
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.

5 participants