Skip to content

[spirv] Vectorize Linalg ops with reduction dimensions - #8836

Merged
antiagainst merged 2 commits into
iree-org:mainfrom
antiagainst:spirv-vectorize-reduction
May 23, 2022
Merged

antiagainst merged 2 commits into
iree-org:mainfrom
antiagainst:spirv-vectorize-reduction

Conversation

@antiagainst

@antiagainst antiagainst commented Apr 11, 2022 •

Copy link
Copy Markdown
Member

This helps to generate better code for Linalg ops with both
parallel and reduction iterator types but not using minor
identity maps. To make the flow work, SPIRVVectorizePass
is tweaked to pull in more patterns. Also along the way,
enabled tiling along linalg.generic reduction dimensions.

@antiagainst antiagainst added performance ⚡ Performance/optimization related work across the compiler and runtime codegen/spirv SPIR-V code generation compiler backend buildkite:benchmark labels Apr 11, 2022
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch from 48ceae5 to 614563e Compare April 12, 2022 18:17
@antiagainst antiagainst changed the title [spirv] Enable vectorization for projected permutations [spirv] Vectorize Linalg ops with projected permutations Apr 12, 2022
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch from 614563e to ac352fa Compare April 12, 2022 19:42
@iree-github-actions-bot

iree-github-actions-bot commented Apr 12, 2022 •

Copy link
Copy Markdown
Contributor

Abbreviated Benchmark Summary

@ commit c031dc0d74e88f78f2c6a6723b2ce8ee81a62681 (vs. base 523b33ed447caad5dda84003910127d779457f3e)

Regressed Benchmarks 🚩

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
DeepLabV3 [fp32] (TFLite) little-core,full-inference,experimental-flags with IREE-Dylib-Sync @ Pixel-6-Pro (CPU-ARMv8.2-A) 400 (vs. 380, 5.26%↑) 400 2
MobileBertSquad [fp32] (TFLite) 4-thread,big-core,full-inference,experimental-flags with IREE-Dylib @ Pixel-4 (CPU-ARMv8.2-A) 524 (vs. 498, 5.22%↑) 525 4

Improved Benchmarks 🎉

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileNetV3Small [fp32,imagenet] (TFLite) 4-thread,big-core,full-inference,experimental-flags with IREE-Dylib @ Pixel-4 (CPU-ARMv8.2-A) 10 (vs. 11, 9.09%↓) 10 0
MobileSSD [fp32] (TFLite) full-inference,default-flags with IREE-Vulkan @ Pixel-6-Pro (GPU-Mali-G78) 44 (vs. 48, 8.33%↓) 45 0
MobileNetV3Small [fp32,imagenet] (TFLite) 1-thread,big-core,full-inference,default-flags with IREE-Dylib @ Pixel-4 (CPU-ARMv8.2-A) 12 (vs. 13, 7.69%↓) 12 0

[Top 3 out of 6 benchmark results showed]

For more information:

@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch 2 times, most recently from eb278f3 to d1b04cc Compare April 22, 2022 20:03
@antiagainst antiagainst changed the title [spirv] Vectorize Linalg ops with projected permutations [spirv] Vectorize Linalg ops with reduction dimensions Apr 22, 2022
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch 2 times, most recently from 6448795 to 9b9bb69 Compare April 22, 2022 23:39
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch from 9b9bb69 to 5fe9b25 Compare April 25, 2022 03:11
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch 3 times, most recently from c7bed7d to 44be1fd Compare May 19, 2022 15:05
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch 2 times, most recently from 33094fa to ec7fbf5 Compare May 19, 2022 19:21
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch from ec7fbf5 to 0f17f56 Compare May 20, 2022 18:29
This helps to generate better code for Linalg ops with both
parallel and reduction iterator types but not using minor
identity maps. To make the flow work, SPIRVVectorizePass
is tweaked to pull in more patterns. Also along the way,
enabled tiling along `linalg.generic` reduction dimensions.
@antiagainst
antiagainst force-pushed the spirv-vectorize-reduction branch from 0f17f56 to 1f0e971 Compare May 21, 2022 16:27
@antiagainst
antiagainst marked this pull request as ready for review May 23, 2022 14:53

@ThomasRaoux ThomasRaoux 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.

nice :)

@antiagainst
antiagainst merged commit 74cc6bc into iree-org:main May 23, 2022
@antiagainst
antiagainst deleted the spirv-vectorize-reduction branch May 23, 2022 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen/spirv SPIR-V code generation compiler backend performance ⚡ Performance/optimization related work across the compiler and runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants