#blocked = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [8, 4], warpsPerCTA = [8, 1], order = [1, 0], CTAsPerCGA = [1, 1], CTASplitNum = [1, 1], CTAOrder = [1, 0]}> #blocked1 = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [32, 1], warpsPerCTA = [8, 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" = 8 : 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<64x1xi32, #blocked> %cst_1 = arith.constant dense<256> : tensor<64x1xi64, #blocked> %cst_2 = arith.constant dense<0> : tensor<64x1xi64, #blocked> %cst_3 = arith.constant dense<50257> : tensor<64x1xi64, #blocked> %cst_4 = arith.constant dense<50257> : tensor<64x1xi64, #blocked1> %cst_5 = arith.constant dense<0> : tensor<64x1xi64, #blocked1> %c0_i32 = arith.constant 0 : i32 %c4_i32 = arith.constant 4 : i32 %c256_i32 = arith.constant 256 : i32 %cst_6 = arith.constant dense<1.000000e+00> : tensor<64x4xf32, #blocked> %cst_7 = arith.constant 0.000000e+00 : f32 %cst_8 = arith.constant dense<0.000000e+00> : tensor<64x4xbf16, #blocked> %cst_9 = arith.constant dense<0.000000e+00> : tensor<1x4xf32, #blocked> %cst_10 = arith.constant dense<0.000000e+00> : tensor<64x4xf32, #blocked> %cst_11 = arith.constant dense<256> : tensor<1x4xi32, #blocked> %cst_12 = arith.constant dense<9.99999974E-6> : tensor<64x1xf32, #blocked> %cst_13 = arith.constant dense<2.560000e+02> : tensor<64x1xf32, #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 = 4 : i32, start = 0 : i32} : tensor<4xi32, #triton_gpu.slice<{dim = 0, parent = #blocked}>> %11 = tt.expand_dims %10 {axis = 0 : i32} : (tensor<4xi32, #triton_gpu.slice<{dim = 0, parent = #blocked}>>) -> tensor<1x4xi32, #blocked> %12 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x1x!tt.ptr, #blocked> %13 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x1x!tt.ptr, #blocked1> %14 = tt.addptr %12, %8 : tensor<64x1x!tt.ptr, #blocked>, tensor<64x1xi32, #blocked> %15 = tt.addptr %13, %9 : tensor<64x1x!tt.ptr, #blocked1>, tensor<64x1xi32, #blocked1> %16 = tt.load %14 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x1xi64, #blocked> %17 = tt.load %15 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x1xi64, #blocked1> %18 = arith.remsi %8, %cst : tensor<64x1xi32, #blocked> %19 = arith.muli %18, %cst_0 : tensor<64x1xi32, #blocked> %20 = tt.broadcast %19 : (tensor<64x1xi32, #blocked>) -> tensor<64x4xi32, #blocked> %21 = tt.splat %arg2 : (!tt.ptr) -> tensor<64x4x!tt.ptr, #blocked> %22 = arith.muli %8, %cst_0 : tensor<64x1xi32, #blocked> %23 = tt.broadcast %22 : (tensor<64x1xi32, #blocked>) -> tensor<64x4xi32, #blocked> %24 = tt.splat %arg3 : (!tt.ptr) -> tensor<64x4x!tt.ptr, #blocked> %25 = arith.addi %16, %cst_3 : tensor<64x1xi64, #blocked> %26 = arith.addi %17, %cst_4 : tensor<64x1xi64, #blocked1> %27 = arith.cmpi slt, %16, %cst_2 : tensor<64x1xi64, #blocked> %28 = arith.cmpi slt, %17, %cst_5 : tensor<64x1xi64, #blocked1> %29 = arith.select %27, %25, %16 : tensor<64x1xi1, #blocked>, tensor<64x1xi64, #blocked> %30 = arith.select %28, %26, %17 : tensor<64x1xi1, #blocked1>, tensor<64x1xi64, #blocked1> %31 = arith.cmpi sge, %30, %cst_5 : tensor<64x1xi64, #blocked1> %32 = arith.cmpi slt, %30, %cst_4 : tensor<64x1xi64, #blocked1> %33 = arith.andi %31, %32 : tensor<64x1xi1, #blocked1> %34 = arith.muli %29, %cst_1 : tensor<64x1xi64, #blocked> %35 = tt.broadcast %34 : (tensor<64x1xi64, #blocked>) -> tensor<64x4xi64, #blocked> %36 = tt.splat %arg1 : (!tt.ptr) -> tensor<64x4x!tt.ptr, #blocked> %37:3 = scf.for %arg8 = %c0_i32 to %c256_i32 step %c4_i32 iter_args(%arg9 = %cst_10, %arg10 = %cst_10, %arg11 = %cst_10) -> (tensor<64x4xf32, #blocked>, tensor<64x4xf32, #blocked>, tensor<64x4xf32, #blocked>) : i32 { %46 = tt.splat %arg8 : (i32) -> tensor<1x4xi32, #blocked> %47 = arith.addi %46, %11 : tensor<1x4xi32, #blocked> %48 = arith.cmpi slt, %47, %cst_11 : tensor<1x4xi32, #blocked> %49 = tt.broadcast %47 : (tensor<1x4xi32, #blocked>) -> tensor<64x4xi32, #blocked> %50 = arith.addi %49, %20 : tensor<64x4xi32, #blocked> %51 = tt.addptr %21, %50 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi32, #blocked> %52 = tt.broadcast %48 : (tensor<1x4xi1, #blocked>) -> tensor<64x4xi1, #blocked> %53 = tt.load %51, %52, %cst_10 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x4xf32, #blocked> %54 = arith.addi %49, %23 : tensor<64x4xi32, #blocked> %55 = tt.addptr %24, %54 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi32, #blocked> %56 = tt.load %55, %52, %cst_8 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x4xbf16, #blocked> %57 = arith.extf %56 : tensor<64x4xbf16, #blocked> to tensor<64x4xf32, #blocked> tt.assert %33, "index out of bounds: 0 <= tmp3 < 50257", "", "_call_with_frames_removed", 883 : tensor<64x1xi1, #blocked1> %58 = arith.extsi %47 : tensor<1x4xi32, #blocked> to tensor<1x4xi64, #blocked> %59 = tt.broadcast %58 : (tensor<1x4xi64, #blocked>) -> tensor<64x4xi64, #blocked> %60 = arith.addi %59, %35 : tensor<64x4xi64, #blocked> %61 = tt.addptr %36, %60 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi64, #blocked> %62 = tt.load %61, %52, %cst_10 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x4xf32, #blocked> %63 = arith.addf %62, %53 : tensor<64x4xf32, #blocked> %64 = arith.addf %63, %57 : tensor<64x4xf32, #blocked> %65 = arith.subf %64, %arg9 : tensor<64x4xf32, #blocked> %66 = arith.addf %arg11, %cst_6 : tensor<64x4xf32, #blocked> %67 = arith.divf %65, %66 : tensor<64x4xf32, #blocked> %68 = arith.addf %arg9, %67 : tensor<64x4xf32, #blocked> %69 = arith.subf %64, %68 : tensor<64x4xf32, #blocked> %70 = arith.mulf %65, %69 : tensor<64x4xf32, #blocked> %71 = arith.addf %arg10, %70 : tensor<64x4xf32, #blocked> %72 = arith.select %52, %68, %arg9 : tensor<64x4xi1, #blocked>, tensor<64x4xf32, #blocked> %73 = arith.select %52, %71, %arg10 : tensor<64x4xi1, #blocked>, tensor<64x4xf32, #blocked> %74 = arith.select %52, %66, %arg11 : tensor<64x4xi1, #blocked>, tensor<64x4xf32, #blocked> scf.yield %72, %73, %74 : tensor<64x4xf32, #blocked>, tensor<64x4xf32, #blocked>, tensor<64x4xf32, #blocked> } %38:3 = "tt.reduce"(%37#0, %37#1, %37#2) <{axis = 1 : i32}> ({ ^bb0(%arg8: f32, %arg9: f32, %arg10: f32, %arg11: f32, %arg12: f32, %arg13: f32): %46 = arith.subf %arg11, %arg8 : f32 %47 = arith.addf %arg10, %arg13 : f32 %48 = arith.cmpf oeq, %47, %cst_7 : f32 %49 = arith.divf %arg13, %47 : f32 %50 = arith.select %48, %cst_7, %49 : f32 %51 = arith.mulf %46, %50 : f32 %52 = arith.addf %arg8, %51 : f32 %53 = arith.addf %arg9, %arg12 : f32 %54 = arith.mulf %46, %46 : f32 %55 = arith.mulf %54, %arg10 : f32 %56 = arith.mulf %55, %50 : f32 %57 = arith.addf %53, %56 : f32 tt.reduce.return %52, %57, %47 : f32, f32, f32 }) : (tensor<64x4xf32, #blocked>, tensor<64x4xf32, #blocked>, tensor<64x4xf32, #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}>>) %39 = tt.expand_dims %38#0 {axis = 1 : i32} : (tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<64x1xf32, #blocked> %40 = tt.expand_dims %38#1 {axis = 1 : i32} : (tensor<64xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<64x1xf32, #blocked> %41 = tt.splat %arg4 : (!tt.ptr) -> tensor<1x4x!tt.ptr, #blocked> %42 = tt.broadcast %39 : (tensor<64x1xf32, #blocked>) -> tensor<64x4xf32, #blocked> %43 = arith.divf %40, %cst_13 : tensor<64x1xf32, #blocked> %44 = arith.addf %43, %cst_12 : tensor<64x1xf32, #blocked> %45 = tt.splat %arg5 : (!tt.ptr) -> tensor<64x4x!tt.ptr, #blocked> scf.for %arg8 = %c0_i32 to %c256_i32 step %c4_i32 : i32 { %46 = tt.splat %arg8 : (i32) -> tensor<1x4xi32, #blocked> %47 = arith.addi %46, %11 : tensor<1x4xi32, #blocked> %48 = arith.cmpi slt, %47, %cst_11 : tensor<1x4xi32, #blocked> %49 = tt.broadcast %47 : (tensor<1x4xi32, #blocked>) -> tensor<64x4xi32, #blocked> %50 = arith.addi %49, %20 : tensor<64x4xi32, #blocked> %51 = tt.addptr %21, %50 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi32, #blocked> %52 = tt.broadcast %48 : (tensor<1x4xi1, #blocked>) -> tensor<64x4xi1, #blocked> %53 = tt.load %51, %52, %cst_10 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x4xf32, #blocked> %54 = arith.addi %49, %23 : tensor<64x4xi32, #blocked> %55 = tt.addptr %24, %54 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi32, #blocked> %56 = tt.load %55, %52, %cst_8 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x4xbf16, #blocked> %57 = arith.extf %56 : tensor<64x4xbf16, #blocked> to tensor<64x4xf32, #blocked> %58 = tt.addptr %41, %47 : tensor<1x4x!tt.ptr, #blocked>, tensor<1x4xi32, #blocked> %59 = tt.load %58, %48, %cst_9 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x4xf32, #blocked> tt.assert %33, "index out of bounds: 0 <= tmp16 < 50257", "", "_call_with_frames_removed", 883 : tensor<64x1xi1, #blocked1> %60 = arith.extsi %47 : tensor<1x4xi32, #blocked> to tensor<1x4xi64, #blocked> %61 = tt.broadcast %60 : (tensor<1x4xi64, #blocked>) -> tensor<64x4xi64, #blocked> %62 = arith.addi %61, %35 : tensor<64x4xi64, #blocked> %63 = tt.addptr %36, %62 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi64, #blocked> %64 = tt.load %63, %52, %cst_10 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x4xf32, #blocked> %65 = arith.addf %64, %53 : tensor<64x4xf32, #blocked> %66 = arith.addf %65, %57 : tensor<64x4xf32, #blocked> %67 = arith.subf %66, %42 : tensor<64x4xf32, #blocked> %68 = tt.extern_elementwise %44 {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> %69 = tt.broadcast %68 : (tensor<64x1xf32, #blocked>) -> tensor<64x4xf32, #blocked> %70 = arith.mulf %67, %69 : tensor<64x4xf32, #blocked> %71 = tt.broadcast %59 : (tensor<1x4xf32, #blocked>) -> tensor<64x4xf32, #blocked> %72 = arith.mulf %70, %71 : tensor<64x4xf32, #blocked> %73 = tt.addptr %45, %54 : tensor<64x4x!tt.ptr, #blocked>, tensor<64x4xi32, #blocked> %74 = arith.truncf %72 : tensor<64x4xf32, #blocked> to tensor<64x4xbf16, #blocked> tt.store %73, %74, %52 {cache = 1 : i32, evict = 1 : i32} : tensor<64x4xbf16, #blocked> } tt.return } }