Skip to content
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

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

Draft
wants to merge 21 commits into
base: sycl
Choose a base branch
from

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.

}
// If the user specified --offload-arch, deduce the offloading
// target triple(s) from the set of architecture(s).
// Create a toolchain for each valid triple.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add some additional comment about why IsHIP and IsCuda is not supported here.

false)) {
Diag(clang::diag::err_drv_sycl_offload_arch_new_driver);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

if condition and comment are indented 2 spaces too far.

Arch);
} else if (IsSYCLSupportedIntelGPUArch(StringToOffloadArchSYCL(Arch))) {
StringRef IntelGPUArch;
IntelGPUArch = mapIntelGPUArchName(Arch).data();
Copy link
Contributor

Choose a reason for hiding this comment

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

The mapping here is different than the other arch values - perhaps add a comment explaining what it is doing.

}
// If the set is empty then we failed to find a native architecture.
if (Archs.empty()) {
Diag(clang::diag::err_drv_invalid_sycl_target) << "native";
Copy link
Contributor

Choose a reason for hiding this comment

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

This error doesn't make any sense to the end user: SYCL target is invalid: 'native'. As we are validating --offload-arch values, something that reflects that usage would make more sense. Can you take advantage of the existing err_drv_bad_offload_arch_combo diagnostic?

Also, please add a test for this case.

// Check if the given Arch value is a valid SYCL supported Intel CPU.
static inline bool IsSYCLSupportedIntelCPUArch(SYCLSupportedOffloadArchs Arch) {
return Arch >= SYCLSupportedOffloadArchs::SKYLAKEAVX512 &&
Arch < SYCLSupportedOffloadArchs::BDW;
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with the others:

Suggested change
Arch < SYCLSupportedOffloadArchs::BDW;
Arch <= SYCLSupportedOffloadArchs::GRANITERAPIDS;

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.

2 participants