[mlir][nvvm] Introduce performance tuning directives
authorGuray Ozen <guray.ozen@gmail.com>
Fri, 28 Oct 2022 11:45:44 +0000 (13:45 +0200)
committerGuray Ozen <guray.ozen@gmail.com>
Fri, 28 Oct 2022 12:02:40 +0000 (14:02 +0200)
commit3ac17449cf988bfcde804a4cc532420ed1657595
tree16c7461a82f00e532630d326f721048f70301693
parent63e3fe10882476696d8a05907dfe627bd61638a3
[mlir][nvvm] Introduce performance tuning directives

PTX programming models provides some performance tuning directives; see https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#performance-tuning-directives

The downstream compiler namely `ptxas` leverages these information for better register allocation or to handle other resource management that improves the performance.

This revision introduce all the kernel based directives to MLIR's NVVM dialect. The list is below
```
maxnreg ->  max register per thread in CTA
maxntid ->  max threads per CTA
reqntid ->  exact number of threads per CTA
minnctapersm ->  min CTA per SM
```

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D136931
mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp
mlir/test/Target/LLVMIR/nvvmir.mlir