-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[mlir][vector][memref] Add alignment
attribute to memory access ops
#144344
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
base: main
Are you sure you want to change the base?
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1139,3 +1139,21 @@ func.func @expand_shape_invalid_output_shape( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
into memref<2x15x20xf32, strided<[60000, 4000, 2], offset: 100>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
// ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
func.func @test_invalid_negative_load_alignment(%memref: memref<4xi32>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
%c0 = arith.constant 0 : index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
// expected-error @below {{'memref.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
%val = memref.load %memref[%c0] { alignment = -1 } : memref<4xi32> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
// ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
func.func @test_invalid_non_power_of_2_store_alignment(%memref: memref<4xi32>, %val: i32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
%c0 = arith.constant 0 : index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
// expected-error @below {{'memref.store' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
memref.store %val, %memref[%c0] { alignment = 3 } : memref<4xi32> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+1143
to
+1159
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. Please make sure that these are clustered with other tests for llvm-project/mlir/test/Dialect/MemRef/invalid.mlir Lines 936 to 961 in 541f33e
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -613,3 +613,15 @@ func.func @memref_transpose_map(%src : memref<?x?xf32>) -> memref<?x?xf32, affin | |
%dst = memref.transpose %src (i, j) -> (j, i) : memref<?x?xf32> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>> | ||
return %dst : memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>> | ||
} | ||
|
||
// ----- | ||
|
||
// CHECK-LABEL: func @test_load_store_alignment | ||
// CHECK: memref.load {{.*}} {alignment = 16 : i64} | ||
// CHECK: memref.store {{.*}} {alignment = 16 : i64} | ||
func.func @test_load_store_alignment(%memref: memref<4xi32>) { | ||
%c0 = arith.constant 0 : index | ||
%val = memref.load %memref[%c0] { alignment = 16 } : memref<4xi32> | ||
memref.store %val, %memref[%c0] { alignment = 16 } : memref<4xi32> | ||
return | ||
} | ||
Comment on lines
+617
to
+627
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.
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2005,3 +2005,21 @@ func.func @vector_store(%dest : memref<?xi8>, %vec : vector<16x16xi8>) { | |||||||||||||||||||||
vector.store %vec, %dest[%c0] : memref<?xi8>, vector<16x16xi8> | ||||||||||||||||||||||
return | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
// ----- | ||||||||||||||||||||||
|
||||||||||||||||||||||
func.func @test_invalid_negative_load_alignment(%memref: memref<4xi32>) { | ||||||||||||||||||||||
%c0 = arith.constant 0 : index | ||||||||||||||||||||||
// expected-error @below {{'vector.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} | ||||||||||||||||||||||
%val = vector.load %memref[%c0] { alignment = -1 } : memref<4xi32>, vector<4xi32> | ||||||||||||||||||||||
return | ||||||||||||||||||||||
} | ||||||||||||||||||||||
Comment on lines
+2011
to
+2016
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. Please move this inside the block for llvm-project/mlir/test/Dialect/Vector/invalid.mlir Lines 1985 to 1994 in 541f33e
Thanks! Also, I suggest removing |
||||||||||||||||||||||
|
||||||||||||||||||||||
// ----- | ||||||||||||||||||||||
|
||||||||||||||||||||||
func.func @test_invalid_non_power_of_2_store_alignment(%memref: memref<4xi32>, %val: vector<4xi32>) { | ||||||||||||||||||||||
%c0 = arith.constant 0 : index | ||||||||||||||||||||||
// expected-error @below {{'vector.store' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}} | ||||||||||||||||||||||
vector.store %val, %memref[%c0] { alignment = 3 } : memref<4xi32>, vector<4xi32> | ||||||||||||||||||||||
return | ||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1218,3 +1218,13 @@ func.func @step() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%1 = vector.step : vector<[4]xindex> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// CHECK-LABEL: func @test_load_store_alignment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func.func @test_load_store_alignment(%memref: memref<4xi32>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%c0 = arith.constant 0 : index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// CHECK: vector.load {{.*}} {alignment = 16 : i64} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%val = vector.load %memref[%c0] { alignment = 16 } : memref<4xi32>, vector<4xi32> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// CHECK: vector.store {{.*}} {alignment = 16 : i64} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vector.store %val, %memref[%c0] { alignment = 16 } : memref<4xi32>, vector<4xi32> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+1222
to
+1230
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. Please move this near other tests for llvm-project/mlir/test/Dialect/Vector/ops.mlir Lines 757 to 854 in 541f33e
Thanks! |
Uh oh!
There was an error while loading. Please reload this page.