Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir] Fix printer when it is a DenseElementsAttr of i1
A large DenseElementsAttr of i1could trigger a bug in printer/parser roundtrip. Ex. A DenseElementsAttr of i1 with 200 elements will print as Hex format of length 400 before the fix. However, when parsing the printed text, an error will be triggered. After fix, the printed length will be 50. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D122925
- Loading branch information
1 parent
6ca1df6
commit e5a4cf6
Showing
3 changed files
with
15 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: mlir-opt -canonicalize %s | mlir-opt | FileCheck %s | ||
|
||
// CHECK-LABEL: @large_i1_tensor_roundtrip | ||
func @large_i1_tensor_roundtrip() -> tensor<160xi1> { | ||
%cst_0 = arith.constant dense<"0xFFF00000FF000000FF000000FF000000FF000000"> : tensor<160xi1> | ||
%cst_1 = arith.constant dense<"0xFF000000FF000000FF000000FF000000FF0000F0"> : tensor<160xi1> | ||
// CHECK: dense<"0xFF000000FF000000FF000000FF000000FF000000"> | ||
%0 = arith.andi %cst_0, %cst_1 : tensor<160xi1> | ||
return %0 : tensor<160xi1> | ||
} |
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