diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index eb6f2a73b6711..9f1b74995b671 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -7384,6 +7384,15 @@ void NVPTXTargetCodeGenInfo::setTargetAttributes( // And kernel functions are not subject to inlining F->addFnAttr(llvm::Attribute::NoInline); } + if (const SYCLIntelMaxWorkGroupSizeAttr *A = + FD->getAttr()) { + int64_t MaxThreads = (*A->getZDimVal()).getExtValue() * + (*A->getYDimVal()).getExtValue() * + (*A->getXDimVal()).getExtValue(); + if (MaxThreads > 0) { + addNVVMMetadata(F, "maxntidx", MaxThreads); + } + } } // Perform special handling in CUDA mode.