[clang] [llvm] [Clang][SYCL] Define Intel IGCA preprocessor macro definitions for SYCL during device compilation (PR #227877)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 8 12:32:06 PST 2026
================
@@ -198,6 +199,22 @@ StringRef llvm::IntelGPU::getIGCATargetName(IGCATarget T) {
return "";
}
+void llvm::IntelGPU::fillValidIGCATargetList(
+ SmallVectorImpl<StringRef> &Values) {
+ // fillValidIGCATargetList is currently only used for diagnostics, similar to
+ // how other fillValid* functions are used. We can thus afford to generate
+ // this list here:
+ SmallVector<IGCATarget> Targets;
+ for (const IGCATargetNameEntry &E : IGCATargetNames)
+ if (IGCATarget T(E.Target, E.FeatureSet); T.isValid())
+ Targets.push_back(T);
+ llvm::sort(Targets,
+ [](IGCATarget A, IGCATarget B) { return A.pack() < B.pack(); });
+ Targets.erase(llvm::unique(Targets), Targets.end());
+ for (IGCATarget T : Targets)
+ Values.push_back(getIGCATargetName(T));
+}
----------------
tahonermann wrote:
This is all information that is known at compile-time; no run-time processing should be necessary. It looks like it should be possible to return a (possibly constexpr) view into `IGCATargetNames`.
Why would `T.isValid()` ever be false? Wouldn't that imply an invalid entry in `llvm/TargetParser/IntelGPUTargetParser.def`? Such invalid entries should cause an error somewhere; preferably at compile-time. `assert(T.isValid())` should suffice if a run-time check is warranted.
https://github.com/llvm/llvm-project/pull/227877
More information about the cfe-commits
mailing list