-
Notifications
You must be signed in to change notification settings - Fork 821
[NewOffloadModel] Add support for passing backend options for multiple device architectures #21140
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?
Changes from all commits
99c62e0
540c9e9
4adb06e
49862fe
64923b9
7ac64f8
97cf211
8ab0f7d
7921d00
d4521fa
3529217
6fd3da4
bb3ccee
42ff7d2
1e9e2a5
2f7bcb2
f7965cb
e185487
af90563
483d68a
8ad9285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1083,6 +1083,18 @@ void SYCL::gen::BackendCompiler::ConstructJob(Compilation &C, | |||||||||||||||||
| C.addCommand(std::move(Cmd)); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // Extracts the device specified after "-device" from the backend | ||||||||||||||||||
| // argument string provided via -Xsycl-target-backend. | ||||||||||||||||||
| StringRef SYCL::gen::extractDeviceFromArg(llvm::StringRef Arg) { | ||||||||||||||||||
| llvm::SmallVector<StringRef, 8> Arglist; | ||||||||||||||||||
| Arg.split(Arglist, ' '); | ||||||||||||||||||
| for (size_t i = 0; i + 1 < Arglist.size(); ++i) { | ||||||||||||||||||
| if (Arglist[i] == "-device") | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I searched through
For #2 and #3 above, should we make 1 single function that parses
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank for pointing this out! Here are some of my finding for the three question, based on all the places that are parsing Question 1: (Use case for parsing llvm/clang/lib/Driver/ToolChains/SYCL.cpp Line 1702 in 5e9d65d
Case 2: llvm/clang/lib/Driver/ToolChains/SYCL.cpp Line 439 in 5e9d65d
Case 3: llvm/clang/lib/Driver/ToolChains/SYCL.cpp Lines 296 to 301 in 5e9d65d
I don't think we would be able to avoid parsing Question 2: Question 3: Case 1: Case 2: Case 3: As we can see, the device name being passed into For the really last question, yes, there is a function I have updated the PRs for our new approaches (#21493 and #21495) to use |
||||||||||||||||||
| return Arglist[i + 1]; | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not a common occurance, but if a user says
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought if a user wants to specify more than one architecture for
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we cannot rely on tests only to decide what is the correct behavior. We don't know, what our customers are using actually. |
||||||||||||||||||
| } | ||||||||||||||||||
| return ""; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| StringRef SYCL::gen::resolveGenDevice(StringRef DeviceName) { | ||||||||||||||||||
| StringRef Device; | ||||||||||||||||||
| Device = | ||||||||||||||||||
|
|
@@ -1556,6 +1568,8 @@ void SYCLToolChain::TranslateTargetOpt(const llvm::Triple &Triple, | |||||||||||||||||
| getDriver().getSYCLDeviceTriple(A->getValue(), A); | ||||||||||||||||||
| // Passing device args: -X<Opt>=<triple> -opt=val. | ||||||||||||||||||
| StringRef GenDevice = SYCL::gen::resolveGenDevice(A->getValue()); | ||||||||||||||||||
| if (GenDevice.empty()) | ||||||||||||||||||
| GenDevice = SYCL::gen::extractDeviceFromArg(A->getValue(1)); | ||||||||||||||||||
| bool IsGenTriple = Triple.isSPIR() && | ||||||||||||||||||
| Triple.getSubArch() == llvm::Triple::SPIRSubArch_gen; | ||||||||||||||||||
| if (IsGenTriple) { | ||||||||||||||||||
|
|
@@ -1565,9 +1579,6 @@ void SYCLToolChain::TranslateTargetOpt(const llvm::Triple &Triple, | |||||||||||||||||
| // Triples do not match, but only skip when we know we are not | ||||||||||||||||||
| // comparing against intel_gpu_* | ||||||||||||||||||
| continue; | ||||||||||||||||||
| if (OptTargetTriple == Triple && !Device.empty()) | ||||||||||||||||||
| // Triples match, but we are expecting a specific device to be set. | ||||||||||||||||||
| continue; | ||||||||||||||||||
| } else if (OptTargetTriple != Triple) | ||||||||||||||||||
| continue; | ||||||||||||||||||
| } else if (!OptNoTriple) | ||||||||||||||||||
|
|
||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.