|
#blocked = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 32], warpsPerCTA = [1, 8], order = [1, 0], CTAsPerCGA = [1, 1], CTASplitNum = [1, 1], CTAOrder = [1, 0]}> |
|
#blocked1 = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [1, 32], warpsPerCTA = [1, 8], order = [0, 1], 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__0d1d2d3d4de5(%arg0: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg4: i64 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}, %arg5: i64) attributes {noinline = false} { |
|
%cst = arith.constant dense<0.000000e+00> : tensor<1x2048xbf16, #blocked> |
|
%c50257_i64 = arith.constant 50257 : i64 |
|
%cst_0 = arith.constant dense<true> : tensor<1x2048xi1, #blocked> |
|
%c50257_i32 = arith.constant 50257 : i32 |
|
%c2048_i32 = arith.constant 2048 : i32 |
|
%c0_i32 = arith.constant 0 : i32 |
|
%cst_1 = arith.constant dense<50257> : tensor<1x2048xi64, #blocked> |
|
%cst_2 = arith.constant dense<0.000000e+00> : tensor<1x2048xf32, #blocked> |
|
%cst_3 = arith.constant dense<0xFF800000> : tensor<1x2048xf32, #blocked> |
|
%0 = tt.get_program_id x : i32 |
|
%1 = arith.extsi %0 : i32 to i64 |
|
%2 = tt.make_range {end = 2048 : i32, start = 0 : i32} : tensor<2048xi32, #triton_gpu.slice<{dim = 0, parent = #blocked}>> |
|
%3 = tt.expand_dims %2 {axis = 0 : i32} : (tensor<2048xi32, #triton_gpu.slice<{dim = 0, parent = #blocked}>>) -> tensor<1x2048xi32, #blocked> |
|
%4 = arith.extsi %3 : tensor<1x2048xi32, #blocked> to tensor<1x2048xi64, #blocked> |
|
%5 = arith.muli %1, %c50257_i64 : i64 |
|
%6 = tt.splat %5 : (i64) -> tensor<1x2048xi64, #blocked> |
|
%7 = tt.splat %arg0 : (!tt.ptr<bf16, 1>) -> tensor<1x2048x!tt.ptr<bf16, 1>, #blocked> |
|
%8 = scf.for %arg6 = %c0_i32 to %c50257_i32 step %c2048_i32 iter_args(%arg7 = %cst_3) -> (tensor<1x2048xf32, #blocked>) : i32 { |
|
%26 = arith.extsi %arg6 : i32 to i64 |
|
%27 = tt.splat %26 : (i64) -> tensor<1x2048xi64, #blocked> |
|
%28 = arith.addi %27, %4 : tensor<1x2048xi64, #blocked> |
|
%29 = arith.cmpi slt, %28, %cst_1 : tensor<1x2048xi64, #blocked> |
|
%30 = arith.addi %28, %6 : tensor<1x2048xi64, #blocked> |
|
%31 = tt.addptr %7, %30 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked> |
|
%32 = tt.load %31, %29, %cst {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x2048xbf16, #blocked> |
|
%33 = arith.extf %32 : tensor<1x2048xbf16, #blocked> to tensor<1x2048xf32, #blocked> |
|
%34 = arith.cmpf ogt, %arg7, %33 : tensor<1x2048xf32, #blocked> |
|
%35 = arith.cmpf une, %arg7, %arg7 : tensor<1x2048xf32, #blocked> |
|
%36 = arith.ori %34, %35 : tensor<1x2048xi1, #blocked> |
|
%37 = arith.xori %36, %cst_0 : tensor<1x2048xi1, #blocked> |
|
%38 = arith.andi %29, %37 : tensor<1x2048xi1, #blocked> |
|
%39 = arith.select %38, %33, %arg7 : tensor<1x2048xi1, #blocked>, tensor<1x2048xf32, #blocked> |
|
scf.yield %39 : tensor<1x2048xf32, #blocked> |
|
} |
|
%9 = "tt.reduce"(%8) <{axis = 1 : i32}> ({ |
|
^bb0(%arg6: f32, %arg7: f32): |
|
%26 = arith.cmpf ogt, %arg6, %arg7 : f32 |
|
%27 = arith.cmpf une, %arg6, %arg6 : f32 |
|
%28 = arith.ori %26, %27 : i1 |
|
%29 = arith.select %28, %arg6, %arg7 : f32 |
|
tt.reduce.return %29 : f32 |
|
}) : (tensor<1x2048xf32, #blocked>) -> tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>> |
|
%10 = triton_gpu.convert_layout %9 : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>> |
|
%11 = tt.expand_dims %10 {axis = 1 : i32} : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>>) -> tensor<1x1xf32, #blocked1> |
|
%12 = tt.expand_dims %9 {axis = 1 : i32} : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<1x1xf32, #blocked> |
|
%13 = tt.addptr %arg1, %1 : !tt.ptr<f32, 1>, i64 |
|
%14 = tt.splat %13 : (!tt.ptr<f32, 1>) -> tensor<1x1x!tt.ptr<f32, 1>, #blocked1> |
|
tt.store %14, %11 {cache = 1 : i32, evict = 1 : i32} : tensor<1x1xf32, #blocked1> |
|
%15 = tt.broadcast %12 : (tensor<1x1xf32, #blocked>) -> tensor<1x2048xf32, #blocked> |
|
%16 = scf.for %arg6 = %c0_i32 to %c50257_i32 step %c2048_i32 iter_args(%arg7 = %cst_2) -> (tensor<1x2048xf32, #blocked>) : i32 { |
|
%26 = arith.extsi %arg6 : i32 to i64 |
|
%27 = tt.splat %26 : (i64) -> tensor<1x2048xi64, #blocked> |
|
%28 = arith.addi %27, %4 : tensor<1x2048xi64, #blocked> |
|
%29 = arith.cmpi slt, %28, %cst_1 : tensor<1x2048xi64, #blocked> |
|
%30 = arith.addi %28, %6 : tensor<1x2048xi64, #blocked> |
|
%31 = tt.addptr %7, %30 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked> |
|
%32 = tt.load %31, %29, %cst {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x2048xbf16, #blocked> |
|
%33 = arith.extf %32 : tensor<1x2048xbf16, #blocked> to tensor<1x2048xf32, #blocked> |
|
%34 = arith.subf %33, %15 : tensor<1x2048xf32, #blocked> |
|
%35 = math.exp %34 : tensor<1x2048xf32, #blocked> |
|
%36 = arith.addf %arg7, %35 : tensor<1x2048xf32, #blocked> |
|
%37 = arith.select %29, %36, %arg7 : tensor<1x2048xi1, #blocked>, tensor<1x2048xf32, #blocked> |
|
scf.yield %37 : tensor<1x2048xf32, #blocked> |
|
} |
|
%17 = "tt.reduce"(%16) <{axis = 1 : i32}> ({ |
|
^bb0(%arg6: f32, %arg7: f32): |
|
%26 = arith.addf %arg6, %arg7 : f32 |
|
tt.reduce.return %26 : f32 |
|
}) : (tensor<1x2048xf32, #blocked>) -> tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>> |
|
%18 = triton_gpu.convert_layout %17 : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>> |
|
%19 = tt.expand_dims %18 {axis = 1 : i32} : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>>) -> tensor<1x1xf32, #blocked1> |
|
%20 = tt.expand_dims %17 {axis = 1 : i32} : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<1x1xf32, #blocked> |
|
%21 = tt.addptr %arg2, %1 : !tt.ptr<f32, 1>, i64 |
|
%22 = tt.splat %21 : (!tt.ptr<f32, 1>) -> tensor<1x1x!tt.ptr<f32, 1>, #blocked1> |
|
tt.store %22, %19 {cache = 1 : i32, evict = 1 : i32} : tensor<1x1xf32, #blocked1> |
|
%23 = math.log %20 : tensor<1x1xf32, #blocked> |
|
%24 = tt.broadcast %23 : (tensor<1x1xf32, #blocked>) -> tensor<1x2048xf32, #blocked> |
|
%25 = tt.splat %arg3 : (!tt.ptr<bf16, 1>) -> tensor<1x2048x!tt.ptr<bf16, 1>, #blocked> |
|
scf.for %arg6 = %c0_i32 to %c50257_i32 step %c2048_i32 : i32 { |
|
%26 = arith.extsi %arg6 : i32 to i64 |
|
%27 = tt.splat %26 : (i64) -> tensor<1x2048xi64, #blocked> |
|
%28 = arith.addi %27, %4 : tensor<1x2048xi64, #blocked> |
|
%29 = arith.cmpi slt, %28, %cst_1 : tensor<1x2048xi64, #blocked> |
|
%30 = arith.addi %28, %6 : tensor<1x2048xi64, #blocked> |
|
%31 = tt.addptr %7, %30 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked> |
|
%32 = tt.load %31, %29, %cst {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<1x2048xbf16, #blocked> |
|
%33 = arith.extf %32 : tensor<1x2048xbf16, #blocked> to tensor<1x2048xf32, #blocked> |
|
%34 = arith.subf %33, %15 : tensor<1x2048xf32, #blocked> |
|
%35 = arith.subf %34, %24 : tensor<1x2048xf32, #blocked> |
|
%36 = tt.addptr %25, %30 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked> |
|
%37 = arith.truncf %35 : tensor<1x2048xf32, #blocked> to tensor<1x2048xbf16, #blocked> |
|
tt.store %36, %37, %29 {cache = 1 : i32, evict = 1 : i32} : tensor<1x2048xbf16, #blocked> |
|
} |
|
tt.return |
|
} |
|
} |
|
|