This is an archive of the discontinued LLVM Phabricator instance.

[mlir:GPU] Replace reference to LLVMFuncOp with FuncOpInterface
ClosedPublic

Authored by rriddle on Jan 25 2022, 12:01 PM.

Details

Summary

The GPU dialect currently contains an explicit reference to LLVMFuncOp
during verification to handle the situation where the kernel has already been
converted. This commit changes that reference to instead use FunctionOpInterface,
which has two main benefits:

  • It allows for removing an otherwise unnecessary dependency on the LLVM dialect
  • It removes hardcoded assumptions about the lowering path and use of the GPU dialect

Diff Detail

Event Timeline

rriddle created this revision.Jan 25 2022, 12:01 PM
rriddle requested review of this revision.Jan 25 2022, 12:01 PM
mehdi_amini accepted this revision.Jan 25 2022, 2:23 PM

LG

mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
238

Since you're here, can you:

  1. do the null chech with this error message after module.lookupSymbol
  2. use dyn_cast instead of dyn_cast_or_null for the two checks here and error if null with a message that is more accurate.
This revision is now accepted and ready to land.Jan 25 2022, 2:23 PM

LG

mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
249

the cast to kernelGPUFunction can be moved down here, it isn't used before.

rriddle updated this revision to Diff 403357.Jan 26 2022, 11:43 AM
rriddle marked 2 inline comments as done.
mehdi_amini accepted this revision.Jan 26 2022, 11:56 AM

LG, thanks!

This revision was landed with ongoing or failed builds.Jan 26 2022, 12:05 PM
This revision was automatically updated to reflect the committed changes.