-
Notifications
You must be signed in to change notification settings - Fork 633
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
Fix SDXL dispatch count regression from llvm integrate #19002
Comments
ew, we should really not be seeing those asserts - what's adding those? |
I think this is coming from |
Nope - they make it all the way to runtime if they are outside of dispatches and as you're seeing here will have bad influences during dispatch region formation/executable generation. Asserts should only be added explicitly by users unless a debug mode is enabled, IMO. Asserts inside of dispatches are no-ops today and get removed too late, so they just make compilation worse. They could be used for int range analysis hints in a release build - but if that's the case we should probably absorb them into the int range ops at input time instead. |
That makes sense, I think they are there to conform with pytorch ops specs. We don't currently have a "debug/release mode" right? @MaheshRavishankar do you have any suggestions on how to fix this? |
For now though, |
I thought that is on by default? |
Doesn't seem like it. It could be. I suspect only a fraction of users care about the assertions and more would be confused by how badly they mess up performance. |
@IanWood1 maybe start with adding this flag to all the CI tests, and a separate PR that turns it on by default. |
I tried turning it on in #19014 but I didn't realize assertions don't get stripped until after hoisting, so there is no effect on dispatch count. Should this pass be moved? There is a comment explaining why it need to be after optimizations: iree/compiler/src/iree/compiler/GlobalOptimization/Passes.cpp Lines 226 to 229 in 2a5d123
|
Good catch. That may not be true anymore now that we have information coming from the frontend and |
(oh and I'm pretty sure we don't derive information from the assertions today - so it'd be safe to move now!) |
This change _temporarily_ adds `iree-opt-strip-assertions` to SDXL CI which should fix the regression discussed in #19002. Assertions within `linalg.generic` ops can mess with dispatch creation and lead to poorly performing dispatches, despite the fact that they get stripped in later pipelines. --------- Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
This change _temporarily_ adds `iree-opt-strip-assertions` to SDXL CI which should fix the regression discussed in iree-org#19002. Assertions within `linalg.generic` ops can mess with dispatch creation and lead to poorly performing dispatches, despite the fact that they get stripped in later pipelines. --------- Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
This change _temporarily_ adds `iree-opt-strip-assertions` to SDXL CI which should fix the regression discussed in iree-org#19002. Assertions within `linalg.generic` ops can mess with dispatch creation and lead to poorly performing dispatches, despite the fact that they get stripped in later pipelines. --------- Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu> Signed-off-by: Giacomo Serafini <179146510+giacs-epic@users.noreply.github.com>
The most recent llvm integrate, #18987, introduced a minor regression in SDXL clip dispatch count (1139 ⇾ 1141). I tracked it to llvm/llvm-project@df0d249. I was able to restore the dispatch count by locally reverting this single commit.
Here are the 2 additional dispatches after LLVM integrate:
Command used:
iree-compile artifacts/sdxl_clip/model.mlirbc -o extra-dispatches.mlir --iree-hal-target-backends=rocm --iree-hip-target=gfx942 --iree-opt-const-eval=false --iree-global-opt-propagate-transposes=true --iree-dispatch-creation-enable-fuse-horizontal-contractions=true --iree-dispatch-creation-enable-aggressive-fusion=true --iree-opt-aggressively-propagate-transposes=true --iree-opt-outer-dim-concat=true --iree-llvmgpu-enable-prefetch=true --iree-opt-data-tiling=false --iree-codegen-gpu-native-math-precision=true --iree-codegen-llvmgpu-use-vector-distribution --iree-hip-waves-per-eu=2 --iree-execution-model=async-external --iree-scheduling-dump-statistics-format=json --iree-scheduling-dump-statistics-file=compilation_info.json '--iree-preprocessing-pass-pipeline=builtin.module(iree-preprocessing-transpose-convolution-pipeline,iree-preprocessing-pad-to-intrinsics)' --compile-to=dispatch-creation
MLIR:
It appears these
linalg.generic
s were getting CSE'd before the change but can't anymore because of thecf.assert
which have side effects.The text was updated successfully, but these errors were encountered: