0-hero's picture
Add files using upload-large-folder tool
f9d5f95 verified
raw
history blame
4.77 kB
#blocked = #triton_gpu.blocked<{sizePerThread = [4], threadsPerWarp = [32], warpsPerCTA = [2], order = [0], CTAsPerCGA = [1], CTASplitNum = [1], CTAOrder = [0]}>
module attributes {"triton_gpu.compute-capability" = 89 : i32, "triton_gpu.num-ctas" = 1 : i32, "triton_gpu.num-warps" = 2 : i32, "triton_gpu.threads-per-warp" = 32 : i32} {
tt.func public @triton__0d1d2d3d4d5de6de(%arg0: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg4: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg5: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}, %arg6: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}) attributes {noinline = false} {
%cst = arith.constant dense<256> : tensor<256xi32, #blocked>
%cst_0 = arith.constant 9.99999974E-6 : f32
%cst_1 = arith.constant 2.560000e+02 : f32
%cst_2 = arith.constant 0.000000e+00 : f32
%c256_i32 = arith.constant 256 : i32
%cst_3 = arith.constant dense<0.000000e+00> : tensor<256xf32, #blocked>
%cst_4 = arith.constant dense<0.000000e+00> : tensor<256xbf16, #blocked>
%0 = tt.get_program_id x : i32
%1 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #blocked>
%2 = arith.cmpi slt, %1, %cst : tensor<256xi32, #blocked>
%3 = arith.muli %0, %c256_i32 : i32
%4 = tt.splat %3 : (i32) -> tensor<256xi32, #blocked>
%5 = arith.addi %1, %4 : tensor<256xi32, #blocked>
%6 = tt.splat %arg0 : (!tt.ptr<f32, 1>) -> tensor<256x!tt.ptr<f32, 1>, #blocked>
%7 = tt.addptr %6, %5 : tensor<256x!tt.ptr<f32, 1>, #blocked>, tensor<256xi32, #blocked>
%8 = tt.load %7, %2, %cst_3 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xf32, #blocked>
%9 = tt.splat %arg1 : (!tt.ptr<bf16, 1>) -> tensor<256x!tt.ptr<bf16, 1>, #blocked>
%10 = tt.addptr %9, %5 : tensor<256x!tt.ptr<bf16, 1>, #blocked>, tensor<256xi32, #blocked>
%11 = tt.load %10, %2, %cst_4 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xbf16, #blocked>
%12 = arith.extf %11 : tensor<256xbf16, #blocked> to tensor<256xf32, #blocked>
%13 = tt.splat %arg2 : (!tt.ptr<bf16, 1>) -> tensor<256x!tt.ptr<bf16, 1>, #blocked>
%14 = tt.addptr %13, %5 : tensor<256x!tt.ptr<bf16, 1>, #blocked>, tensor<256xi32, #blocked>
%15 = tt.load %14, %2, %cst_4 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xbf16, #blocked>
%16 = arith.extf %15 : tensor<256xbf16, #blocked> to tensor<256xf32, #blocked>
%17 = tt.splat %arg3 : (!tt.ptr<f32, 1>) -> tensor<256x!tt.ptr<f32, 1>, #blocked>
%18 = tt.addptr %17, %1 : tensor<256x!tt.ptr<f32, 1>, #blocked>, tensor<256xi32, #blocked>
%19 = tt.load %18, %2, %cst_3 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<256xf32, #blocked>
%20 = arith.addf %8, %12 : tensor<256xf32, #blocked>
%21 = arith.addf %20, %16 : tensor<256xf32, #blocked>
%22 = arith.select %2, %21, %cst_3 : tensor<256xi1, #blocked>, tensor<256xf32, #blocked>
%23 = "tt.reduce"(%22) <{axis = 0 : i32}> ({
^bb0(%arg7: f32, %arg8: f32):
%41 = arith.addf %arg7, %arg8 : f32
tt.reduce.return %41 : f32
}) : (tensor<256xf32, #blocked>) -> f32
%24 = arith.addf %23, %cst_2 : f32
%25 = arith.divf %24, %cst_1 : f32
%26 = tt.splat %25 : (f32) -> tensor<256xf32, #blocked>
%27 = arith.subf %21, %26 : tensor<256xf32, #blocked>
%28 = arith.mulf %27, %27 : tensor<256xf32, #blocked>
%29 = arith.select %2, %28, %cst_3 : tensor<256xi1, #blocked>, tensor<256xf32, #blocked>
%30 = "tt.reduce"(%29) <{axis = 0 : i32}> ({
^bb0(%arg7: f32, %arg8: f32):
%41 = arith.addf %arg7, %arg8 : f32
tt.reduce.return %41 : f32
}) : (tensor<256xf32, #blocked>) -> f32
%31 = arith.addf %30, %cst_2 : f32
%32 = arith.divf %31, %cst_1 : f32
%33 = arith.addf %32, %cst_0 : f32
%34 = tt.extern_elementwise %33 {libname = "libdevice", libpath = "/usr/local/lib/python3.10/dist-packages/triton/language/../third_party/cuda/lib/libdevice.10.bc", pure = true, symbol = "__nv_rsqrtf"} : (f32) -> f32
%35 = tt.splat %34 : (f32) -> tensor<256xf32, #blocked>
%36 = arith.mulf %27, %35 : tensor<256xf32, #blocked>
%37 = arith.mulf %36, %19 : tensor<256xf32, #blocked>
%38 = tt.splat %arg4 : (!tt.ptr<bf16, 1>) -> tensor<256x!tt.ptr<bf16, 1>, #blocked>
%39 = tt.addptr %38, %5 : tensor<256x!tt.ptr<bf16, 1>, #blocked>, tensor<256xi32, #blocked>
%40 = arith.truncf %37 : tensor<256xf32, #blocked> to tensor<256xbf16, #blocked>
tt.store %39, %40, %2 {cache = 1 : i32, evict = 1 : i32} : tensor<256xbf16, #blocked>
tt.return
}
}