This is an archive of the discontinued LLVM Phabricator instance.

[mlir][nvvm] Introduce performance tuning directives
ClosedPublic

Authored by guraypp on Oct 28 2022, 2:40 AM.

Details

Summary

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

Diff Detail

Event Timeline

guraypp created this revision.Oct 28 2022, 2:40 AM
Herald added a project: Restricted Project. · View Herald Transcript
guraypp requested review of this revision.Oct 28 2022, 2:40 AM
guraypp edited the summary of this revision. (Show Details)Oct 28 2022, 2:40 AM
ftynse added inline comments.Oct 28 2022, 2:45 AM
mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
53–59

Can we add a dialect attribute verifier for these to be of the right type?

guraypp updated this revision to Diff 471492.Oct 28 2022, 4:46 AM

Add attribute verifiers

guraypp marked an inline comment as done.Oct 28 2022, 4:47 AM
ftynse accepted this revision.Oct 28 2022, 4:56 AM
This revision is now accepted and ready to land.Oct 28 2022, 4:56 AM
This revision was automatically updated to reflect the committed changes.

Hi Guray,

This change-set seems to break the build:

ld.lld: error: undefined symbol: mlir::extractFromI64ArrayAttr(mlir::Attribute)
>>> referenced by NVVMToLLVMIRTranslation.cpp:142 (/llvm-project/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp:142)
>>>               CMakeFiles/obj.MLIRNVVMToLLVMIRTranslation.dir/NVVMToLLVMIRTranslation.cpp.o:((anonymous namespace)::NVVMDialectLLVMIRTranslationInterface::amendOperation(mlir::Operation*, mlir::NamedAttribute, mlir::LLVM::ModuleTranslation&) const)
>>> referenced by NVVMToLLVMIRTranslation.cpp:152 (/llvm-project/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp:152)
>>>               CMakeFiles/obj.MLIRNVVMToLLVMIRTranslation.dir/NVVMToLLVMIRTranslation.cpp.o:((anonymous namespace)::NVVMDialectLLVMIRTranslationInterface::amendOperation(mlir::Operation*, mlir::NamedAttribute, mlir::LLVM::ModuleTranslation&) const)
collect2: error: ld returned 1 exit status

It looks like there is missing dependency on MLIRDialectUtils.

Hi Slava, thanks for fixing it.
I am not sure how did I miss it, I remember the buildbot was fine.