Skip to content

[SYCL] Generalize GlobalOffset and enable it for AMDGPU #5855

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 10 commits into from
May 5, 2022

Conversation

jchlanda
Copy link
Contributor

@jchlanda jchlanda commented Mar 22, 2022

The purpose of this patch is to generalize SYCL global offset pass and enable it for AMDGPU.

In order of the commits:

The main deviation from the NVPTX is the need for supporting address spaces. For AMD kernel arguments reside in constant address space, which for the case with offset forces a copy to private AS, in order to keep the call-graph interface coherent (we can't allocate const address space for the case without offset).

Corresponding test-suit PR: intel/llvm-test-suite#941

@jchlanda jchlanda requested review from a team and bader as code owners March 22, 2022 11:45
@jchlanda jchlanda requested a review from v-klochkov March 22, 2022 11:45
bader
bader previously approved these changes Mar 22, 2022
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

libclc changes look okay to me.
It would be interesting to get the feedback from AMDGPU target maintainers on LLVM changes.
@jchlanda, are you planning to upstream new intrinsic and passes?

@jchlanda
Copy link
Contributor Author

libclc changes look okay to me. It would be interesting to get the feedback from AMDGPU target maintainers on LLVM changes. @jchlanda, are you planning to upstream new intrinsic and passes?

I'm not sure if it would ever make sense outside of SYCL. And it relies on the metadata generated through SYCL driver and SYCLLowerIR.

@vmaksimo
Copy link
Contributor

vmaksimo commented Mar 23, 2022

Hi @jchlanda and reviewers!
When is it planned to merge the change? The related test-suite PR has been already merged, and it is causing the test failure in CI runs in SYCL :: Basic/parallel_for_indexers.cpp
UPD: the merged change was reverted. Please merge the test-suite change (intel/llvm-test-suite#941) simultaneously with this PR.

@jchlanda
Copy link
Contributor Author

Hi @jchlanda and reviewers! When is it planned to merge the change? The related test-suite PR has been already merged, and it is causing the test failure in CI runs in SYCL :: Basic/parallel_for_indexers.cpp UPD: the merged change was reverted. Please merge the test-suite change (intel/llvm-test-suite#941) simultaneously with this PR.

Yeap, will do that, thanks.

@jchlanda jchlanda force-pushed the jakub/global_offset_sycl branch 2 times, most recently from 33031fe to f4c4abb Compare March 25, 2022 08:10
Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

Sorry I didn't notice there were no FE tests earlier. Can you add a FE test since you're changing CodeGen?

@jchlanda
Copy link
Contributor Author

jchlanda commented Mar 29, 2022

Sorry I didn't notice there were no FE tests earlier. Can you add a FE test since you're changing CodeGen?

@elizabethandrews
added a test for the annotations here: c450a3b87f819ef90da3c492ede36fe76bba6889

@jchlanda jchlanda force-pushed the jakub/global_offset_sycl branch 2 times, most recently from d0c99fe to c450a3b Compare March 29, 2022 09:29
Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

Thanks! FE changes LGTM

smanna12
smanna12 previously approved these changes Mar 29, 2022
Copy link
Contributor

@smanna12 smanna12 left a comment

Choose a reason for hiding this comment

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

FE changes Ok.

@jchlanda
Copy link
Contributor Author

jchlanda commented Apr 1, 2022

@bader would you like me to do anything else for this PR?

SYCL :: api/simd_any_all.cpp
SYCL :: regression/big_const_initializer.cpp

look unrelated, KernelAndProgram/undefined-symbol.cpp is // XFAIL: cuda || hip || (opencl && gpu) on the top of intelbranch and Basic/parallel_for_indexers.cpp will be supported with intel/llvm-test-suite#941 going in.

@bader
Copy link
Contributor

bader commented Apr 1, 2022

@jchlanda, two things: please, resolve merge conflicts and ping reviewers. I see approvals only from front-end team and Greg, so merge tip of the sycl branch and re-request the review.

In order to emulate this and make generated kernel compliant, an intrinsic
`llvm.nvvm.implicit.offset` (clang builtin `__builtin_ptx_implicit_offset`) was
introduced materializing the use of this implicit parameter for the NVPTX
backend. AMDGCN uses the same approach with `llvm.andgpu.implicit.offset` and
Copy link
Contributor

@v-klochkov v-klochkov May 4, 2022

Choose a reason for hiding this comment

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

non-blocking comment (may be fixed in separate PR. It does not deserve a fix that would dismiss existing approvals):
Is it a misprint here? "llvm.andgpu." -> "llvm.amdgpu."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeap, that's a typo, will fix now.

v-klochkov
v-klochkov previously approved these changes May 4, 2022
@v-klochkov
Copy link
Contributor

v-klochkov commented May 4, 2022

@asudarsa would you please review the changes in files owned by @intel/dpcpp-tools-reviewers . I see that automatically @psamolysov-intel assigned is out-of-office for unknown time.

@v-klochkov v-klochkov requested a review from asudarsa May 4, 2022 04:44
@v-klochkov
Copy link
Contributor

@jchlanda - if you decide to update the patch again, then please use "git merge ...; git push ..." instead of "git rebase ...; git push -f ...".
(rebase + force-push) clears all reviewers approvals, while 'merge + push' updates the patch to head and preserves the approvals.

mdtoguchi
mdtoguchi previously approved these changes May 4, 2022
@pvchupin
Copy link
Contributor

pvchupin commented May 4, 2022

@gmlueck, can you review please?

pvchupin
pvchupin previously approved these changes May 4, 2022
asudarsa
asudarsa previously approved these changes May 5, 2022
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.

Few nitpicks. But looks good overall. Thanks

@jchlanda
Copy link
Contributor Author

jchlanda commented May 5, 2022

@jchlanda - if you decide to update the patch again, then please use "git merge ...; git push ..." instead of "git rebase ...; git push -f ...". (rebase + force-push) clears all reviewers approvals, while 'merge + push' updates the patch to head and preserves the approvals.

My bad, sorry.

@jchlanda
Copy link
Contributor Author

jchlanda commented May 5, 2022

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.

LGTM. Thanks

@pvchupin pvchupin merged commit 2dc3c06 into intel:sycl May 5, 2022
npmiller added a commit to npmiller/llvm that referenced this pull request Apr 9, 2025
* Fix links to configure.py and compile.py
  * Linking to the file in tree caused the link in the docs to just
    download the python script. It makes more sense to link to the
    github web UI for these as they should be used in a checkout anyway.
* Remove CUDA requiring device selector
  * Since intel#6203 the device selector
    should handle this case well.
* Update HIP backend limitations
  * HIP is no longer in beta
  * Windows isn't supported but intel#17702
    made the build work with it so it might work for some users.
  * Global offset has been supported since intel#5855
  * Add common limitations
* Update HIP for Nvidia section
  * This might work but is not supported
* Update HIP section
  * Recommended HIP version + testing platforms
  * HIP is no longer in beta
* Add note on target aliases for CUDA and HIP
kbenzie pushed a commit that referenced this pull request Apr 28, 2025
* Fix links to configure.py and compile.py
* Linking to the file in tree caused the link in the docs to just
download the python script. It makes more sense to link to the github
web UI for these as they should be used in a checkout anyway.
* Remove CUDA requiring device selector
* Since #6203 the device selector
should handle this case well.
* Update HIP backend limitations
  * HIP is no longer in beta
* Windows isn't supported but #17702
made the build work with it so it might work for some users.
* Global offset has been supported since
#5855
  * Add common limitations
* Update HIP for Nvidia section
  * This might work but is not supported
* Update HIP section
  * Recommended HIP version + testing platforms
  * HIP is no longer in beta
* Add note on target aliases for CUDA and HIP
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.

10 participants