Skip to content

Enable dispatching linalg.generic ops into workgroups and set tiling paramters for LLVM backend - #5573

Merged
asaadaldien merged 3 commits into
mainfrom
ataei-distribute_linalg_geneircs
Apr 23, 2021
Merged

asaadaldien merged 3 commits into
mainfrom
ataei-distribute_linalg_geneircs

Conversation

@asaadaldien

Copy link
Copy Markdown
Contributor

Fix #5045

return workgroupTileSizes;
}
// TODO(ataei): Set the parameters when we enable vectorization.
case TilingLevel::Level1Tiles:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So does this mean we are still relying on LLVM auto-vectorizer :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For now yes, a follow up PR will change that soon :)

// CHECK-NEXT: %[[ARG4:[a-zA-Z0-9_]+]]: !flow.dispatch.tensor<readonly:i32>
// CHECK-SAME: %[[ARG5:[a-zA-Z0-9_]+]]: !flow.dispatch.tensor<readonly:1x?xf32>
// CHECK-SAME: %[[ARG6:[a-zA-Z0-9_]+]]: !flow.dispatch.tensor<readonly:?xf32>
// CHECK-NEXT: %[[ARG4:[a-zA-Z0-9_]+]]: !flow.dispatch.tensor<readonly:1x?xf32>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thats annoying. Wish there was CHECK-SAME-DAG

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah toke me some time to rearrange the args :/

"Enable fusing operand producers during dispatch region formation"),
llvm::cl::init(false));

// TODO(#5045): Tile and distribute on CPU causes performance regressions. This

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome!

@asaadaldien
asaadaldien force-pushed the ataei-distribute_linalg_geneircs branch from 2b5b2dd to d92cb44 Compare April 23, 2021 20:21
switch (tilingLevel) {
case TilingLevel::WorkGroupTiles: {
llvm::SmallVector<int64_t, 4> workgroupTileSizes;
int iterationRank = linalgOp.iterator_types().size();

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.

Can you just do iterationRank = getNumOuterParallelLoops(linalgOp); this way you don't pick up the reduction dimensions? Also I'm guessing you only want to tile outer parallel loops to match what is done in flow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right! I want to tile outer parallel loop and also skip inner reduction ones.

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

@asaadaldien forgot to mention. You will have to drop these flags from the mako configurations too

@antiagainst

Copy link
Copy Markdown
Member

Nice to see this option gone and elementwise tiling and distribution reenabled! Thanks for fixing this, Ahmed!

@asaadaldien
asaadaldien merged commit a10cbfe into main Apr 23, 2021
@asaadaldien
asaadaldien deleted the ataei-distribute_linalg_geneircs branch April 23, 2021 23:02
@hanhanW

hanhanW commented Apr 26, 2021

Copy link
Copy Markdown
Contributor

Interesting... this seems to make a big regression on Mobilebert for CPU, so the BuildKite tests timeout. I disable the batch mode and found that it takes 11838 ms for Mobilebert on Pixel4 CPU.

https://buildkite.com/iree/iree-android-benchmark/builds/2374

@asaadaldien

Copy link
Copy Markdown
Contributor Author

Interesting... this seems to make a big regression on Mobilebert for CPU, so the BuildKite tests timeout. I disable the batch mode and found that it takes 11838 ms for Mobilebert on Pixel4 CPU.

https://buildkite.com/iree/iree-android-benchmark/builds/2374

Strange! there was no regression when this was landed. looking into it now.

@asaadaldien

asaadaldien commented Apr 26, 2021 •

Copy link
Copy Markdown
Contributor Author

mmm, I can't repro this locally I am still getting ~ 690 ms on main branch

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.

Use tile and distribute for all compute operations

5 participants