@@ -881,3 +881,47 @@ def test_tensor_reshape():
881881 expect_layout : ttgl .constexpr = ttgl .BlockedLayout ([1 , 1 , 2 ], [2 , 4 , 4 ], [4 , 1 , 1 ], [2 , 1 , 0 ], [1 , 1 , 1 ], [1 , 1 , 1 ],
882882 [2 , 1 , 0 ])
883883 ttgl .static_assert (v .type .layout == expect_layout )
884+
885+
886+ @filecheck_test
887+ @gluon .jit
888+ def test_zeros ():
889+ # CHECK: [[BLOCKED:#.*]] = #ttg.blocked<{sizePerThread = [2]
890+ # CHECK: [[BLOCKED2D:#.*]] = #ttg.blocked<{sizePerThread = [1, 2]
891+ layout : ttgl .constexpr = ttgl .BlockedLayout ([2 ], [32 ], [4 ], [0 ])
892+ layout_2d : ttgl .constexpr = ttgl .BlockedLayout ([1 , 2 ], [4 , 8 ], [4 , 1 ], [1 , 0 ])
893+
894+ # CHECK: arith.constant dense<0.000000e+00> : tensor<32xf32, [[BLOCKED]]>
895+ a = ttgl .zeros ([32 ], ttgl .float32 , layout )
896+
897+ # CHECK: arith.constant dense<7.000000e+00> : tensor<32xf32, [[BLOCKED]]>
898+ ttgl .full_like (a , 7 )
899+
900+ # CHECK: arith.constant dense<0.000000e+00> : tensor<32xf32, [[BLOCKED]]>
901+ ttgl .zeros_like (a )
902+
903+ # CHECK: arith.constant dense<0.000000e+00> : tensor<64xf32, [[BLOCKED]]>
904+ ttgl .zeros_like (a , shape = [64 ])
905+
906+ # CHECK: arith.constant dense<0> : tensor<16x16xi8, [[BLOCKED2D]]>
907+ ttgl .zeros_like (a , shape = [16 , 16 ], dtype = ttgl .int8 , layout = layout_2d )
908+
909+ # CHECK: arith.constant dense<7> : tensor<8x8xi16, [[BLOCKED2D]]>
910+ ttgl .full_like (a , 7 , shape = [8 , 8 ], dtype = ttgl .int16 , layout = layout_2d )
911+
912+
913+ @filecheck_test
914+ @gluon .jit
915+ def test_barrier ():
916+ # CHECK: gpu.barrier
917+ ttgl .thread_barrier ()
918+
919+
920+ @filecheck_test
921+ @gluon .jit
922+ def test_fence_async_shared ():
923+ # CHECK: ttng.fence_async_shared {bCluster = false}
924+ blackwell .fence_async_shared ()
925+
926+ # CHECK-NEXT: ttng.fence_async_shared {bCluster = true}
927+ blackwell .fence_async_shared (cluster = True )
0 commit comments