[all-commits] [llvm/llvm-project] a3c7d4: [mlir][spirv] Implement UMod canonicalization for ...
Darren Wihandi via All-commits
all-commits at lists.llvm.org
Mon Jun 9 08:09:58 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a3c7d461456f2da25c1d119b6686773f675e313e
https://github.com/llvm/llvm-project/commit/a3c7d461456f2da25c1d119b6686773f675e313e
Author: Darren Wihandi <65404740+fairywreath at users.noreply.github.com>
Date: 2025-06-09 (Mon, 09 Jun 2025)
Changed paths:
M mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.cpp
M mlir/test/Dialect/SPIRV/Transforms/canonicalize.mlir
Log Message:
-----------
[mlir][spirv] Implement UMod canonicalization for vector constants (#141902)
Closes #63174.
Implements this transformation pattern, which is currently only applied
to scalars, for vectors:
```
%1 = "spirv.UMod"(%0, %CONST_32) : (i32, i32) -> i32
%2 = "spirv.UMod"(%1, %CONST_4) : (i32, i32) -> i32
```
to
```
%1 = "spirv.UMod"(%0, %CONST_32) : (i32, i32) -> i32
%2 = "spirv.UMod"(%0, %CONST_4) : (i32, i32) -> i32
```
Additionally fixes and issue where patterns like this:
```
%1 = "spirv.UMod"(%0, %CONST_4) : (i32, i32) -> i32
%2 = "spirv.UMod"(%1, %CONST_32) : (i32, i32) -> i32
```
were incorrectly canonicalized to:
```
%1 = "spirv.UMod"(%0, %CONST_4) : (i32, i32) -> i32
%2 = "spirv.UMod"(%0, %CONST_32) : (i32, i32) -> i32
```
which is incorrect since `(X % A) % B` == `(X % B)` IFF A is a multiple
of B, i.e., B divides A.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list