Skip to content

Add patterns to fold tensor.empty with tensor.collapse_expand/shape. - #11847

Merged
MaheshRavishankar merged 1 commit into
iree-org:mainfrom
MaheshRavishankar:reland_11829
Jan 25, 2023
Merged

MaheshRavishankar merged 1 commit into
iree-org:mainfrom
MaheshRavishankar:reland_11829

Conversation

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

This relands #11771.

Without these patterns, we end up with sequences like

%0 = tensor.empty ...
%1 = tensor.collapse_shape %0 ...

which dont get pulled into dispatch regions since
tensor.collapse_shapes arent pulled into dispatch regions. With the patterns the tensor.collapse_shape fold away, avoiding tensor.empty() being left outside.

Fixes #11770

@iree-github-actions-bot

iree-github-actions-bot commented Jan 16, 2023 •

Copy link
Copy Markdown
Contributor

Abbreviated Android Benchmark Summary

@ commit a8618e91a78d72e20af65ff3ed7c41c09d63eb26 (vs. base 9242287e7cca1eab8ab08f4f9f9a52c4cbf91c66)

Regressed Latencies 🚩

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileBertSquad [fp16] (TFLite) full-inference,experimental-flags with IREE-Vulkan @ Pixel-6-Pro (GPU-Mali-G78) 128.674 (vs. 108.016, 19.13%↑) 129.634 1.824
MobileBertSquad [fp16] (TFLite) full-inference,default-flags with IREE-Vulkan @ Pixel-6-Pro (GPU-Mali-G78) 126.749 (vs. 116.287, 9.00%↑) 127.905 4.399
PoseNet [fp32] (TFLite) 4-thread,big-core,full-inference,default-flags with IREE-LLVM-CPU @ Pixel-4 (CPU-ARMv8.2-A) 86.127 (vs. 79.163, 8.80%↑) 86.275 1.908

[Top 3 out of 5 results showed]

Regressed Compilation Times 🚩

Benchmark Name Compilation Time (ms)
DeepLabV3 [fp32] (TFLite) GPU-Mali-Valhall full-inference,default-flags 8468 (vs. 6009, 40.92%↑)
PoseNet [fp32] (TFLite) GPU-Mali-Valhall full-inference,experimental-flags 8288 (vs. 6495, 27.61%↑)
PoseNet [fp32] (TFLite) GPU-Adreno kernel-execution,experimental-flags 8690 (vs. 6820, 27.42%↑)

[Top 3 out of 17 results showed]

Improved Compilation Times 🎉

Benchmark Name Compilation Time (ms)
MobileNetV2 [fp32,imagenet] (TFLite) GPU-Mali-Valhall full-inference,experimental-flags 14395 (vs. 19783, 27.24%↓)
MobileNetV2 [fp32,imagenet] (TFLite) GPU-Mali-Valhall full-inference,default-flags 18240 (vs. 23151, 21.21%↓)
MobileSSD [fp32] (TFLite) GPU-Adreno full-inference,experimental-flags 21294 (vs. 26821, 20.61%↓)

[Top 3 out of 46 results showed]

For more information:

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

I am having a really hard time repro-ing the CI error.... Could we drop the dependence on iree-import-tflite and iree-import-tf. Or is there a way I can download the iree_input.mlir directly so that I can repro the error.....

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

I am having a really hard time repro-ing the CI error.... Could we drop the dependence on iree-import-tflite and iree-import-tf. Or is there a way I can download the iree_input.mlir directly so that I can repro the error.....

@pzread (for the above). Dont have a specific ask here. Just looking for help with repro-ing the CI error (I cant repro it locally actually)

@ScottTodd

Copy link
Copy Markdown
Member

I am having a really hard time repro-ing the CI error.... Could we drop the dependence on iree-import-tflite and iree-import-tf. Or is there a way I can download the iree_input.mlir directly so that I can repro the error.....

If you open the build link (e.g. https://buildkite.com/iree/iree-benchmark-android/builds/5438#0185b8d0-83de-418b-94ca-3b1d5a514246), you can go to Build -> Artifacts -> source-mlir-models to download a zip file of the output after iree-import-tflite. Does that get you what you want?

@ScottTodd

Copy link
Copy Markdown
Member

Oh, the failure is for Linux, which has no artifacts uploaded...

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

Ah, artifacts. Great! Didnt know that the mlir files are also there. Ill see if that helps repro locally.

@ScottTodd

Copy link
Copy Markdown
Member

Oh, artifacts are there, I just looked in the wrong location
https://buildkite.com/iree/iree-benchmark-linux/builds/2671#0185b8d0-a80c-4655-a503-c7691341ed61
(look at the "All jobs" tab, not the "Issues" tab)

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

Oh, artifacts are there, I just looked in the wrong location buildkite.com/iree/iree-benchmark-linux/builds/2671#0185b8d0-a80c-4655-a503-c7691341ed61 (look at the "All jobs" tab, not the "Issues" tab)

Yup. Thanks Scott!

@rsuderman

Copy link
Copy Markdown
Collaborator

This should be fixed when landed with #11952

This relands iree-org#11771.

Without these patterns, we end up with sequences like

```
%0 = tensor.empty ...
%1 = tensor.collapse_shape %0 ...
```

which dont get pulled into dispatch regions since
tensor.collapse_shapes arent pulled into dispatch regions. With the
patterns the tensor.collapse_shape fold away, avoiding
tensor.empty() being left outside.

Fixes iree-org#11770
@MaheshRavishankar
MaheshRavishankar marked this pull request as ready for review January 25, 2023 18:56
@iree-github-actions-bot

Copy link
Copy Markdown
Contributor

Abbreviated Linux Benchmark Summary

@ commit a8618e91a78d72e20af65ff3ed7c41c09d63eb26 (vs. base 9242287e7cca1eab8ab08f4f9f9a52c4cbf91c66)

Regressed Latencies 🚩

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileNetV3Small [fp32,imagenet] (TFLite) 1-thread,full-inference,experimental-flags with IREE-LLVM-CPU @ GCP-c2-standard-16 (CPU-x86\_64-CascadeLake) 4.452 (vs. 4.208, 5.81%↑) 4.463 0.133

Regressed Compilation Times 🚩

Benchmark Name Compilation Time (ms)
PoseNet [fp32] (TFLite) CPU-x86\_64-CascadeLake 8-thread,full-inference,default-flags 15359 (vs. 11998, 28.01%↑)
PoseNet [fp32] (TFLite) CPU-x86\_64-CascadeLake full-inference,default-flags 15359 (vs. 11998, 28.01%↑)
PoseNet [fp32] (TFLite) CPU-x86\_64-CascadeLake 4-thread,full-inference,default-flags 15359 (vs. 11998, 28.01%↑)

[Top 3 out of 26 results showed]

Improved Compilation Times 🎉

Benchmark Name Compilation Time (ms)
PersonDetect [int8] (TFLite) CPU-x86\_64-CascadeLake 8-thread,full-inference,default-flags 12705 (vs. 13461, 5.62%↓)
PersonDetect [int8] (TFLite) CPU-x86\_64-CascadeLake full-inference,default-flags 12705 (vs. 13461, 5.62%↓)
PersonDetect [int8] (TFLite) CPU-x86\_64-CascadeLake 4-thread,full-inference,default-flags 12705 (vs. 13461, 5.62%↓)

[Top 3 out of 5 results showed]

For more information:

@MaheshRavishankar
MaheshRavishankar merged commit a359b0a into iree-org:main Jan 25, 2023
@MaheshRavishankar
MaheshRavishankar deleted the reland_11829 branch January 25, 2023 20:55
qedawkins pushed a commit to qedawkins/iree that referenced this pull request Apr 2, 2023
…ree-org#11847)

This relands iree-org#11771.

Without these patterns, we end up with sequences like

%0 = tensor.empty ...
%1 = tensor.collapse_shape %0 ...
which dont get pulled into dispatch regions since
tensor.collapse_shapes arent pulled into dispatch regions. With the patterns the tensor.collapse_shape fold away, avoiding tensor.empty() being left outside.

Fixes iree-org#11770
jpienaar pushed a commit that referenced this pull request May 1, 2023
…11847)

This relands #11771.

Without these patterns, we end up with sequences like

%0 = tensor.empty ...
%1 = tensor.collapse_shape %0 ...
which dont get pulled into dispatch regions since
tensor.collapse_shapes arent pulled into dispatch regions. With the patterns the tensor.collapse_shape fold away, avoiding tensor.empty() being left outside.

Fixes #11770
rengolin pushed a commit to plaidml/iree that referenced this pull request May 2, 2023
…ree-org#11847)

This relands iree-org#11771.

Without these patterns, we end up with sequences like

%0 = tensor.empty ...
%1 = tensor.collapse_shape %0 ...
which dont get pulled into dispatch regions since
tensor.collapse_shapes arent pulled into dispatch regions. With the patterns the tensor.collapse_shape fold away, avoiding tensor.empty() being left outside.

Fixes iree-org#11770
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.

Empty output tensors not getting pulled in to dispatch regions.

5 participants