module { tt.func public @triton__0d1d2d3d4d5d6d7de8(%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: !tt.ptr {tt.divisibility = 16 : i32}, %arg7: i64 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}, %arg8: i64) attributes {noinline = false} { %cst = arith.constant dense<0.000000e+00> : tensor<64x64xbf16> %cst_0 = arith.constant dense<0.000000e+00> : tensor<64x1xf32> %c50257_i32 = arith.constant 50257 : i32 %c64_i32 = arith.constant 64 : i32 %c0_i32 = arith.constant 0 : i32 %cst_1 = arith.constant dense<50257> : tensor<64x1xi64> %cst_2 = arith.constant dense<50257> : tensor<1x64xi64> %c64_i64 = arith.constant 64 : i64 %cst_3 = arith.constant dense<-1> : tensor<64x1xi64> %cst_4 = arith.constant dense<0.000000e+00> : tensor<64x64xf32> %0 = tt.get_program_id x : i32 %1 = arith.extsi %0 : i32 to i64 %2 = arith.muli %1, %c64_i64 : i64 %3 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32> %4 = tt.expand_dims %3 {axis = 1 : i32} : (tensor<64xi32>) -> tensor<64x1xi32> %5 = arith.extsi %4 : tensor<64x1xi32> to tensor<64x1xi64> %6 = tt.splat %2 : (i64) -> tensor<64x1xi64> %7 = arith.addi %6, %5 : tensor<64x1xi64> %8 = tt.expand_dims %3 {axis = 0 : i32} : (tensor<64xi32>) -> tensor<1x64xi32> %9 = arith.extsi %8 : tensor<1x64xi32> to tensor<1x64xi64> %10 = tt.splat %arg1 : (!tt.ptr) -> tensor<64x1x!tt.ptr> %11 = tt.addptr %10, %7 : tensor<64x1x!tt.ptr>, tensor<64x1xi64> %12 = tt.load %11 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x1xi64> %13 = tt.addptr %arg2, %c0_i32 : !tt.ptr, i32 %14 = tt.load %13 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : f32 %15 = tt.addptr %arg3, %c0_i32 : !tt.ptr, i32 %16 = tt.load %15 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : f32 %17 = arith.muli %7, %cst_1 : tensor<64x1xi64> %18 = tt.broadcast %17 : (tensor<64x1xi64>) -> tensor<64x64xi64> %19 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x64x!tt.ptr> %20 = arith.cmpi ne, %12, %cst_3 : tensor<64x1xi64> %21 = arith.divf %14, %16 : f32 %22 = tt.splat %21 : (f32) -> tensor<64x1xf32> %23 = arith.select %20, %22, %cst_0 : tensor<64x1xi1>, tensor<64x1xf32> %24 = tt.broadcast %23 : (tensor<64x1xf32>) -> tensor<64x64xf32> %25 = scf.for %arg9 = %c0_i32 to %c50257_i32 step %c64_i32 iter_args(%arg10 = %cst_4) -> (tensor<64x64xf32>) : i32 { %40 = arith.extsi %arg9 : i32 to i64 %41 = tt.splat %40 : (i64) -> tensor<1x64xi64> %42 = arith.addi %41, %9 : tensor<1x64xi64> %43 = arith.cmpi slt, %42, %cst_2 : tensor<1x64xi64> %44 = tt.broadcast %42 : (tensor<1x64xi64>) -> tensor<64x64xi64> %45 = arith.addi %44, %18 : tensor<64x64xi64> %46 = tt.addptr %19, %45 : tensor<64x64x!tt.ptr>, tensor<64x64xi64> %47 = tt.broadcast %43 : (tensor<1x64xi1>) -> tensor<64x64xi1> %48 = tt.load %46, %47, %cst_4 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<64x64xf32> %49 = arith.mulf %48, %24 : tensor<64x64xf32> %50 = arith.addf %arg10, %49 : tensor<64x64xf32> %51 = arith.select %47, %50, %arg10 : tensor<64x64xi1>, tensor<64x64xf32> scf.yield %51 : tensor<64x64xf32> } %26 = "tt.reduce"(%25) <{axis = 1 : i32}> ({ ^bb0(%arg9: f32, %arg10: f32): %40 = arith.addf %arg9, %arg10 : f32 tt.reduce.return %40 : f32 }) : (tensor<64x64xf32>) -> tensor<64xf32> %27 = tt.expand_dims %26 {axis = 1 : i32} : (tensor<64xf32>) -> tensor<64x1xf32> %28 = arith.muli %7, %cst_1 : tensor<64x1xi64> %29 = tt.broadcast %28 : (tensor<64x1xi64>) -> tensor<64x64xi64> %30 = tt.splat %arg4 : (!tt.ptr) -> tensor<64x64x!tt.ptr> %31 = tt.splat %arg0 : (!tt.ptr) -> tensor<64x64x!tt.ptr> %32 = tt.splat %arg5 : (!tt.ptr) -> tensor<64x64x!tt.ptr> %33 = arith.cmpi ne, %12, %cst_3 : tensor<64x1xi64> %34 = arith.divf %14, %16 : f32 %35 = tt.splat %34 : (f32) -> tensor<64x1xf32> %36 = arith.select %33, %35, %cst_0 : tensor<64x1xi1>, tensor<64x1xf32> %37 = tt.broadcast %36 : (tensor<64x1xf32>) -> tensor<64x64xf32> %38 = tt.broadcast %27 : (tensor<64x1xf32>) -> tensor<64x64xf32> %39 = tt.splat %arg6 : (!tt.ptr) -> tensor<64x64x!tt.ptr> scf.for %arg9 = %c0_i32 to %c50257_i32 step %c64_i32 : i32 { %40 = arith.extsi %arg9 : i32 to i64 %41 = tt.splat %40 : (i64) -> tensor<1x64xi64> %42 = arith.addi %41, %9 : tensor<1x64xi64> %43 = arith.cmpi slt, %42, %cst_2 : tensor<1x64xi64> %44 = tt.broadcast %42 : (tensor<1x64xi64>) -> tensor<64x64xi64> %45 = arith.addi %44, %29 : tensor<64x64xi64> %46 = tt.addptr %30, %45 : tensor<64x64x!tt.ptr>, tensor<64x64xi64> %47 = tt.broadcast %43 : (tensor<1x64xi1>) -> tensor<64x64xi1> %48 = tt.load %46, %47, %cst {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x64xbf16> %49 = arith.extf %48 : tensor<64x64xbf16> to tensor<64x64xf32> %50 = tt.addptr %31, %45 : tensor<64x64x!tt.ptr>, tensor<64x64xi64> %51 = tt.load %50, %47, %cst_4 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x64xf32> %52 = tt.addptr %32, %45 : tensor<64x64x!tt.ptr>, tensor<64x64xi64> %53 = tt.load %52, %47, %cst {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<64x64xbf16> %54 = arith.extf %53 : tensor<64x64xbf16> to tensor<64x64xf32> %55 = arith.mulf %51, %37 : tensor<64x64xf32> %56 = math.exp %54 : tensor<64x64xf32> %57 = arith.mulf %56, %38 : tensor<64x64xf32> %58 = arith.subf %55, %57 : tensor<64x64xf32> %59 = arith.addf %49, %58 : tensor<64x64xf32> %60 = tt.addptr %39, %45 : tensor<64x64x!tt.ptr>, tensor<64x64xi64> %61 = arith.truncf %59 : tensor<64x64xf32> to tensor<64x64xbf16> tt.store %60, %61, %47 {cache = 1 : i32, evict = 1 : i32} : tensor<64x64xbf16> } tt.return } }