-
Notifications
You must be signed in to change notification settings - Fork 804
[SYCL] Fix handling of comma separated arch value when calling clang-offload-packager #20130
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
base: sycl
Are you sure you want to change the base?
Conversation
File = C.getArgs().MakeArgString("@" + File); | ||
|
||
StringRef Arch; | ||
std::string TransformedArch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add a comment with the requirement for TransformedArch
to outlive Arch
. It's not obvious from the variable declaration.
// RUN: | FileCheck -check-prefix ARCH_CHECK %s | ||
// ARCH_CHECK: clang-offload-packager{{.*}} "--image=file={{.*}}triple=spir64_gen-unknown-unknown,arch=bdw,kind=sycl{{.*}}" | ||
|
||
// Verify when a comma-separated list of architectures is provided in -device, they are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the behavior if we pass a non-comma separated list, say a space or semi-colon separated list?
Do we get an error/warning?
// ARCH_CHECK: clang-offload-packager{{.*}} "--image=file={{.*}}triple=spir64_gen-unknown-unknown,arch=bdw,kind=sycl{{.*}}" | ||
|
||
// Verify when a comma-separated list of architectures is provided in -device, they are | ||
// passed to clang-offload-packager correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--offload-arch
also supports comma-separated list of arch values.
Could you please add a test case covering that scenario as well?
Example: -Xsycl-target-backend --offload-arch=sm_80,sm_90
AL += A; | ||
} | ||
Parts.emplace_back(C.getArgs().MakeArgString(Twine(Opt) + AL)); | ||
for (StringRef Split : llvm::split(AL, ',')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a comment describing what this newly added code does or update the above existing comment.
|
||
// Verify when a comma-separated list of architectures is provided in -device, they are | ||
// passed to clang-offload-packager correctly | ||
// RUN: %clangxx -fsycl -### -fsycl-targets=spir64_gen --offload-new-driver \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, a bit more complex test case such as:
-fsycl-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,spir64_gen -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx908,gfx1010 -Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_87,sm_88,sm_89 -Xsycl-target-backend=spir64_gen "-ze-intel-enable-auto-large-GRF-mode -device pvc,bdw"
Because
clang-offload-packager
uses commas to separate the key-values pairs when specifying an image, we cannot specify a value that contains a comma without some special handling. However, if you specify the same key multiple times when callingclang-offload-packager
, the keys will be concatenated together with commas in between. So if we want, for example, the image to have anarch
ofpvc,bdw
, we can callclang-offload-packager
witharch=pvc,arch=bdw
to achieve this.