This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][GPU] Add GPU launch op support for dynamic shared memory
ClosedPublic

Authored by bondhugula on Sep 29 2021, 11:34 PM.

Details

Summary

Add support for dynamic shared memory for GPU launch ops: add an
optional operand to gpu.launch and gpu.launch_func ops to specify the
amount of "dynamic" shared memory to use. Update lowerings to connect
this operand to the GPU runtime.

Diff Detail

Event Timeline

bondhugula created this revision.Sep 29 2021, 11:34 PM
bondhugula requested review of this revision.Sep 29 2021, 11:34 PM
csigg accepted this revision.Sep 30 2021, 12:08 AM
csigg added inline comments.
mlir/include/mlir/Dialect/GPU/GPUOps.td
381–382

Would it make sense to provide a default?

This revision is now accepted and ready to land.Sep 30 2021, 12:08 AM

Add default value on builder for "dynamic memory size" for gpu.launch but not for gpu.launch_func.

mlir/include/mlir/Dialect/GPU/GPUOps.td
381–382

Makes sense, although we'll need to provide a default value for the last argument as well if we provide it for this one. I've done this for the gpu.launch op where it's more useful. However, for this one (launch_func), I'm concerned that a default would lead to runtime breakage for any downstream users since kernelOperands in pre-existing code would then silently map to this new argument and escape a build failure.

bondhugula marked an inline comment as done.Oct 1 2021, 4:21 AM
This revision was landed with ongoing or failed builds.Oct 1 2021, 4:21 AM
This revision was automatically updated to reflect the committed changes.
nbpatel added inline comments.
mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir
27

is there an example of how this value will be passed to the outlined kernel?