File size: 3,136 Bytes
9b31431
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module {
  tt.func public @triton__0d1d2d3d4de(%arg0: !tt.ptr<bf16, 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<bf16, 1> {tt.divisibility = 16 : i32}, %arg4: i32 {tt.divisibility = 16 : i32, tt.max_divisibility = 16 : i32}) attributes {noinline = false} {
    %cst = arith.constant dense<0> : tensor<1024xi32>
    %cst_0 = arith.constant dense<1> : tensor<1024xi32>
    %cst_1 = arith.constant dense<0.000000e+00> : tensor<1024xf32>
    %cst_2 = arith.constant dense<2> : tensor<1024xi32>
    %cst_3 = arith.constant dense<768> : tensor<1024xi32>
    %cst_4 = arith.constant dense<3> : tensor<1024xi32>
    %cst_5 = arith.constant dense<256> : tensor<1024xi32>
    %c1024_i32 = arith.constant 1024 : i32
    %0 = tt.get_program_id x : i32
    %1 = arith.muli %0, %c1024_i32 : i32
    %2 = tt.make_range {end = 1024 : i32, start = 0 : i32} : tensor<1024xi32>
    %3 = tt.splat %1 : (i32) -> tensor<1024xi32>
    %4 = arith.addi %3, %2 : tensor<1024xi32>
    %5 = arith.divsi %4, %cst_5 : tensor<1024xi32>
    %6 = arith.remsi %5, %cst_4 : tensor<1024xi32>
    %7 = arith.remsi %4, %cst_5 : tensor<1024xi32>
    %8 = arith.divsi %4, %cst_3 : tensor<1024xi32>
    %9 = arith.muli %8, %cst_5 : tensor<1024xi32>
    %10 = arith.addi %7, %9 : tensor<1024xi32>
    %11 = tt.splat %arg0 : (!tt.ptr<bf16, 1>) -> tensor<1024x!tt.ptr<bf16, 1>>
    %12 = tt.addptr %11, %10 : tensor<1024x!tt.ptr<bf16, 1>>, tensor<1024xi32>
    %13 = tt.load %12 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1024xbf16>
    %14 = arith.extf %13 : tensor<1024xbf16> to tensor<1024xf32>
    %15 = tt.splat %arg1 : (!tt.ptr<bf16, 1>) -> tensor<1024x!tt.ptr<bf16, 1>>
    %16 = tt.addptr %15, %10 : tensor<1024x!tt.ptr<bf16, 1>>, tensor<1024xi32>
    %17 = tt.load %16 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1024xbf16>
    %18 = arith.extf %17 : tensor<1024xbf16> to tensor<1024xf32>
    %19 = tt.splat %arg2 : (!tt.ptr<bf16, 1>) -> tensor<1024x!tt.ptr<bf16, 1>>
    %20 = tt.addptr %19, %10 : tensor<1024x!tt.ptr<bf16, 1>>, tensor<1024xi32>
    %21 = tt.load %20 {cache = 1 : i32, evict = 3 : i32, isVolatile = false} : tensor<1024xbf16>
    %22 = arith.extf %21 : tensor<1024xbf16> to tensor<1024xf32>
    %23 = arith.cmpi eq, %6, %cst_2 : tensor<1024xi32>
    %24 = arith.select %23, %14, %cst_1 : tensor<1024xi1>, tensor<1024xf32>
    %25 = arith.cmpi eq, %6, %cst_0 : tensor<1024xi32>
    %26 = arith.select %25, %18, %cst_1 : tensor<1024xi1>, tensor<1024xf32>
    %27 = arith.addf %24, %26 : tensor<1024xf32>
    %28 = arith.cmpi eq, %6, %cst : tensor<1024xi32>
    %29 = arith.select %28, %22, %cst_1 : tensor<1024xi1>, tensor<1024xf32>
    %30 = arith.addf %27, %29 : tensor<1024xf32>
    %31 = tt.splat %arg3 : (!tt.ptr<bf16, 1>) -> tensor<1024x!tt.ptr<bf16, 1>>
    %32 = tt.addptr %31, %4 : tensor<1024x!tt.ptr<bf16, 1>>, tensor<1024xi32>
    %33 = arith.truncf %30 : tensor<1024xf32> to tensor<1024xbf16>
    tt.store %32, %33 {cache = 1 : i32, evict = 1 : i32} : tensor<1024xbf16>
    tt.return
  }
}