Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable more vectorizations in LLVMCPUTileFuseAndVectorizePass #7652

Merged
merged 1 commit into from
Nov 13, 2021

Conversation

hanhanW
Copy link
Contributor

@hanhanW hanhanW commented Nov 12, 2021

Vectorization will turn Linalg ops to vector ops and arith ops. Since we
don't propagate information through arith ops during bufferization. We
can't unconditionally vectorize all the ops. To prevent creating extra
memref.alloc ops, we can't tile along reduction dims.

The next step is to get unroll vector pass in, so we can vectorize more
ops.

This PR improves the performance of transformer-benchmark from 58 ms to
33 ms.

Vectorization will turn Linalg ops to vector ops and arith ops. Since we
don't propagate information through arith ops during bufferization. We
can't unconditionally vectorize all the ops. To prevent creating extra
memref.alloc ops, we can't tile along reduction dims.

The next step is to get unroll vector pass in, so we can vectorize more
ops.

This PR improves the performance of transformer-benchmark from 58 ms to
33 ms.
@hanhanW
Copy link
Contributor Author

hanhanW commented Nov 12, 2021

We are able to pass all the tests when turning the flag on by default.

I'd like to do it after we're able to tile reduction loop in first level of tiling and enable unrolling vector passes.

@@ -171,10 +149,36 @@ void LLVMCPUTileFuseAndVectorizePass::runOnOperation() {

// Tile and fuse for vector sizes, then tile reduction loops. We don't rely on
// unroll vector pass because it could introduce register pressure.
bool hasMatmulAndIsVectorizable = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just an FYI, this should move into KernelDispatch.cpp so that we can enable this path for cases where this is true within a dispatch region.

@MaheshRavishankar
Copy link
Contributor

We are able to pass all the tests when turning the flag on by default.

I'd like to do it after we're able to tile reduction loop in first level of tiling and enable unrolling vector passes.

Thats a good idea. At that time we probably have to also reduce the L1 tile size used here by default to reduce register pressure (of course search would also find that out probably, but good to have a decent default)

@MaheshRavishankar MaheshRavishankar merged commit 9072698 into iree-org:main Nov 13, 2021
@hanhanW hanhanW deleted the tfv branch November 13, 2021 21:00
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.

3 participants