This is an archive of the discontinued LLVM Phabricator instance.

[SCF] Add thread_dim_mapping attribute to scf.foreach_thread
ClosedPublic

Authored by nicolasvasilache on Jun 27 2022, 4:46 AM.

Details

Summary

An optional thread_dim_mapping index array attribute specifies for each
virtual thread dimension, how it remaps 1-1 to a set of concrete processing
element resources (e.g. a CUDA grid dimension or a level of concrete nested
async parallelism). At this time, the specification is backend-dependent and
is not verified by the op, beyond being an index array attribute.
It is the reponsibility of the lowering to interpret the index array in the
context of the concrete target the op is lowered to, or to ignore it when
the specification is ill-formed or unsupported for a particular target.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Jun 27 2022, 4:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2022, 4:46 AM
ftynse accepted this revision.Jun 27 2022, 4:53 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
443

If it's optional, do you want to add the default value in C++?

mlir/lib/Dialect/SCF/IR/SCF.cpp
1142

A bit obnoxious, but you can do getThreadDimMappingAttrName(RegisteredOperationName::lookup(ForeachTreadOp::getOperationName(), builder.getContext()))

This revision is now accepted and ready to land.Jun 27 2022, 4:53 AM
nicolasvasilache marked 2 inline comments as done.

Rebase and address comment.

mlir/lib/Dialect/SCF/IR/SCF.cpp
1142

Nice spelunking :) .. pass for this time though.

This revision was landed with ongoing or failed builds.Jun 27 2022, 4:59 AM
This revision was automatically updated to reflect the committed changes.