Skip to content

Reduce control flow overhead when tiling conv/pool ops. - #3419

Merged
MaheshRavishankar merged 2 commits into
iree-org:mainfrom
MaheshRavishankar:reduce_conv_pool_control_overhead
Oct 12, 2020
Merged

MaheshRavishankar merged 2 commits into
iree-org:mainfrom
MaheshRavishankar:reduce_conv_pool_control_overhead

Conversation

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

This PR fixes the issues that were preventing conv/pool tile loop
distribution and lowering to loops from following the same approach as
matmul. With this PR the inter-tile loops can be eliminated and the
workitem loops can be converted to a simple scf.if reducing the
control flow overhead significantly. This also means that all the
tiling to workgroups patterns are now using the same pattern. These
can always be specialized later, but based on explicit needs.
This also means that the conv/pool operations also generate a function
to determine the number of workgroups to use during the launch,
cleaning up some of the fallback paths in the SPIRVTarget code.
Adding a test that was causing the correctness issues.

Closes #2134

@hanhanW hanhanW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry for the late review! Thanks!

FuncOp numWorkgroupsFn = dyn_cast<FuncOp>(SymbolTable::lookupSymbolIn(
spvFuncOp.getParentOfType<ModuleOp>(), numWorkgroupsFnAttr));
if (!numWorkgroupsFn) {
return spvFuncOp.emitError("unable to fund function ")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/fund/find?

This PR fixes the issues that were preventing conv/pool tile loop
distribution and lowering to loops from following the same approach as
matmul. With this PR the inter-tile loops can be eliminated and the
workitem loops can be converted to a simple `scf.if` reducing the
control flow overhead significantly. This also means that all the
tiling to workgroups patterns are now using the same pattern. These
can always be specialized later, but based on explicit needs.
This also means that the conv/pool operations also generate a function
to determine the number of workgroups to use during the launch,
cleaning up some of the fallback paths in the SPIRVTarget code.
Adding a test that was causing the correctness issues.
@MaheshRavishankar
MaheshRavishankar force-pushed the reduce_conv_pool_control_overhead branch from d2eb245 to 6cd5c15 Compare October 12, 2020 17:15
@MaheshRavishankar
MaheshRavishankar merged commit b0ea90b into iree-org:main Oct 12, 2020
@MaheshRavishankar
MaheshRavishankar deleted the reduce_conv_pool_control_overhead branch October 12, 2020 17:58
MaheshRavishankar pushed a commit to MaheshRavishankar/iree that referenced this pull request Oct 12, 2020
MaheshRavishankar pushed a commit to MaheshRavishankar/iree that referenced this pull request Oct 13, 2020
@ScottTodd ScottTodd mentioned this pull request Oct 13, 2020
MaheshRavishankar added a commit to MaheshRavishankar/iree that referenced this pull request Oct 13, 2020
This PR fixes the issues that were preventing conv/pool tile loop
distribution and lowering to loops from following the same approach as
matmul. With this PR the inter-tile loops can be eliminated and the
workitem loops can be converted to a simple `scf.if` reducing the
control flow overhead significantly. This also means that all the
tiling to workgroups patterns are now using the same pattern. These
can always be specialized later, but based on explicit needs.
This also means that the conv/pool operations also generate a function
to determine the number of workgroups to use during the launch,
cleaning up some of the fallback paths in the SPIRVTarget code.
Adding a test that was causing the correctness issues.
MaheshRavishankar pushed a commit to MaheshRavishankar/iree that referenced this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce control overhead in generated kernels

3 participants