@@ -68,3 +68,25 @@ module attributes {"ttg.num-ctas" = 1 : i32, "ttg.num-warps" = 1 : i32, ttg.targ
6868 tt.return
6969 }
7070}
71+
72+ // -----
73+
74+ #blocked = #ttg.blocked <{sizePerThread = [1 ], threadsPerWarp = [32 ], warpsPerCTA = [1 ], order = [0 ]}>
75+ #shared = #ttg.swizzled_shared <{vec = 1 , perPhase = 1 , maxPhase = 1 , order = [0 ]}>
76+ #smem = #ttg.shared_memory
77+
78+ module attributes {" ttg.num-ctas" = 1 : i32 , " ttg.num-warps" = 1 : i32 , ttg.target = " hip:gfx1201" , " ttg.threads-per-warp" = 32 : i32 } {
79+ // tle.local_pointers has no axis-info visitor, so its result carries a
80+ // degenerate rank-0 entry. The atomic lowering must tolerate that instead of
81+ // indexing the contiguity vector, which is only a hint for intra-wave reduce.
82+ // CHECK-LABEL: llvm.func @local_pointers_atomic_rmw
83+ // CHECK: llvm.getelementptr {{.*}}!llvm.ptr<3>
84+ // CHECK: llvm.atomicrmw fadd {{.*}} syncscope("workgroup") monotonic : !llvm.ptr<3>, f32
85+ // CHECK-NOT: tle.local_pointers
86+ tt.func public @local_pointers_atomic_rmw (%idx: tensor <32 xi32 , #blocked >, %val: tensor <32 xf32 , #blocked >) {
87+ %buf = ttg.local_alloc : () -> !ttg.memdesc <32 xf32 , #shared , #smem , mutable >
88+ %ptrs = " tle.local_pointers" (%buf , %idx ) : (!ttg.memdesc <32 xf32 , #shared , #smem , mutable >, tensor <32 xi32 , #blocked >) -> tensor <32 x!tt.ptr <f32 , 3 >, #blocked >
89+ %res = tt.atomic_rmw fadd , relaxed , cta , %ptrs , %val : (tensor <32 x!tt.ptr <f32 , 3 >, #blocked >, tensor <32 xf32 , #blocked >) -> tensor <32 xf32 , #blocked >
90+ tt.return
91+ }
92+ }
0 commit comments