[clang] [llvm] [mlir] [NVPTX] Convert vector function nvvm.annotations to attributes (PR #127736)

Han-Chung Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 11:05:08 PST 2025


hanhanW wrote:

> > I think they will become something like:
> > ```c++
> > llvmFunc->addFnAttr("nvvm.maxntid", llvm::utostr(workgroupSize[0]));
> > llvmFunc->addFnAttr("nvvm.maxntid", llvm::utostr(workgroupSize[1]));
> > llvmFunc->addFnAttr("nvvm.maxntid", llvm::utostr(workgroupSize[2]));
> > ```
> 
> Not quite, this would successively overwrite the "nvvm.maxntid" attribute three times. I think something like this should work:
> 
> ```c++
> std::string maxntid = llvm::formatv("{0},{1},{2}", workgroupSize[0], workgroupSize[1], workgroupSize[2]);
> llvmFunc->addFnAttr("nvvm.maxntid", maxntid)
> ```

I see, thanks!

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


More information about the cfe-commits mailing list