#blocked = #triton_gpu.blocked<{sizePerThread = [1, 4], threadsPerWarp = [16, 2], warpsPerCTA = [4, 1], order = [1, 0], CTAsPerCGA = [1, 1], CTASplitNum = [1, 1], CTAOrder = [1, 0]}> #blocked1 = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [32, 1], warpsPerCTA = [4, 1], order = [1, 0], CTAsPerCGA = [1, 1], CTASplitNum = [1, 1], CTAOrder = [1, 0]}> #blocked2 = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [4, 8], warpsPerCTA = [4, 1], order = [1, 0], CTAsPerCGA = [1, 1], CTASplitNum = [1, 1], CTAOrder = [1, 0]}> module attributes {"triton_gpu.compute-capability" = 89 : i32, "triton_gpu.num-ctas" = 1 : i32, "triton_gpu.num-warps" = 4 : i32, "triton_gpu.threads-per-warp" = 32 : i32} { tt.func public @triton__0d1d2d3d4d5d6de7de(%arg0: !tt.ptr {tt.divisibility = 16 : i32}, %arg1: !tt.ptr {tt.divisibility = 16 : i32}, %arg2: !tt.ptr {tt.divisibility = 16 : i32}, %arg3: !tt.ptr {tt.divisibility = 16 : i32}, %arg4: !tt.ptr {tt.divisibility = 16 : i32}, %arg5: !tt.ptr {tt.divisibility = 16 : i32}, %arg6: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}, %arg7: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}) attributes {noinline = false} { %cst = arith.constant dense<512> : tensor<64x1xi32, #blocked> %cst_0 = arith.constant dense<256> : tensor<1x8xi32, #blocked> %cst_1 = arith.constant dense<256> : tensor<64x1xi32, #blocked> %cst_2 = arith.constant dense<0.000000e+00> : tensor<64x8xf32, #blocked> %cst_3 = arith.constant dense<0.000000e+00> : tensor<1x8xf32, #blocked> %cst_4 = arith.constant dense<1.000000e+00> : tensor<64x8xf32, #blocked> %cst_5 = arith.constant dense<256> : tensor<64x1xi64, #blocked> %cst_6 = arith.constant dense<0> : tensor<64x1xi64, #blocked> %cst_7 = arith.constant dense<50257> : tensor<64x1xi64, #blocked> %cst_8 = arith.constant dense<50257> : tensor<64x1xi64, #blocked1> %cst_9 = arith.constant dense<0> : tensor<64x1xi64, #blocked1> %c0_i32 = arith.constant 0 : i32 %c8_i32 = arith.constant 8 : i32 %c256_i32 = arith.constant 256 : i32 %cst_10 = arith.constant dense<1.000000e+00> : tensor<64x8xf32, #blocked2> %cst_11 = arith.constant 0.000000e+00 : f32 %cst_12 = arith.constant dense<0.000000e+00> : tensor<64x8xf32, #blocked2> %cst_13 = arith.constant dense<256> : tensor<1x8xi32, #blocked2> %cst_14 = arith.constant dense<9.99999974E-6> : tensor<64x1xf32, #blocked> %cst_15 = arith.constant dense<2.560000e+02> : tensor<64x1xf32, #blocked> %cst_16 = arith.constant dense<0.000000e+00> : tensor<64x8xbf16, #blocked> %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, #triton_gpu.slice<{dim = 1, parent = #blocked}>> %3 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>> %4 = tt.expand_dims %2 {axis = 1 : i32} : (tensor<64xi32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<64x1xi32, #blocked> %5 = tt.expand_dims %3 {axis = 1 : i32} : (tensor<64xi32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>>) -> tensor<64x1xi32, #blocked1> %6 = tt.splat %1 : (i32) -> tensor<64x1xi32, #blocked> %7 = tt.splat %1 : (i32) -> tensor<64x1xi32, #blocked1> %8 = arith.addi %6, %4 : tensor<64x1xi32, #blocked> %9 = arith.addi %7, %5 : tensor<64x1xi32, #blocked1> %10 = tt.make_range {end = 8 : i32, start = 0 : i32} : tensor<8xi32, #triton_gpu.slice<{dim = 0, parent = #blocked}>> %11 = tt.make_range {end = 8 : i32, start = 0 : i32} : tensor<8xi32, #triton_gpu.slice<{dim = 0, parent = #blocked2}>> %12 = tt.expand_dims %10 {axis = 0 : i32} : (tensor<8xi32, #triton_gpu.slice<{dim = 0, parent = #blocked}>>) -> tensor<1x8xi32, #blocked> %13 = tt.expand_dims %11 {axis = 0 : i32} : (tensor<8xi32, #triton_gpu.slice<{dim = 0, parent = #blocked2}>>) -> tensor<1x8xi32, #blocked2> %14 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x1x!tt.ptr, #blocked> %15 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x1x!tt.ptr, #blocked1> %16 = tt.addptr %14, %8 : tensor<64x1x!tt.ptr, #blocked>, tensor<64x1xi32, #blocked> %17 = tt.addptr %15, %9 : tensor<64x1x!tt.ptr, #blocked1>, tensor<64x1xi32, #blocked1> %18 = tt.load %16 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x1xi64, #blocked> %19 = tt.load %17 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x1xi64, #blocked1> %20 = arith.remsi %8, %cst : tensor<64x1xi32, #blocked> %21 = arith.muli %20, %cst_1 : tensor<64x1xi32, #blocked> %22 = tt.broadcast %21 : (tensor<64x1xi32, #blocked>) -> tensor<64x8xi32, #blocked> %23 = tt.splat %arg2 : (!tt.ptr) -> tensor<64x8x!tt.ptr, #blocked> %24 = arith.muli %8, %cst_1 : tensor<64x1xi32, #blocked> %25 = tt.broadcast %24 : (tensor<64x1xi32, #blocked>) -> tensor<64x8xi32, #blocked> %26 = tt.splat %arg3 : (!tt.ptr) -> tensor<64x8x!tt.ptr, #blocked> %27 = arith.addi %18, %cst_7 : tensor<64x1xi64, #blocked> %28 = arith.addi %19, %cst_8 : tensor<64x1xi64, #blocked1> %29 = arith.cmpi slt, %18, %cst_6 : tensor<64x1xi64, #blocked> %30 = arith.cmpi slt, %19, %cst_9 : tensor<64x1xi64, #blocked1> %31 = arith.select %29, %27, %18 : tensor<64x1xi1, #blocked>, tensor<64x1xi64, #blocked> %32 = arith.select %30, %28, %19 : tensor<64x1xi1, #blocked1>, tensor<64x1xi64, #blocked1> %33 = arith.cmpi sge, %32, %cst_9 : tensor<64x1xi64, #blocked1> %34 = arith.cmpi slt, %32, %cst_8 : tensor<64x1xi64, #blocked1> %35 = arith.andi %33, %34 : tensor<64x1xi1, #blocked1> %36 = arith.muli %31, %cst_5 : tensor<64x1xi64, #blocked> %37 = tt.broadcast %36 : (tensor<64x1xi64, #blocked>) -> tensor<64x8xi64, #blocked> %38 = tt.splat %arg1 : (!tt.ptr) -> tensor<64x8x!tt.ptr, #blocked> %39:4 = scf.for %arg8 = %c0_i32 to %c256_i32 step %c8_i32 iter_args(%arg9 = %cst_2, %arg10 = %cst_2, %arg11 = %cst_12, %arg12 = %cst_2) -> (tensor<64x8xf32, #blocked>, tensor<64x8xf32, #blocked>, tensor<64x8xf32, #blocked2>, tensor<64x8xf32, #blocked>) : i32 { %49 = tt.splat %arg8 : (i32) -> tensor<1x8xi32, #blocked> %50 = tt.splat %arg8 : (i32) -> tensor<1x8xi32, #blocked2> %51 = arith.addi %49, %12 : tensor<1x8xi32, #blocked> %52 = arith.addi %50, %13 : tensor<1x8xi32, #blocked2> %53 = arith.cmpi slt, %51, %cst_0 : tensor<1x8xi32, #blocked> %54 = arith.cmpi slt, %52, %cst_13 : tensor<1x8xi32, #blocked2> %55 = tt.broadcast %51 : (tensor<1x8xi32, #blocked>) -> tensor<64x8xi32, #blocked> %56 = arith.addi %55, %22 : tensor<64x8xi32, #blocked> %57 = tt.addptr %23, %56 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi32, #blocked> %58 = tt.broadcast %53 : (tensor<1x8xi1, #blocked>) -> tensor<64x8xi1, #blocked> %59 = tt.broadcast %54 : (tensor<1x8xi1, #blocked2>) -> tensor<64x8xi1, #blocked2> %60 = tt.load %57, %58, %cst_2 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x8xf32, #blocked> %61 = arith.addi %55, %25 : tensor<64x8xi32, #blocked> %62 = tt.addptr %26, %61 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi32, #blocked> %63 = tt.load %62, %58, %cst_16 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x8xbf16, #blocked> %64 = arith.extf %63 : tensor<64x8xbf16, #blocked> to tensor<64x8xf32, #blocked> tt.assert %35, "index out of bounds: 0 <= tmp3 < 50257", "", "_call_with_frames_removed", 883 : tensor<64x1xi1, #blocked1> %65 = arith.extsi %51 : tensor<1x8xi32, #blocked> to tensor<1x8xi64, #blocked> %66 = tt.broadcast %65 : (tensor<1x8xi64, #blocked>) -> tensor<64x8xi64, #blocked> %67 = arith.addi %66, %37 : tensor<64x8xi64, #blocked> %68 = tt.addptr %38, %67 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi64, #blocked> %69 = tt.load %68, %58, %cst_2 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x8xf32, #blocked> %70 = arith.addf %69, %60 : tensor<64x8xf32, #blocked> %71 = arith.addf %70, %64 : tensor<64x8xf32, #blocked> %72 = arith.subf %71, %arg9 : tensor<64x8xf32, #blocked> %73 = arith.addf %arg12, %cst_4 : tensor<64x8xf32, #blocked> %74 = arith.addf %arg11, %cst_10 : tensor<64x8xf32, #blocked2> %75 = arith.divf %72, %73 : tensor<64x8xf32, #blocked> %76 = arith.addf %arg9, %75 : tensor<64x8xf32, #blocked> %77 = arith.subf %71, %76 : tensor<64x8xf32, #blocked> %78 = arith.mulf %72, %77 : tensor<64x8xf32, #blocked> %79 = arith.addf %arg10, %78 : tensor<64x8xf32, #blocked> %80 = arith.select %58, %76, %arg9 : tensor<64x8xi1, #blocked>, tensor<64x8xf32, #blocked> %81 = arith.select %58, %79, %arg10 : tensor<64x8xi1, #blocked>, tensor<64x8xf32, #blocked> %82 = arith.select %58, %73, %arg12 : tensor<64x8xi1, #blocked>, tensor<64x8xf32, #blocked> %83 = arith.select %59, %74, %arg11 : tensor<64x8xi1, #blocked2>, tensor<64x8xf32, #blocked2> scf.yield %80, %81, %83, %82 : tensor<64x8xf32, #blocked>, tensor<64x8xf32, #blocked>, tensor<64x8xf32, #blocked2>, tensor<64x8xf32, #blocked> } %40 = triton_gpu.convert_layout %39#2 : (tensor<64x8xf32, #blocked2>) -> tensor<64x8xf32, #blocked> %41:3 = "tt.reduce"(%39#0, %39#1, %40) <{axis = 1 : i32}> ({ ^bb0(%arg8: f32, %arg9: f32, %arg10: f32, %arg11: f32, %arg12: f32, %arg13: f32): %49 = arith.subf %arg11, %arg8 : f32 %50 = arith.addf %arg10, %arg13 : f32 %51 = arith.cmpf oeq, %50, %cst_11 : f32 %52 = arith.divf %arg13, %50 : f32 %53 = arith.select %51, %cst_11, %52 : f32 %54 = arith.mulf %49, %53 : f32 %55 = arith.addf %arg8, %54 : f32 %56 = arith.addf %arg9, %arg12 : f32 %57 = arith.mulf %49, %49 : f32 %58 = arith.mulf %57, %arg10 : f32 %59 = arith.mulf %58, %53 : f32 %60 = arith.addf %56, %59 : f32 tt.reduce.return %55, %60, %50 : f32, f32, f32 }) : (tensor<64x8xf32, #blocked>, tensor<64x8xf32, #blocked>, tensor<64x8xf32, #blocked>) -> (tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>, tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>, tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) %42 = tt.expand_dims %41#0 {axis = 1 : i32} : (tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<64x1xf32, #blocked> %43 = tt.expand_dims %41#1 {axis = 1 : i32} : (tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<64x1xf32, #blocked> %44 = tt.splat %arg4 : (!tt.ptr) -> tensor<1x8x!tt.ptr, #blocked> %45 = tt.broadcast %42 : (tensor<64x1xf32, #blocked>) -> tensor<64x8xf32, #blocked> %46 = arith.divf %43, %cst_15 : tensor<64x1xf32, #blocked> %47 = arith.addf %46, %cst_14 : tensor<64x1xf32, #blocked> %48 = tt.splat %arg5 : (!tt.ptr) -> tensor<64x8x!tt.ptr, #blocked> scf.for %arg8 = %c0_i32 to %c256_i32 step %c8_i32 : i32 { %49 = tt.splat %arg8 : (i32) -> tensor<1x8xi32, #blocked> %50 = arith.addi %49, %12 : tensor<1x8xi32, #blocked> %51 = arith.cmpi slt, %50, %cst_0 : tensor<1x8xi32, #blocked> %52 = tt.broadcast %50 : (tensor<1x8xi32, #blocked>) -> tensor<64x8xi32, #blocked> %53 = arith.addi %52, %22 : tensor<64x8xi32, #blocked> %54 = tt.addptr %23, %53 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi32, #blocked> %55 = tt.broadcast %51 : (tensor<1x8xi1, #blocked>) -> tensor<64x8xi1, #blocked> %56 = tt.load %54, %55, %cst_2 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x8xf32, #blocked> %57 = arith.addi %52, %25 : tensor<64x8xi32, #blocked> %58 = tt.addptr %26, %57 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi32, #blocked> %59 = tt.load %58, %55, %cst_16 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x8xbf16, #blocked> %60 = arith.extf %59 : tensor<64x8xbf16, #blocked> to tensor<64x8xf32, #blocked> %61 = tt.addptr %44, %50 : tensor<1x8x!tt.ptr, #blocked>, tensor<1x8xi32, #blocked> %62 = tt.load %61, %51, %cst_3 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x8xf32, #blocked> tt.assert %35, "index out of bounds: 0 <= tmp16 < 50257", "", "_call_with_frames_removed", 883 : tensor<64x1xi1, #blocked1> %63 = arith.extsi %50 : tensor<1x8xi32, #blocked> to tensor<1x8xi64, #blocked> %64 = tt.broadcast %63 : (tensor<1x8xi64, #blocked>) -> tensor<64x8xi64, #blocked> %65 = arith.addi %64, %37 : tensor<64x8xi64, #blocked> %66 = tt.addptr %38, %65 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi64, #blocked> %67 = tt.load %66, %55, %cst_2 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x8xf32, #blocked> %68 = arith.addf %67, %56 : tensor<64x8xf32, #blocked> %69 = arith.addf %68, %60 : tensor<64x8xf32, #blocked> %70 = arith.subf %69, %45 : tensor<64x8xf32, #blocked> %71 = tt.extern_elementwise %47 {libname = "libdevice", libpath = "/usr/local/lib/python3.10/dist-packages/triton/language/../third_party/cuda/lib/libdevice.10.bc", pure = true, symbol = "__nv_rsqrtf"} : (tensor<64x1xf32, #blocked>) -> tensor<64x1xf32, #blocked> %72 = tt.broadcast %71 : (tensor<64x1xf32, #blocked>) -> tensor<64x8xf32, #blocked> %73 = arith.mulf %70, %72 : tensor<64x8xf32, #blocked> %74 = tt.broadcast %62 : (tensor<1x8xf32, #blocked>) -> tensor<64x8xf32, #blocked> %75 = arith.mulf %73, %74 : tensor<64x8xf32, #blocked> %76 = tt.addptr %48, %57 : tensor<64x8x!tt.ptr, #blocked>, tensor<64x8xi32, #blocked> %77 = arith.truncf %75 : tensor<64x8xf32, #blocked> to tensor<64x8xbf16, #blocked> tt.store %76, %77, %55 {cache = 1 : i32, evict = 1 : i32} : tensor<64x8xbf16, #blocked> } tt.return } }