Page MenuHomePhabricator

[mlir][SCFToGPU] Remove conversions from scf.for to gpu.launch.
ClosedPublic

Authored by mravishankar on May 28 2020, 11:09 AM.

Details

Summary

Keeping in the affine.for to gpu.launch conversions, which should
probably be the affine.parallel to gpu.launch conversion as well.

Diff Detail

Event Timeline

mravishankar created this revision.May 28 2020, 11:09 AM
Herald added a project: Restricted Project. · View Herald Transcript
ftynse accepted this revision.May 28 2020, 11:46 AM

Keeping in the affine.for to gpu.launch conversions, which should probably be the affine.parallel to gpu.launch conversion as well.

The maximum code-reuse flow would be affine.for->(affine dep analysis + parallelization) -> affine.parallel -> scf.parallel -> gpu.kernel, unless there is some specific information that can be expressed at both affine and gpu levels but cannot be expressed at scf level.

This revision is now accepted and ready to land.May 28 2020, 11:46 AM
bondhugula requested changes to this revision.May 28 2020, 2:44 PM
bondhugula added inline comments.
mlir/include/mlir/Conversion/Passes.td
183–185

You could perhaps add a TODO here or somewhere else to the effect: "Consider removing this in favor of affine.for -> affine.parallel detection followed by an affine.parallel -> scf.parallel -> gpu.launch conversion".

mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
108

You don't need to assign to forOp, and also this can just be an isa instead of dyn_cast.

if (!isa<AffineForOp>(nested))
  ...
This revision now requires changes to proceed.May 28 2020, 2:44 PM
bondhugula accepted this revision.May 28 2020, 2:44 PM
This revision is now accepted and ready to land.May 28 2020, 2:44 PM
herhut accepted this revision.May 29 2020, 2:14 AM

Thanks!

mravishankar marked 5 inline comments as done.

Adding a TODO based on comments

Addressing build warnings

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2020, 11:19 PM