[clang] [clang][tools] Add LevelZero support to offload-arch (PR #160570)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 24 10:52:07 PDT 2025
================
@@ -73,15 +77,22 @@ int main(int argc, char *argv[]) {
sys::path::stem(argv[0]).starts_with("amdgpu-arch");
bool NVIDIAOnly = Only == VendorName::nvptx ||
sys::path::stem(argv[0]).starts_with("nvptx-arch");
+ bool IntelOnly = Only == VendorName::intel ||
+ sys::path::stem(argv[0]).starts_with("intelgpu-arch");
+ bool All = !AMDGPUOnly && !NVIDIAOnly && !IntelOnly;
int NVIDIAResult = 0;
- if (!AMDGPUOnly)
+ if (NVIDIAOnly || All)
NVIDIAResult = printNVIDIA();
int AMDResult = 0;
- if (!NVIDIAOnly)
+ if (AMDGPUOnly || All)
AMDResult = printAMD();
+ int IntelResult = 0;
+ if (IntelOnly || All)
+ IntelResult = printIntel();
+
// We only failed if all cases returned an error.
- return AMDResult && NVIDIAResult;
+ return AMDResult && NVIDIAResult && IntelResult;
----------------
jhuber6 wrote:
Now that we have more than two this should probably be refactored into a more `all_of` type loop. Something like this maybe?
```c++
auto fns = {printNVIDIA, printAMD, PrintIntel};
llvm::all_of(fns, [](auto fn) { return enabled() ? fn() : 0 };
```
https://github.com/llvm/llvm-project/pull/160570
More information about the cfe-commits
mailing list