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

Alex MacLean via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 10:46:54 PST 2025


AlexMaclean 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)
```

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


More information about the cfe-commits mailing list