Repository navigation
[flow] enable reduction+broadcast+elementwise by default - #9789
Conversation
Abbreviated Benchmark Summary@ commit 12134e80070cc48df7a9d73bc5526eabe84d11bd (vs. base d35b332814389f86618219516157f936e1830399) Regressed Latencies 🚩
Improved Latencies 🎉
[Top 3 out of 5 results showed] No improved or regressed compilation metrics 🏖️ For more information: |
|
I still get the same failure for CUDA: check_cuda_cuda_bert_encoder_unrolled_fake_weights. @ThomasRaoux Please take a look. I also found new failure for vulkan, related to dynamic dims. (This is new. Looking into it.) |
|
@pzread what is the total dispatch size? Do we have "number of dispatches", which is static information from the compiler? |
|
I was able to reproduce the vulkan failure and created an issue: #9802 |
|
It's final machine code binary size - so this PR likely triggers some nasty unrolling that massively bloats the binaries (and thus also takes much longer to compile). I don't think it's the PR's fault, but we can't land it until we figure out how to not regress. Maybe @dcaballe's recent changes to LLVM unrolling will help? |
|
(massive kudos to @pzread - we've had regressions like this in the past we haven't noticed until it was too late!) |
|
Cool. Yes, we should investigate and confirm that. The nasty unrolling might have improved the perf. |
|
It looks like the reported latencies are within the noise so I think it's mostly a wash but looking at some traces would be useful. Our (previous?) reliance on the LLVM autovectorizer/unrolling could trigger these pathologically bad cases - at some point you unroll so much your inner loop doesn't fit in I$ and you get slower! The fusion this PR does should reduce code size (as we have fewer dispatches with the per-dispatch overhead in the binary) so I think it'll be a good change regardless of performance impact if we can reel in whatever is causing the explosion and reap the binary size improvements. |
|
The improvement in the latency is real. @hanhanW also measured. I am wondering if the improvement is coming from the unrolling or not, since the CPU side may have less impact from the lower number of dispatches. |
|
Is it an improvement not tracked in the benchmarks? (I'm going off of the posts above, which show as many regressions as improvements of the same 1-10% magnitude) |
We disabled LLVM vectorizers by default (#9642). If a loop is not vectorized in MLIR and it's not in LLVM, it might be more aggressively unrolled. You could try enabling the vectorizers again and see what happens. LLVM unrolling is still enabled by default since disabling it leads to significant regressions. You can try disabling it and see what happens (#9658).
+1! I'm super excited about this new feature! |
|
The regression about compilation time and binary sizes could be real. I image that the total number of dispatches are less, but the kind of dispatches are more. E.g.,, we could only have |
12134e8 to
43d5932
Compare
Vulkan codegen is not supported yet. (See iree-org#9802)
43d5932 to
5d07e7e
Compare
|
The dynamic shape case is disabled for now since Vulkan needs more work to support it. (#9802) |
|
Could we add some execution tests for the corner cases we identified in e2e/regression? That would make me feel more confident as I'm not convinced all the backends have a robust handling of such dispatch regions. What do you think? |
|
Sounds good. I will do the e2e work as a separate issue, since I need to iterate over the whole benchmark suite and extract the portions (softmax and normalizations). |
|
Created #9938 for adding e2e tests. |
|
Sorry, I didnt comment on this for a while. But wasnt sure if the increase in compilation time and dispatch sizes are justified. Would be good to triage the cause of those two. |
|
Oh. Good point. I will revert the flag again until we get some good understanding about them. |
|
Eh, its in, so unless someone else objects, I dont think it needs to be reverted. But would be good to triage to know if it should be reverted. |
|
My guess is that the problem is that the broadcasted dimension is not being tiled and end up being vectorized and fully unrolled which generates a large amount of code. |
|
Not sure why, but the dispatch size on the merge run looks fine: 65088 -> 65904 bytes Manually checked both binaries from the previous problematic run and the latest run, the numbers in the reports are correct. So I guess some changes fixed the issue in the past few weeks? |
|
Also, the compilation time seems also in the range of noise. https://perf.iree.dev/serie?IREE?MiniLML12H384Uncased%20%5Bint32%5D%20(TF)%20CPU-x86_64-CascadeLake%20full-inference%2Cdefault-flags%20%5Bcompilation%3Amodule%3Acompilation-time%5D |
|
Not much to triage here based on the latest perf run. I won't revert the change. I am going to add more small e2e tests which might help identify the issue later. |
|
Noticed that the MiniLM latency on CUDA is doubled with this change. Is that expected? |
|
huh, I dont think it is expected. Maybe it needed some upstream fixes w.r.t CUDA handling reductions that might be needed |
|
@ThomasRaoux do you have an idea? I believe the CUDA path was tested with the option on. |
|
Yes I had tested the model from Nod. Is it the same one? Something must have changed. @pzread how can we get the mlir for this? |
|
All artifacts can be found here: https://buildkite.com/iree/iree-benchmark-linux/builds/963 Imported MLIR is in this tgz: https://buildkite.com/organizations/iree/pipelines/iree-benchmark-linux/builds/963/jobs/018264b4-09e0-4154-82f4-d60090c9b882/artifacts/018264d2-3d46-456b-bb0d-6e8dc209939f ( Compiled CUDA vmfb module is in this tgz: https://buildkite.com/organizations/iree/pipelines/iree-benchmark-linux/builds/963/jobs/018264b4-09e0-4154-82f4-d60090c9b882/artifacts/018264d2-3d45-430e-aa8a-a80df1e97aa2 This benchmark is not imported/run with SHARK, but directly imported from MiniLM TF SavedModel, so there might be some differences. |
|
Here is the command that the benchmark ran with: taskset 0xFF /var/lib/buildkite-agent/builds/gcp-buildkite-bench-cuda-a100-1/iree/iree-benchmark-linux/build-targets/linux-cuda/tools/iree-benchmark-module --module_file=../../vmfb/minilm-l12-h384-uncased-tf-model.mlir-0876e46c6fb410aee345a41906f446a6.vmfb --entry_function=predict --function_input=1x512xi32 --function_input=1x512xi32 --function_input=1x512xi32 --device=cuda://0 --time_unit=ns |
|
Thanks @pzread! I'm looking at it. |
|
I see the problem, one transformation is somehow missing. I'll send a patch to fix it |
|
Should be fixed by: |
|
Looks like the big increase went down but the perf are still slower than before the change. It looks like the integrate may also have caused some perf problem. I'll try to debug it on monday |
|
It does look like integrate caused a regression (which is interesting since this integrate was literally no changes to IREE itself, first time I have seen that :P ). Looking through the list of LLVM commits https://github.com/iree-org/iree-llvm-fork/compare/8ae4b985e710fb51a4e01df1cba4df6e64ac1bb3...58526b2d2be932e893218857cc47a16fb05cf1c0 nothing stands out. |
|
I compared the vmfb binary before and after the second regression and they are identical so this seems like an environment issue. I had seen that on gcp before. I restarted the VM used for benchmarking and in the latest run we are faster than before Okwan’s change so we do the expected speed up. So everything should be solved at this point. |



No description provided.