forked from triton-lang/triton
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LAYOUTS] Use least squares solution in invertAndCompose (triton-lang…
…#5309) In this PR, we remove the need fro a few hacks in `invertAndCompose`, namely the need for `getInjectiveMat` which did not work in cases where the input and the output had a different number of registers (same with different number of blocks) and led to the implementation of hacks on top of it like the gymnastics with `getFreeVariable`. We now just compute the `invertAndCompose` as the matrix `X` which is the solution to the system `AX = B`. We add enough asserts to check that this system has at least one solution (i.e. A is surjective) and we make explicit the heuristic we use to minimise data-movement (not consider dimensions that are the same, and otherwise incentivise broadcasting via choosing the solution of minimal norm). For an explanation of how to solve this system, see https://github.com/triton-lang/triton/pull/5309/files/a9069c73637a6b4735cdc39d1c7f338cfdd17a8f#r1869084111 In the future, this function would be better returning the compact form of the system, where if a dimension is not present it's because the conversion is uniform over that dimension, but for that we need to adapt our lowering algorithms.
- Loading branch information
Showing
6 changed files
with
168 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.