Skip to content

[SYCL][HIP] Disable partial global offset support #4905

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
Nov 17, 2021

Conversation

npmiller
Copy link
Contributor

@npmiller npmiller commented Nov 5, 2021

This patch is disabling global offset support for the HIP plugin.

The existing libclc implementation for __spirv_GlobalOffset_x() was
using the HIP implicit args system, but these are not currently setup by
clang nor by the HIP plugin when running with SYCL.

Additionally the global offset is used when computing the global id,
which means that even in kernels that don't use global offsets the
kernel would still read a global offset from the uninitialized implicit
args, which in some cases would cause crashes.

Additionaly the HIP plugin is trying to mimick the CUDA plugin
behaviour, but the PTX backend has an extra IR pass to generate a
specific wrapper for kernels using global offsets, which is not part of
the AMDGCN compilation pipeline so when using a global offset different
from 0, the HIP plugin would just try to call a non-existant kernel.

So this patch is adding an assert in the HIP plugin when trying to use
global offsets different from 0, and forces the global offsets to be 0
in the kernel, until we implement proper support for global offsets.

This patch is disabling global offset support for the HIP plugin.

The existing `libclc` implementation for `__spirv_GlobalOffset_x()` was
using the HIP implicit args system, but these are not currently setup by
`clang` nor by the HIP plugin when running with SYCL.

Additionally the global offset is used when computing the global id,
which means that even in kernels that don't use global offsets the
kernel would still read a global offset from the uninitialized implicit
args, which in some cases would cause crashes.

Additionaly the HIP plugin is trying to mimick the CUDA plugin
behaviour, but the PTX backend has an extra IR pass to generate a
specific wrapper for kernels using global offsets, which is not part of
the AMDGCN compilation pipeline so when using a global offset different
from 0, the HIP plugin would just try to call a non-existant kernel.

So this patch is adding an assert in the HIP plugin when trying to use
global offsets different from 0, and forces the global offsets to be 0
in the kernel, until we implement proper support for global offsets.
@npmiller
Copy link
Contributor Author

npmiller commented Nov 5, 2021

This patch fixes running the BabelStream benchmark with DPC++ and the HIP plugin, as well as quite a few llvm-test-suite tests:

  SYCL :: Basic/buffer/buffer_full_copy.cpp
  SYCL :: Basic/buffer/subbuffer.cpp
  SYCL :: KernelParams/array-kernel-param-run.cpp
  SYCL :: Reduction/reduction_range_1d_s1_dw.cpp
  SYCL :: Reduction/reduction_range_2d_s1_dw.cpp
  SYCL :: Reduction/reduction_range_lambda.cpp
  SYCL :: USM/copy.cpp
  SYCL :: USM/fill.cpp

I'll open a PR to the llvm-test-suite repo once this is merged to remove the XFAILs

@dm-vodopyanov dm-vodopyanov added the hip Issues related to execution on HIP backend. label Nov 8, 2021
npmiller added a commit to npmiller/llvm-test-suite that referenced this pull request Nov 10, 2021
@bader
Copy link
Contributor

bader commented Nov 16, 2021

@againull, @smaslov-intel, ping.

@bader bader merged commit 4c93e1e into intel:sycl Nov 17, 2021
vladimirlaz pushed a commit to intel/llvm-test-suite that referenced this pull request Nov 17, 2021
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
hip Issues related to execution on HIP backend.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SYCL][HIP] Memory access fault by GPU on address (nil)
5 participants