Repository navigation
ukernels: stop abusing signless as signed - #15338
Merged
Merged
Conversation
bjacob
force-pushed
the
ukernels-signedness
branch
from
October 30, 2023 14:12
5708121 to
3aa6099
Compare
bjacob
marked this pull request as ready for review
October 30, 2023 14:22
bjacob
requested review from
MaheshRavishankar,
benvanik,
dcaballe and
hanhanW
as code owners
October 30, 2023 14:22
hanhanW
approved these changes
Oct 30, 2023
ramiro050
pushed a commit
to ramiro050/iree
that referenced
this pull request
Dec 19, 2023
In MLIR we are chronically abusing signless types as signed. Ongoing discussion at iree-org#15241, etc. At least in ukernels we are insulated enough from the compiler code that we don't have to replicate the same confusion. So, just because `linalg` named matmul ops want `int8 x int8 -> int32` matmuls to be represented as `i8 x i8 -> i32` even though these are signless types and this is silently interpreting these as signed, we didn't have to let that lower to a `_i8i8i32` ukernel, we could instead more properly represent that as a `_s8s8s32` ukernel. Fixing this now paves the way for unsigned LHS/RHS support in ukernels, a step in iree-org#15158, without adding more tech debt. The bulk of is PR is just a regex substitution: ``` find runtime/src/ compiler/src/ -type f | xargs sed -i 's/IREE_UK_FLAG_MMT4D_TYPE_I8I8I32/IREE_UK_FLAG_MMT4D_TYPE_S8S8S32/g;s/iree_uk_mmt4d_type_i8i8i32/iree_uk_mmt4d_type_s8s8s32/g;s/iree_uk_mmt4d_tile_i8i8i32/iree_uk_mmt4d_tile_s8s8s32/g;s/iree_mmt4d_reference_innerloop_i8i8i32/iree_mmt4d_reference_innerloop_s8s8s32/g' ```
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In MLIR we are chronically abusing signless types as signed. Ongoing discussion at #15241, etc. At least in ukernels we are insulated enough from the compiler code that we don't have to replicate the same confusion. So, just because
linalgnamed matmul ops wantint8 x int8 -> int32matmuls to be represented asi8 x i8 -> i32even though these are signless types and this is silently interpreting these as signed, we didn't have to let that lower to a_i8i8i32ukernel, we could instead more properly represent that as a_s8s8s32ukernel.Fixing this now paves the way for unsigned LHS/RHS support in ukernels, a step in #15158, without adding more tech debt.
The bulk of is PR is just a regex substitution: