@@ -84,6 +84,29 @@ tt.func @test_combine_addptr_pattern(%base: !tt.ptr<f32>) -> tensor<8x!tt.ptr<f3
8484 tt.return %ptr1 : tensor <8 x!tt.ptr <f32 >>
8585}
8686
87+ // CHECK-LABEL: @test_combine_addptr_pattern_discardableattrs
88+ tt.func @test_combine_addptr_pattern_discardableattrs (%base: !tt.ptr <f32 >) -> !tt.ptr <f32 > {
89+ %off0 = arith.constant 8 : i32
90+ %off1 = arith.constant 4 : i32
91+ // CHECK-NEXT: %[[cst:.*]] = arith.constant 12 : i32
92+ // CHECK-NEXT: %0 = tt.addptr %{{.*}}, %[[cst]] {tt.constancy = 8 : i32, tt.contiguity = 512 : i32, tt.divisibility = 16 : i32} : !tt.ptr<f32>, i32
93+ %ptr0 = tt.addptr %base , %off0 : !tt.ptr <f32 >, i32
94+ %ptr1 = tt.addptr %ptr0 , %off1 {tt.divisibility = 16 : i32 , tt.constancy = 8 : i32 , tt.contiguity = 512 : i32 } : !tt.ptr <f32 >, i32
95+
96+ tt.return %ptr1 : !tt.ptr <f32 >
97+ }
98+
99+ // CHECK-LABEL: @test_combine_addptr_pattern_discardableattrs_disallowed
100+ tt.func @test_combine_addptr_pattern_discardableattrs_disallowed (%base: !tt.ptr <f32 >) -> !tt.ptr <f32 > {
101+ %off0 = arith.constant 8 : i32
102+ %off1 = arith.constant 4 : i32
103+ // CHECK-NEXT: %[[cst:.*]] = arith.constant 12 : i32
104+ // CHECK-NEXT: %0 = tt.addptr %{{.*}}, %[[cst]] {tt.divisibility = 16 : i32} : !tt.ptr<f32>, i32
105+ %ptr0 = tt.addptr %base , %off0 : !tt.ptr <f32 >, i32
106+ %ptr1 = tt.addptr %ptr0 , %off1 {tt.divisibility = 16 : i32 , tt.disallowed = 8 : i32 } : !tt.ptr <f32 >, i32
107+
108+ tt.return %ptr1 : !tt.ptr <f32 >
109+ }
87110// CHECK-LABEL: @test_combine_addptr_pattern_i64
88111tt.func @test_combine_addptr_pattern_i64 (%base: !tt.ptr <f32 >) -> tensor <8 x!tt.ptr <f32 >> {
89112 %off0 = arith.constant 10 : i64
0 commit comments