-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[MLIR] Fix VectorEmulateNarrowType constant op mask bug #116064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,3 +249,41 @@ func.func @vector_maskedload_i2_dynamic_indexing_mixed(%passthru: vector<3xi2>, | |
// CHECK: %[[IN8:.+]] = vector.insert %[[EX8]], %[[IN7]] [1] : i2 into vector<3xi2> | ||
// CHECK: %[[EX9:.+]] = vector.extract %[[SELECT]][%[[INCIDX2]]] : i2 from vector<8xi2> | ||
// CHECK: %[[IN9:.+]] = vector.insert %[[EX9]], %[[IN8]] [2] : i2 into vector<3xi2> | ||
|
||
// ----- | ||
|
||
func.func @vector_maskedload_i4_constant_mask_unaligned(%passthru: vector<5xi2>) -> vector<5xi2> { | ||
lialan marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed it in the previous review. Could you remind me why it is labeled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hanhanW copy/paste mis match, I should have double checked it. I will update it later in a batch refactoring. |
||
%0 = memref.alloc() : memref<3x5xi2> | ||
%mask = arith.constant dense<[false, true, true, true, false]> : vector<5xi1> | ||
%c0 = arith.constant 0 : index | ||
%c1 = arith.constant 1 : index | ||
%1 = vector.maskedload %0[%c1, %c0], %mask, %passthru : | ||
lialan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
memref<3x5xi2>, vector<5xi1>, vector<5xi2> into vector<5xi2> | ||
return %1 : vector<5xi2> | ||
} | ||
|
||
// CHECK: func @vector_maskedload_i4_constant_mask_unaligned( | ||
lialan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// CHECK-SAME: %[[PTH:.+]]: vector<5xi2>) -> vector<5xi2> | ||
// CHECK: %[[ALLOC:.+]] = memref.alloc() : memref<4xi8> | ||
// CHECK: %[[MASK:.+]] = arith.constant dense<[false, true, true, true, false]> : vector<5xi1> | ||
|
||
// CHECK: %[[COMPRESSED_MASK:.+]] = arith.constant dense<true> : vector<2xi1> | ||
// CHECK: %[[EMPTY:.+]] = arith.constant dense<0> : vector<8xi2> | ||
// CHECK: %[[PTH_PADDED:.+]] = vector.insert_strided_slice %[[PTH]], %[[EMPTY]] | ||
// CHECK-SAME: {offsets = [1], strides = [1]} : vector<5xi2> into vector<8xi2> | ||
|
||
// Emulated masked load from alloc: | ||
// CHECK: %[[PTH_PADDED_UPCAST:.+]] = vector.bitcast %[[PTH_PADDED]] : vector<8xi2> to vector<2xi8> | ||
// CHECK: %[[C1:.+]] = arith.constant 1 : index | ||
// CHECK: %[[MASKLOAD:.+]] = vector.maskedload %[[ALLOC]][%[[C1]]], %[[COMPRESSED_MASK]], %[[PTH_PADDED_UPCAST]] | ||
// CHECK: %[[MASKLOAD_DOWNCAST:.+]] = vector.bitcast %[[MASKLOAD]] : vector<2xi8> to vector<8xi2> | ||
|
||
// Select from emulated loaded vector and passthru vector: | ||
// TODO: fold this part if possible. | ||
// CHECK: %[[EMPTY_MASK:.+]] = arith.constant dense<false> : vector<8xi1> | ||
// CHECK: %[[MASK_PADDED:.+]] = vector.insert_strided_slice %[[MASK]], %[[EMPTY_MASK]] | ||
// CHECK-SAME: {offsets = [1], strides = [1]} : vector<5xi1> into vector<8xi1> | ||
// CHECK: %[[SELECT:.+]] = arith.select %[[MASK_PADDED]], %[[MASKLOAD_DOWNCAST]], %[[PTH_PADDED]] : vector<8xi1>, vector<8xi2> | ||
// CHECK: %[[RESULT:.+]] = vector.extract_strided_slice %[[SELECT]] | ||
// CHECK-SAME: {offsets = [1], sizes = [5], strides = [1]} : vector<8xi2> to vector<5xi2> | ||
// CHECK: return %[[RESULT]] : vector<5xi2> |
Uh oh!
There was an error while loading. Please reload this page.