[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 14:49:44 PDT 2025


================
@@ -68,20 +80,18 @@ int main(int argc, char *argv[]) {
     return 0;
   }
 
-  // If this was invoked from the legacy symlinks provide the same behavior.
-  bool AMDGPUOnly = Only == VendorName::amdgpu ||
-                    sys::path::stem(argv[0]).starts_with("amdgpu-arch");
-  bool NVIDIAOnly = Only == VendorName::nvptx ||
-                    sys::path::stem(argv[0]).starts_with("nvptx-arch");
+  // Support legacy binaries
+  if (sys::path::stem(argv[0]).starts_with("amdgpu-arch"))
+    Only = VendorName::amdgpu;
+  if (sys::path::stem(argv[0]).starts_with("nvptx-arch"))
+    Only = VendorName::nvptx;
 
-  int NVIDIAResult = 0;
-  if (!AMDGPUOnly)
-    NVIDIAResult = printNVIDIA();
-
-  int AMDResult = 0;
-  if (!NVIDIAOnly)
-    AMDResult = printAMD();
+  llvm::SmallVector<int> results(VendorTable.size());
+  llvm::transform(VendorTable, results.begin(), [&](const auto &entry) {
----------------
jhuber6 wrote:

Also if you do a look remember you can do `for (auto [Name, Func] : Table`. Also I forgot to nag you about the LLVM naming convention, remember it's `CamelCase`.

https://github.com/llvm/llvm-project/pull/160570


More information about the cfe-commits mailing list