[clang] [llvm] [NVPTX] Add NVVMUpgradeAnnotations pass to cleanup legacy annotations (PR #119261)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 12:45:38 PST 2024
================
@@ -5911,31 +5911,21 @@ bool llvm::omp::isOpenMPKernel(Function &Fn) {
KernelSet llvm::omp::getDeviceKernels(Module &M) {
// TODO: Create a more cross-platform way of determining device kernels.
- NamedMDNode *MD = M.getNamedMetadata("nvvm.annotations");
KernelSet Kernels;
- if (!MD)
- return Kernels;
-
- for (auto *Op : MD->operands()) {
- if (Op->getNumOperands() < 2)
- continue;
- MDString *KindID = dyn_cast<MDString>(Op->getOperand(1));
- if (!KindID || KindID->getString() != "kernel")
- continue;
-
- Function *KernelFn =
- mdconst::dyn_extract_or_null<Function>(Op->getOperand(0));
- if (!KernelFn)
- continue;
-
- // We are only interested in OpenMP target regions. Others, such as kernels
- // generated by CUDA but linked together, are not interesting to this pass.
- if (isOpenMPKernel(*KernelFn)) {
- ++NumOpenMPTargetRegionKernels;
- Kernels.insert(KernelFn);
- } else
- ++NumNonOpenMPTargetRegionKernels;
+ for (auto &F : M) {
+ // TODO: unify this check with isKernelFunction in NVPTXUtilities.
+ if (F.hasFnAttribute("nvvm.kernel")) {
+
----------------
AlexMaclean wrote:
Fixed
https://github.com/llvm/llvm-project/pull/119261
More information about the llvm-commits
mailing list