This is an archive of the discontinued LLVM Phabricator instance.

[mlir][nvgpu] Improve finding module Op to for `mbarrier.create`
ClosedPublic

Authored by guraypp on Jul 20 2023, 5:37 AM.

Details

Summary

Current transformation expects module op to be two level higher, however, it is not always the case. This work searches module op in a while loop.

Diff Detail

Event Timeline

guraypp created this revision.Jul 20 2023, 5:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 5:37 AM
guraypp requested review of this revision.Jul 20 2023, 5:37 AM
guraypp updated this revision to Diff 542456.Jul 20 2023, 5:37 AM

add newline

nicolasvasilache added inline comments.
mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
749

you could

if (auto moduleOp = mOp->getParentOfType<gpu::GPUModuleOp>())
  global = ...
else if (auto moduleOp = mOp->getParentOfType<ModuleOp>())
  global = ...
else 
  return op->emitError()...

yes there would be 2 potential traversals in the worst case but I'd err towards legibility and avoid handrolling our own while

This revision is now accepted and ready to land.Jul 20 2023, 11:52 PM