0-hero's picture
Add files using upload-large-folder tool
afafe68 verified
#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]}>
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__0d1d2d3d4d5d6d7de8(%arg0: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<i64, 1> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg4: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg5: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg6: !tt.ptr<bf16, 1> {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<1x1xf32, #blocked>
%cst_0 = arith.constant dense<-1> : tensor<1x1xi64, #blocked>
%cst_1 = arith.constant dense<0.000000e+00> : tensor<1x2048xf32, #blocked>
%cst_2 = arith.constant dense<50257> : tensor<1x2048xi64, #blocked>
%c0_i32 = arith.constant 0 : i32
%c2048_i32 = arith.constant 2048 : i32
%c50257_i32 = arith.constant 50257 : i32
%c50257_i64 = arith.constant 50257 : i64
%cst_3 = arith.constant dense<0.000000e+00> : tensor<1x2048xbf16, #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 = tt.addptr %arg1, %1 : !tt.ptr<i64, 1>, i64
%6 = tt.splat %5 : (!tt.ptr<i64, 1>) -> tensor<1x1x!tt.ptr<i64, 1>, #blocked>
%7 = tt.load %6 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x1xi64, #blocked>
%8 = tt.addptr %arg2, %c0_i32 : !tt.ptr<f32, 1>, i32
%9 = tt.load %8 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : f32
%10 = tt.addptr %arg3, %c0_i32 : !tt.ptr<f32, 1>, i32
%11 = tt.load %10 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : f32
%12 = arith.muli %1, %c50257_i64 : i64
%13 = tt.splat %12 : (i64) -> tensor<1x2048xi64, #blocked>
%14 = tt.splat %arg0 : (!tt.ptr<f32, 1>) -> tensor<1x2048x!tt.ptr<f32, 1>, #blocked>
%15 = arith.cmpi ne, %7, %cst_0 : tensor<1x1xi64, #blocked>
%16 = arith.divf %9, %11 : f32
%17 = tt.splat %16 : (f32) -> tensor<1x1xf32, #blocked>
%18 = arith.select %15, %17, %cst : tensor<1x1xi1, #blocked>, tensor<1x1xf32, #blocked>
%19 = tt.broadcast %18 : (tensor<1x1xf32, #blocked>) -> tensor<1x2048xf32, #blocked>
%20 = scf.for %arg9 = %c0_i32 to %c50257_i32 step %c2048_i32 iter_args(%arg10 = %cst_1) -> (tensor<1x2048xf32, #blocked>) : i32 {
%27 = arith.extsi %arg9 : i32 to i64
%28 = tt.splat %27 : (i64) -> tensor<1x2048xi64, #blocked>
%29 = arith.addi %28, %4 : tensor<1x2048xi64, #blocked>
%30 = arith.cmpi slt, %29, %cst_2 : tensor<1x2048xi64, #blocked>
%31 = arith.addi %29, %13 : tensor<1x2048xi64, #blocked>
%32 = tt.addptr %14, %31 : tensor<1x2048x!tt.ptr<f32, 1>, #blocked>, tensor<1x2048xi64, #blocked>
%33 = tt.load %32, %30, %cst_1 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1x2048xf32, #blocked>
%34 = arith.mulf %33, %19 : tensor<1x2048xf32, #blocked>
%35 = arith.addf %arg10, %34 : tensor<1x2048xf32, #blocked>
%36 = arith.select %30, %35, %arg10 : tensor<1x2048xi1, #blocked>, tensor<1x2048xf32, #blocked>
scf.yield %36 : tensor<1x2048xf32, #blocked>
}
%21 = "tt.reduce"(%20) <{axis = 1 : i32}> ({
^bb0(%arg9: f32, %arg10: f32):
%27 = arith.addf %arg9, %arg10 : f32
tt.reduce.return %27 : f32
}) : (tensor<1x2048xf32, #blocked>) -> tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>
%22 = tt.expand_dims %21 {axis = 1 : i32} : (tensor<1xf32, #triton_gpu.slice<{dim = 1, parent = #blocked}>>) -> tensor<1x1xf32, #blocked>
%23 = tt.splat %arg4 : (!tt.ptr<bf16, 1>) -> tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>
%24 = tt.splat %arg5 : (!tt.ptr<bf16, 1>) -> tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>
%25 = tt.broadcast %22 : (tensor<1x1xf32, #blocked>) -> tensor<1x2048xf32, #blocked>
%26 = tt.splat %arg6 : (!tt.ptr<bf16, 1>) -> tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>
scf.for %arg9 = %c0_i32 to %c50257_i32 step %c2048_i32 : i32 {
%27 = arith.extsi %arg9 : i32 to i64
%28 = tt.splat %27 : (i64) -> tensor<1x2048xi64, #blocked>
%29 = arith.addi %28, %4 : tensor<1x2048xi64, #blocked>
%30 = arith.cmpi slt, %29, %cst_2 : tensor<1x2048xi64, #blocked>
%31 = arith.addi %29, %13 : tensor<1x2048xi64, #blocked>
%32 = tt.addptr %23, %31 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked>
%33 = tt.load %32, %30, %cst_3 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<1x2048xbf16, #blocked>
%34 = arith.extf %33 : tensor<1x2048xbf16, #blocked> to tensor<1x2048xf32, #blocked>
%35 = tt.addptr %14, %31 : tensor<1x2048x!tt.ptr<f32, 1>, #blocked>, tensor<1x2048xi64, #blocked>
%36 = tt.load %35, %30, %cst_1 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<1x2048xf32, #blocked>
%37 = tt.addptr %24, %31 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked>
%38 = tt.load %37, %30, %cst_3 {cache = 1 : i32, evict = 2 : i32, isVolatile = false} : tensor<1x2048xbf16, #blocked>
%39 = arith.extf %38 : tensor<1x2048xbf16, #blocked> to tensor<1x2048xf32, #blocked>
%40 = arith.mulf %36, %19 : tensor<1x2048xf32, #blocked>
%41 = math.exp %39 : tensor<1x2048xf32, #blocked>
%42 = arith.mulf %41, %25 : tensor<1x2048xf32, #blocked>
%43 = arith.subf %40, %42 : tensor<1x2048xf32, #blocked>
%44 = arith.addf %34, %43 : tensor<1x2048xf32, #blocked>
%45 = tt.addptr %26, %31 : tensor<1x2048x!tt.ptr<bf16, 1>, #blocked>, tensor<1x2048xi64, #blocked>
%46 = arith.truncf %44 : tensor<1x2048xf32, #blocked> to tensor<1x2048xbf16, #blocked>
tt.store %45, %46, %30 {cache = 1 : i32, evict = 1 : i32} : tensor<1x2048xbf16, #blocked>
}
tt.return
}
}