[clang] [llvm] [LLVM][Triple][NFCI] Add function to test for offloading triples (PR #126956)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 17 08:46:44 PST 2025
================
@@ -1109,6 +1109,11 @@ class Triple {
Env == llvm::Triple::EABIHF;
}
+ /// Tests if the target represents a device which can be offloaded to.
+ bool isOffloadingTarget() const {
+ return isAMDGPU() || isNVPTX() || isSPIRV();
+ }
----------------
jhuber6 wrote:
I don't think this belongs in regular triple handling. It could be a more generic 'isTargetGPU` but I think there were some objections given that SPIR-V can target other things?
My concern is that this is a `triple` which just handles a single target, while the concept of 'offloading' is only relevant with an auxiliary triple. I think this is better as a helper in Clang, we could possible even combine all of these `isCUDADevice`, `isOpenMPDevice` checks as well.
https://github.com/llvm/llvm-project/pull/126956
More information about the cfe-commits
mailing list