Skip to content

Commit 45c05ca

Browse files
authored
Integrate torch-mlir at llvm/torch-mlir@288cd5e8adb (#22508)
Carries cherry-pick iree-org/torch-mlir@42dff72 (WIP PR llvm/torch-mlir#4358) Fixes ONNX failure related to i1 tensors. --------- Signed-off-by: Ian Wood <[email protected]>
1 parent c0c9b69 commit 45c05ca

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

compiler/src/iree/compiler/Dialect/Stream/IR/StreamOpFolders.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ static TypedAttr tryNarrowPatternBits(TypedAttr patternAttr) {
134134
return patternAttr;
135135
}
136136

137+
// Don't handle values <= 8 bits. We are narrowing to a minimum of 8-bits and
138+
// we don't have signedness information to know how to extend them.
139+
if (oldPattern.getBitWidth() <= 8) {
140+
return patternAttr;
141+
}
142+
137143
// Try narrowing the pattern.
138144
auto newPattern = computeRequiredPatternBits(oldPattern);
139145
if (newPattern.getBitWidth() == oldPattern.getBitWidth())

compiler/src/iree/compiler/Dialect/Stream/IR/test/tensor_folding.mlir

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ util.func private @NarrowSplatPatternF32() -> !stream.resource<*> {
174174

175175
// -----
176176

177+
// CHECK-LABEL: @NoNarrowSplatPatternI1
178+
util.func private @NoNarrowSplatPatternI1() -> !stream.resource<*> {
179+
%c100 = arith.constant 100 : index
180+
%pattern = arith.constant true
181+
// CHECK: stream.tensor.splat %true : i1
182+
%0 = stream.tensor.splat %pattern : i1 -> tensor<2x2xi1> in !stream.resource<*>{%c100}
183+
util.return %0 : !stream.resource<*>
184+
}
185+
186+
// -----
187+
177188
// CHECK-LABEL: @FoldTensorCloneOp
178189
util.func private @FoldTensorCloneOp(%arg0: !stream.resource<*>, %arg1: index) -> !stream.resource<*> {
179190
// CHECK-NOT: stream.tensor.clone

third_party/torch-mlir

Submodule torch-mlir updated 39 files

0 commit comments

Comments
 (0)