module { tt.func public @triton__0d1d2d3de4e(%arg0: !tt.ptr {tt.divisibility = 16 : i32}, %arg1: !tt.ptr {tt.divisibility = 16 : i32}, %arg2: !tt.ptr {tt.divisibility = 16 : i32}, %arg3: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}, %arg4: i32 {tt.max_divisibility = 8 : i32}) attributes {noinline = false} { %cst = arith.constant dense<256> : tensor<64x1xi64> %cst_0 = arith.constant dense<0> : tensor<64x1xi64> %cst_1 = arith.constant dense<512> : tensor<64x1xi64> %c4_i32 = arith.constant 4 : i32 %c120_i32 = arith.constant 120 : i32 %c0_i32 = arith.constant 0 : i32 %cst_2 = arith.constant dense : tensor<64x1xi1> %cst_3 = arith.constant dense<256> : tensor<64x1xi32> %cst_4 = arith.constant dense<131072> : tensor<1x4xi32> %cst_5 = arith.constant dense<120> : tensor<1x4xi32> %cst_6 = arith.constant dense<0.000000e+00> : tensor<64x4xf32> %c64_i32 = arith.constant 64 : i32 %0 = tt.get_program_id x : i32 %1 = arith.muli %0, %c64_i32 : i32 %2 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32> %3 = tt.expand_dims %2 {axis = 1 : i32} : (tensor<64xi32>) -> tensor<64x1xi32> %4 = tt.splat %1 : (i32) -> tensor<64x1xi32> %5 = arith.addi %4, %3 : tensor<64x1xi32> %6 = tt.make_range {end = 4 : i32, start = 0 : i32} : tensor<4xi32> %7 = tt.expand_dims %6 {axis = 0 : i32} : (tensor<4xi32>) -> tensor<1x4xi32> %8 = tt.broadcast %5 : (tensor<64x1xi32>) -> tensor<64x4xi32> %9 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x4x!tt.ptr> %10 = scf.for %arg5 = %c0_i32 to %c120_i32 step %c4_i32 iter_args(%arg6 = %cst_6) -> (tensor<64x4xf32>) : i32 { %27 = tt.splat %arg5 : (i32) -> tensor<1x4xi32> %28 = arith.addi %27, %7 : tensor<1x4xi32> %29 = arith.cmpi slt, %28, %cst_5 : tensor<1x4xi32> %30 = arith.muli %28, %cst_4 : tensor<1x4xi32> %31 = tt.broadcast %30 : (tensor<1x4xi32>) -> tensor<64x4xi32> %32 = arith.addi %8, %31 : tensor<64x4xi32> %33 = tt.addptr %9, %32 : tensor<64x4x!tt.ptr>, tensor<64x4xi32> %34 = tt.broadcast %29 : (tensor<1x4xi1>) -> tensor<64x4xi1> %35 = tt.load %33, %34, %cst_6 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x4xf32> %36 = arith.addf %arg6, %35 : tensor<64x4xf32> %37 = arith.select %34, %36, %arg6 : tensor<64x4xi1>, tensor<64x4xf32> scf.yield %37 : tensor<64x4xf32> } %11 = "tt.reduce"(%10) <{axis = 1 : i32}> ({ ^bb0(%arg5: f32, %arg6: f32): %27 = arith.addf %arg5, %arg6 : f32 tt.reduce.return %27 : f32 }) : (tensor<64x4xf32>) -> tensor<64xf32> %12 = tt.expand_dims %11 {axis = 1 : i32} : (tensor<64xf32>) -> tensor<64x1xf32> %13 = arith.divsi %5, %cst_3 : tensor<64x1xi32> %14 = arith.remsi %5, %cst_3 : tensor<64x1xi32> %15 = tt.splat %arg1 : (!tt.ptr) -> tensor<64x1x!tt.ptr> %16 = tt.addptr %15, %13 : tensor<64x1x!tt.ptr>, tensor<64x1xi32> %17 = tt.load %16 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x1xi64> %18 = arith.addi %17, %cst_1 : tensor<64x1xi64> %19 = arith.cmpi slt, %17, %cst_0 : tensor<64x1xi64> %20 = arith.select %19, %18, %17 : tensor<64x1xi1>, tensor<64x1xi64> %21 = arith.muli %20, %cst : tensor<64x1xi64> %22 = arith.extsi %14 : tensor<64x1xi32> to tensor<64x1xi64> %23 = arith.addi %22, %21 : tensor<64x1xi64> %24 = tt.splat %arg2 : (!tt.ptr) -> tensor<64x1x!tt.ptr> %25 = tt.addptr %24, %23 : tensor<64x1x!tt.ptr>, tensor<64x1xi64> %26 = "tt.atomic_rmw"(%25, %12, %cst_2) <{atomic_rmw_op = 5 : i32, scope = 1 : i32, sem = 4 : i32}> : (tensor<64x1x!tt.ptr>, tensor<64x1xf32>, tensor<64x1xi1>) -> tensor<64x1xf32> tt.return } }