Skip to content

[SYCL] [Driver] Add offload-arch support for SYCL offloading #15624

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 25 commits into from
Oct 24, 2024

Conversation

srividya-sundaram
Copy link
Contributor

@srividya-sundaram srividya-sundaram commented Oct 7, 2024

Implement --offload-arch option to enable SYCL offloading to Intel CPUs, Intel GPUs, NVidia and AMD GPUs.

--offload-arch implementation is currently supported in the new driver model ( i.e. with --offload-new-driver option)

Example usage:

clang++   --offload-new-driver  -fsycl  --offload-arch=bdw         // Offload SYCL code to Intel GPU
clang++   --offload-new-driver  -fsycl  --offload-arch=broadwell   // Offload SYCL code to Intel CPU
clang++   --offload-new-driver  -fsycl  --offload-arch=sm_80       // Offload SYCL code to NVidia GPU
clang++   --offload-new-driver  -fsycl  --offload-arch=gfx700      // Offload SYCL code to AMD GPU

Copy link
Contributor

@GeorgeWeb GeorgeWeb left a comment

Choose a reason for hiding this comment

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

Overall, despite not being a pinged reviewer, I wanted to say I like the direction of these changes. I am aware this is still a Draft but is there a plan to address the --offload-arch with no -fsycl-targets case in

} else if (HasValidSYCLRuntime) {
either as part of this PR or a follow-up? I am asking this because the effect of these changes will also require extra handling in OffloadingActionBuilder::SYCLActionBuilder::initialize(). Thanks.

@GeorgeWeb
Copy link
Contributor

GeorgeWeb commented Oct 14, 2024

Hello, AFAIK, OffloadingActionBuilder::SYCLActionBuilder::initialize() is the path taken when we do not pass --offload-new-driver option. Currently, --offloard-arch option is supported only in the new driver model ( i.e with --offload-new-driver option passed) Hence the --offload-arch implementation is not handled in OffloadingActionBuilder::SYCLActionBuilder::initialize()

I see, I must've missed the chain of changes wrt the new offload driver for SYCL.
I only pointed the above, likely due to confusion, because for me clang++ -fsycl --offload-new-driver --offload-arch=sm_75 test.cpp still hits OffloadingActionBuilder::SYCLActionBuilder::initialize() but does nothing really as it returns early as no SYCL Toolchain has been found as of yet. Since the implementation for --offload-arch with the new offload driver logic is handled elsewhere, I guess that's okay then. Thanks for explaining :)!

Copy link
Contributor

@GeorgeWeb GeorgeWeb left a comment

Choose a reason for hiding this comment

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

LGTM (mainly commenting about the handling for Nvidia and AMD targets). Thanks again for your patience, explanations, and addressing review comments.

@srividya-sundaram srividya-sundaram marked this pull request as ready for review October 22, 2024 17:45
@srividya-sundaram srividya-sundaram requested review from a team as code owners October 22, 2024 17:45
@srividya-sundaram
Copy link
Contributor Author

Ping @intel/dpcpp-cfe-reviewers

@srividya-sundaram
Copy link
Contributor Author

@intel/llvm-gatekeepers Hello, this PR is ready to be merged. Thanks!

@asudarsa asudarsa merged commit 326e54e into intel:sycl Oct 24, 2024
12 checks passed
@srividya-sundaram srividya-sundaram deleted the offload-arch-sycl branch October 24, 2024 01:04
YixingZhang007 pushed a commit to YixingZhang007/llvm that referenced this pull request Oct 30, 2024
…5624)

Implement `--offload-arch` option to enable SYCL offloading to `Intel
CPUs`, `Intel GPUs`, `NVidia` and `AMD GPUs`.

`--offload-arch` implementation is currently supported in the new driver
model ( i.e. with `--offload-new-driver` option)

**Example usage:**
```
clang++   --offload-new-driver  -fsycl  --offload-arch=bdw         // Offload SYCL code to Intel GPU
clang++   --offload-new-driver  -fsycl  --offload-arch=broadwell   // Offload SYCL code to Intel CPU
clang++   --offload-new-driver  -fsycl  --offload-arch=sm_80       // Offload SYCL code to NVidia GPU
clang++   --offload-new-driver  -fsycl  --offload-arch=gfx700      // Offload SYCL code to AMD GPU
```
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