module { 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} { %c512_i32 = arith.constant 512 : i32 %c256_i32 = arith.constant 256 : i32 %cst = arith.constant dense<0.000000e+00> : tensor<1x256xbf16> %cst_0 = arith.constant dense<1.000000e+00> : tensor<1x256xf32> %cst_1 = arith.constant 0.000000e+00 : f32 %cst_2 = arith.constant dense<256> : tensor<1x1xi64> %cst_3 = arith.constant dense<50257> : tensor<1x1xi64> %cst_4 = arith.constant dense<0> : tensor<1x1xi64> %cst_5 = arith.constant dense<9.99999974E-6> : tensor<1x1xf32> %cst_6 = arith.constant dense<2.560000e+02> : tensor<1x1xf32> %cst_7 = arith.constant dense<0.000000e+00> : tensor<1x256xf32> %cst_8 = arith.constant dense<256> : tensor<1x256xi32> %0 = tt.get_program_id x : i32 %1 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32> %2 = tt.expand_dims %1 {axis = 0 : i32} : (tensor<256xi32>) -> tensor<1x256xi32> %3 = tt.addptr %arg0, %0 : !tt.ptr, i32 %4 = tt.splat %3 : (!tt.ptr) -> tensor<1x1x!tt.ptr> %5 = tt.load %4 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x1xi64> %6 = arith.remsi %0, %c512_i32 : i32 %7 = arith.cmpi slt, %2, %cst_8 : tensor<1x256xi32> %8 = arith.muli %6, %c256_i32 : i32 %9 = tt.splat %8 : (i32) -> tensor<1x256xi32> %10 = arith.addi %2, %9 : tensor<1x256xi32> %11 = tt.splat %arg2 : (!tt.ptr) -> tensor<1x256x!tt.ptr> %12 = tt.addptr %11, %10 : tensor<1x256x!tt.ptr>, tensor<1x256xi32> %13 = tt.load %12, %7, %cst_7 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x256xf32> %14 = arith.muli %0, %c256_i32 : i32 %15 = tt.splat %14 : (i32) -> tensor<1x256xi32> %16 = arith.addi %2, %15 : tensor<1x256xi32> %17 = tt.splat %arg3 : (!tt.ptr) -> tensor<1x256x!tt.ptr> %18 = tt.addptr %17, %16 : tensor<1x256x!tt.ptr>, tensor<1x256xi32> %19 = tt.load %18, %7, %cst {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x256xbf16> %20 = arith.extf %19 : tensor<1x256xbf16> to tensor<1x256xf32> %21 = arith.addi %5, %cst_3 : tensor<1x1xi64> %22 = arith.cmpi slt, %5, %cst_4 : tensor<1x1xi64> %23 = arith.select %22, %21, %5 : tensor<1x1xi1>, tensor<1x1xi64> %24 = arith.cmpi sge, %23, %cst_4 : tensor<1x1xi64> %25 = arith.cmpi slt, %23, %cst_3 : tensor<1x1xi64> %26 = arith.andi %24, %25 : tensor<1x1xi1> tt.assert %26, "index out of bounds: 0 <= tmp3 < 50257", "", "_call_with_frames_removed", 883 : tensor<1x1xi1> %27 = arith.muli %23, %cst_2 : tensor<1x1xi64> %28 = tt.broadcast %27 : (tensor<1x1xi64>) -> tensor<1x256xi64> %29 = arith.extsi %2 : tensor<1x256xi32> to tensor<1x256xi64> %30 = arith.addi %29, %28 : tensor<1x256xi64> %31 = tt.splat %arg1 : (!tt.ptr) -> tensor<1x256x!tt.ptr> %32 = tt.addptr %31, %30 : tensor<1x256x!tt.ptr>, tensor<1x256xi64> %33 = tt.load %32, %7, %cst_7 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x256xf32> %34 = arith.addf %33, %13 : tensor<1x256xf32> %35 = arith.addf %34, %20 : tensor<1x256xf32> %36 = arith.addf %35, %cst_7 : tensor<1x256xf32> %37 = arith.subf %35, %36 : tensor<1x256xf32> %38 = arith.mulf %35, %37 : tensor<1x256xf32> %39 = arith.addf %38, %cst_7 : tensor<1x256xf32> %40 = arith.select %7, %36, %cst_7 : tensor<1x256xi1>, tensor<1x256xf32> %41 = arith.select %7, %39, %cst_7 : tensor<1x256xi1>, tensor<1x256xf32> %42 = arith.select %7, %cst_0, %cst_7 : tensor<1x256xi1>, tensor<1x256xf32> %43:3 = "tt.reduce"(%40, %41, %42) <{axis = 1 : i32}> ({ ^bb0(%arg8: f32, %arg9: f32, %arg10: f32, %arg11: f32, %arg12: f32, %arg13: f32): %66 = arith.subf %arg11, %arg8 : f32 %67 = arith.addf %arg10, %arg13 : f32 %68 = arith.cmpf oeq, %67, %cst_1 : f32 %69 = arith.divf %arg13, %67 : f32 %70 = arith.select %68, %cst_1, %69 : f32 %71 = arith.mulf %66, %70 : f32 %72 = arith.addf %arg8, %71 : f32 %73 = arith.addf %arg9, %arg12 : f32 %74 = arith.mulf %66, %66 : f32 %75 = arith.mulf %74, %arg10 : f32 %76 = arith.mulf %75, %70 : f32 %77 = arith.addf %73, %76 : f32 tt.reduce.return %72, %77, %67 : f32, f32, f32 }) : (tensor<1x256xf32>, tensor<1x256xf32>, tensor<1x256xf32>) -> (tensor<1xf32>, tensor<1xf32>, tensor<1xf32>) %44 = tt.expand_dims %43#0 {axis = 1 : i32} : (tensor<1xf32>) -> tensor<1x1xf32> %45 = tt.expand_dims %43#1 {axis = 1 : i32} : (tensor<1xf32>) -> tensor<1x1xf32> %46 = tt.load %12, %7, %cst_7 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x256xf32> %47 = tt.load %18, %7, %cst {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<1x256xbf16> %48 = arith.extf %47 : tensor<1x256xbf16> to tensor<1x256xf32> %49 = tt.splat %arg4 : (!tt.ptr) -> tensor<1x256x!tt.ptr> %50 = tt.addptr %49, %2 : tensor<1x256x!tt.ptr>, tensor<1x256xi32> %51 = tt.load %50, %7, %cst_7 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x256xf32> tt.assert %26, "index out of bounds: 0 <= tmp16 < 50257", "", "_call_with_frames_removed", 883 : tensor<1x1xi1> %52 = tt.load %32, %7, %cst_7 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<1x256xf32> %53 = arith.addf %52, %46 : tensor<1x256xf32> %54 = arith.addf %53, %48 : tensor<1x256xf32> %55 = tt.broadcast %44 : (tensor<1x1xf32>) -> tensor<1x256xf32> %56 = arith.subf %54, %55 : tensor<1x256xf32> %57 = arith.divf %45, %cst_6 : tensor<1x1xf32> %58 = arith.addf %57, %cst_5 : tensor<1x1xf32> %59 = tt.extern_elementwise %58 {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<1x1xf32>) -> tensor<1x1xf32> %60 = tt.broadcast %59 : (tensor<1x1xf32>) -> tensor<1x256xf32> %61 = arith.mulf %56, %60 : tensor<1x256xf32> %62 = arith.mulf %61, %51 : tensor<1x256xf32> %63 = tt.splat %arg5 : (!tt.ptr) -> tensor<1x256x!tt.ptr> %64 = tt.addptr %63, %16 : tensor<1x256x!tt.ptr>, tensor<1x256xi32> %65 = arith.truncf %62 : tensor<1x256xf32> to tensor<1x256xbf16> tt.store %64, %65, %7 {cache = 1 : i32, evict = 1 : i32} : tensor<1x256xbf16> tt.return } }