-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifications around narrow dimensions in encodings. (#18607)
* Drop the `kNarrowThreshold` constant, relying instead on the default padding value. * When reading an `encoding` attribute to tell if a `round_dims_to` entry should be considered narrow, rely on the fact that we only ever need one narrowest dimension in a given matmul to be considered narrow, so the smallest `round_dims_to` entry is the narrow one; if all `round_dims_to` entries are equal, the matmul is not narrow. * Introduce a `MatmulNarrowDim` struct to unify helpers and group them in `EncodingOps.{h,cpp}`. * This enforces in the type system that at most one of the M or N dimensions may be narrow, not both. Previously, we had different structs/tuples, none of which enforced that, so we felt compiled to write comments about the unenforced contract, and the concerned code was scattered across different files. * Remove the `getMatmulNarrow{M,N}` getters on `EncodingAttr`. * Generally we are over-relying on TableGen class methods, which only obfuscates things compared to functions declared manually in C++ files, and the new `MatmulNarrowDim` struct allows replacing both these methods by a single `getMatmulNarrowDim`, which also simplifies callers. Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
- Loading branch information
Showing
6 changed files
with
95 additions
and
92 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
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