0-hero's picture
Add files using upload-large-folder tool
9ab9a5e verified
raw
history blame
5.68 kB
module {
tt.func public @triton__0d1d2d3d4d5d6d7d8de9de(%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<f32, 1> {tt.divisibility = 16 : i32}, %arg5: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg6: !tt.ptr<f32, 1> {tt.divisibility = 16 : i32}, %arg7: !tt.ptr<bf16, 1> {tt.divisibility = 16 : i32}, %arg8: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}, %arg9: 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 0.000000e+00 : f32
%cst_0 = arith.constant 2.560000e+02 : f32
%cst_1 = arith.constant 9.99999974E-6 : f32
%cst_2 = arith.constant dense<0.000000e+00> : tensor<256xf32>
%cst_3 = arith.constant dense<256> : tensor<1xi64>
%cst_4 = arith.constant dense<50257> : tensor<1xi64>
%cst_5 = arith.constant dense<0> : tensor<1xi64>
%cst_6 = arith.constant dense<256> : tensor<256xi32>
%0 = tt.get_program_id x : i32
%1 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32>
%2 = arith.cmpi slt, %1, %cst_6 : tensor<256xi32>
%3 = arith.remsi %0, %c512_i32 : i32
%4 = tt.addptr %arg1, %0 : !tt.ptr<i64, 1>, i32
%5 = tt.splat %4 : (!tt.ptr<i64, 1>) -> tensor<1x!tt.ptr<i64, 1>>
%6 = tt.load %5 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1xi64>
%7 = arith.muli %3, %c256_i32 : i32
%8 = tt.splat %7 : (i32) -> tensor<256xi32>
%9 = arith.addi %1, %8 : tensor<256xi32>
%10 = tt.splat %arg3 : (!tt.ptr<f32, 1>) -> tensor<256x!tt.ptr<f32, 1>>
%11 = tt.addptr %10, %9 : tensor<256x!tt.ptr<f32, 1>>, tensor<256xi32>
%12 = tt.load %11, %2, %cst_2 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<256xf32>
%13 = tt.splat %arg4 : (!tt.ptr<f32, 1>) -> tensor<256x!tt.ptr<f32, 1>>
%14 = tt.addptr %13, %1 : tensor<256x!tt.ptr<f32, 1>>, tensor<256xi32>
%15 = tt.load %14, %2, %cst_2 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<256xf32>
%16 = arith.addi %6, %cst_4 : tensor<1xi64>
%17 = arith.cmpi slt, %6, %cst_5 : tensor<1xi64>
%18 = arith.select %17, %16, %6 : tensor<1xi1>, tensor<1xi64>
%19 = arith.cmpi sge, %18, %cst_5 : tensor<1xi64>
%20 = arith.cmpi slt, %18, %cst_4 : tensor<1xi64>
%21 = arith.andi %19, %20 : tensor<1xi1>
tt.assert %21, "index out of bounds: 0 <= tmp3 < 50257", "<frozen importlib._bootstrap_external>", "_call_with_frames_removed", 883 : tensor<1xi1>
%22 = arith.muli %18, %cst_3 : tensor<1xi64>
%23 = tt.broadcast %22 : (tensor<1xi64>) -> tensor<256xi64>
%24 = arith.extsi %1 : tensor<256xi32> to tensor<256xi64>
%25 = arith.addi %24, %23 : tensor<256xi64>
%26 = tt.splat %arg2 : (!tt.ptr<f32, 1>) -> tensor<256x!tt.ptr<f32, 1>>
%27 = tt.addptr %26, %25 : tensor<256x!tt.ptr<f32, 1>>, tensor<256xi64>
%28 = tt.load %27, %2, %cst_2 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xf32>
%29 = arith.addf %28, %12 : tensor<256xf32>
%30 = arith.select %2, %29, %cst_2 : tensor<256xi1>, tensor<256xf32>
%31 = "tt.reduce"(%30) <{axis = 0 : i32}> ({
^bb0(%arg10: f32, %arg11: f32):
%60 = arith.addf %arg10, %arg11 : f32
tt.reduce.return %60 : f32
}) : (tensor<256xf32>) -> f32
%32 = arith.addf %31, %cst : f32
%33 = arith.divf %32, %cst_0 : f32
%34 = tt.splat %33 : (f32) -> tensor<1xf32>
%35 = tt.splat %33 : (f32) -> tensor<256xf32>
%36 = arith.subf %29, %35 : tensor<256xf32>
%37 = arith.mulf %36, %36 : tensor<256xf32>
%38 = arith.select %2, %37, %cst_2 : tensor<256xi1>, tensor<256xf32>
%39 = "tt.reduce"(%38) <{axis = 0 : i32}> ({
^bb0(%arg10: f32, %arg11: f32):
%60 = arith.addf %arg10, %arg11 : f32
tt.reduce.return %60 : f32
}) : (tensor<256xf32>) -> f32
%40 = arith.addf %39, %cst : f32
%41 = arith.divf %40, %cst_0 : f32
%42 = arith.addf %41, %cst_1 : f32
%43 = tt.extern_elementwise %42 {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
%44 = tt.splat %43 : (f32) -> tensor<1xf32>
%45 = tt.splat %43 : (f32) -> tensor<256xf32>
%46 = arith.mulf %36, %45 : tensor<256xf32>
%47 = arith.mulf %46, %15 : tensor<256xf32>
%48 = arith.muli %0, %c256_i32 : i32
%49 = tt.splat %48 : (i32) -> tensor<256xi32>
%50 = arith.addi %1, %49 : tensor<256xi32>
%51 = tt.splat %arg5 : (!tt.ptr<f32, 1>) -> tensor<256x!tt.ptr<f32, 1>>
%52 = tt.addptr %51, %50 : tensor<256x!tt.ptr<f32, 1>>, tensor<256xi32>
tt.store %52, %29, %2 {cache = 1 : i32, evict = 1 : i32} : tensor<256xf32>
gpu.barrier
%53 = tt.addptr %arg0, %0 : !tt.ptr<f32, 1>, i32
%54 = tt.splat %53 : (!tt.ptr<f32, 1>) -> tensor<1x!tt.ptr<f32, 1>>
tt.store %54, %44 {cache = 1 : i32, evict = 1 : i32} : tensor<1xf32>
%55 = tt.splat %arg7 : (!tt.ptr<bf16, 1>) -> tensor<256x!tt.ptr<bf16, 1>>
%56 = tt.addptr %55, %50 : tensor<256x!tt.ptr<bf16, 1>>, tensor<256xi32>
%57 = arith.truncf %47 : tensor<256xf32> to tensor<256xbf16>
tt.store %56, %57, %2 {cache = 1 : i32, evict = 1 : i32} : tensor<256xbf16>
%58 = tt.addptr %arg6, %0 : !tt.ptr<f32, 1>, i32
%59 = tt.splat %58 : (!tt.ptr<f32, 1>) -> tensor<1x!tt.ptr<f32, 1>>
tt.store %59, %34 {cache = 1 : i32, evict = 1 : i32} : tensor<1xf32>
tt.return
}
}