Skip to content

Commit

Permalink
[Flow] Generalize horizontal contraction fusion to cover more cases. (#…
Browse files Browse the repository at this point in the history
…17880)

Current implementation of horizontal fusion worked only for
contraction (-> truncf)? cases. To generalize it to more cases the
following changes were needed

1) Instead of looking for a `linalg.generic` with a single
   `arith.truncf`, use `isBitTruncate` utility method. To enable this
   the pass is moved to `Flow`.

2) Use `Operation::Equivalence` to check that the contraction
   operations are "similar" and any subsequent truncation operations
   are "similar" too.

3) Instead of trying to find an insertion point based on existing
   dominance relationship between operations,
   - Always insert the horizontally fused contraction before the first
     contraction
   - Always insert the horizontally fused truncation operation before
     the first truncation operation

4) Instead of generating the fills/empty along with horizontally fused
   operations, use separate patterns to fold concats of fills and
   concats of emptys into fill and empty, respectively.

Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com>

---------

Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com>
  • Loading branch information
MaheshRavishankar committed Aug 13, 2024
1 parent 7812c77 commit 9c951ca
Show file tree
Hide file tree
Showing 20 changed files with 883 additions and 486 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pkgci_regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ jobs:
--goldentime-rocm-unet-ms 370.0 \
--goldentime-rocm-clip-ms 18.5 \
--goldentime-rocm-vae-ms 315.0 \
--goldendispatch-rocm-unet 1714 \
--goldendispatch-rocm-clip 1311 \
--goldendispatch-rocm-unet 1691 \
--goldendispatch-rocm-clip 1225 \
--goldendispatch-rocm-vae 248 \
--goldensize-rocm-unet-bytes 2280000 \
--goldensize-rocm-clip-bytes 860000 \
Expand All @@ -363,8 +363,8 @@ jobs:
--goldentime-rocm-unet-ms 77.0 \
--goldentime-rocm-clip-ms 15.5 \
--goldentime-rocm-vae-ms 74.0 \
--goldendispatch-rocm-unet 1714 \
--goldendispatch-rocm-clip 1311 \
--goldendispatch-rocm-unet 1691 \
--goldendispatch-rocm-clip 1225 \
--goldendispatch-rocm-vae 248 \
--goldensize-rocm-unet-bytes 2270000 \
--goldensize-rocm-clip-bytes 860000 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ iree_compiler_cc_library(
"FoldUnitExtentDims.cpp",
"FormDispatchRegions.cpp",
"FormScalarDispatches.cpp",
"FuseHorizontalContractions.cpp",
"FuseMultiUseElementwiseProducer.cpp",
"FusionPreprocessing.cpp",
"FusionUtils.cpp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ iree_cc_library(
"FoldUnitExtentDims.cpp"
"FormDispatchRegions.cpp"
"FormScalarDispatches.cpp"
"FuseHorizontalContractions.cpp"
"FuseMultiUseElementwiseProducer.cpp"
"FusionPreprocessing.cpp"
"FusionUtils.cpp"
Expand Down
Loading

0 comments on commit 9c951ca

Please sign in to comment.