Skip to content

Instantly share code, notes, and snippets.

@stellaraccident
Last active December 11, 2021 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stellaraccident/572e71ddb9f9a4d4e4184e54ec494702 to your computer and use it in GitHub Desktop.
Save stellaraccident/572e71ddb9f9a4d4e4184e54ec494702 to your computer and use it in GitHub Desktop.
Constant Hoisting
CONSTANT ROOT: %cst_0 = arith.constant dense<5.000000e-01> : tensor<6x3xf32>
CONSTANT ROOT: %_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
CONSTANT ROOT: %cst_4 = arith.constant dense<1.270000e+02> : tensor<5x6xf32>
CONSTANT ROOT: %cst_2 = arith.constant dense<-1.270000e+02> : tensor<5x6xf32>
CONSTANT ROOT: %cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
CONSTANT ROOT: %c0_i32 = arith.constant 0 : i32
CONSTANT ROOT: %cst_1 = arith.constant dense<5.000000e-01> : tensor<5x6xf32>
CONSTANT ROOT: %_params$1 = util.global.load @_params$1 : tensor<f32>
CONSTANT ROOT: %cst = arith.constant 0xFF800000 : f32
EXPAND TO UNKNOWN: %26 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%24, %cst_0 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%25 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
EXPAND TO UNKNOWN: %24 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$0, %22 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%23 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
EXPAND TO UNKNOWN: %22 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%20 : tensor<f32>) outs(%21 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<6x3xf32>
EXPAND TO UNKNOWN: %20 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%cst_3, %18 : tensor<f32>, tensor<f32>) outs(%19 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
EXPAND TO UNKNOWN: %18 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>], iterator_types = ["reduction", "reduction"]} ins(%15 : tensor<6x3xf32>) outs(%17 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
EXPAND TO UNKNOWN: %15 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$0 : tensor<6x3xf32>) outs(%14 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.abs %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
EXPAND TO UNKNOWN: %14 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
EXPAND TO UNKNOWN: %17 = linalg.fill(%cst, %16) : f32, tensor<f32> -> tensor<f32>
EXPAND TO UNKNOWN: %16 = linalg.init_tensor [] : tensor<f32>
EXPAND TO UNKNOWN: %19 = linalg.init_tensor [] : tensor<f32>
EXPAND TO UNKNOWN: %21 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
EXPAND TO UNKNOWN: %23 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
EXPAND TO UNKNOWN: %25 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
EXPAND TO UNKNOWN: %11 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%9, %cst_4 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%10 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.minf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
EXPAND TO UNKNOWN: %9 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%7, %cst_2 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%8 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
EXPAND TO UNKNOWN: %7 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%5 : tensor<5x6xf32>) outs(%6 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
EXPAND TO UNKNOWN: %5 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%3, %cst_1 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%4 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
EXPAND TO UNKNOWN: %3 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%arg0, %1 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%2 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
EXPAND TO UNKNOWN: %4 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
EXPAND TO UNKNOWN: %6 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
EXPAND TO UNKNOWN: %8 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
EXPAND TO UNKNOWN: %10 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
EXPAND TO UNKNOWN: %32 = linalg.fill(%c0_i32, %31) : i32, tensor<5x3xi32> -> tensor<5x3xi32>
EXPAND TO UNKNOWN: %31 = linalg.init_tensor [5, 3] : tensor<5x3xi32>
EXPAND TO UNKNOWN: %35 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%_params$1, %20 : tensor<f32>, tensor<f32>) outs(%34 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
EXPAND TO UNKNOWN: %34 = linalg.init_tensor [] : tensor<f32>
EXPAND TO UNKNOWN: %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$1 : tensor<f32>) outs(%0 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x6xf32>
EXPAND TO UNKNOWN: %0 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %14 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
RESOLVED AS CONSTANT: %16 = linalg.init_tensor [] : tensor<f32>
RESOLVED AS CONSTANT: %19 = linalg.init_tensor [] : tensor<f32>
RESOLVED AS CONSTANT: %21 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
RESOLVED AS CONSTANT: %23 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
RESOLVED AS CONSTANT: %25 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
RESOLVED AS NON_CONSTANT: %5 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%3, %cst_1 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%4 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
RESOLVED AS CONSTANT: %4 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
RESOLVED AS CONSTANT: %6 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
RESOLVED AS CONSTANT: %8 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
RESOLVED AS CONSTANT: %10 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
RESOLVED AS CONSTANT: %31 = linalg.init_tensor [5, 3] : tensor<5x3xi32>
RESOLVED AS CONSTANT: %34 = linalg.init_tensor [] : tensor<f32>
RESOLVED AS CONSTANT: %0 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %15 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$0 : tensor<6x3xf32>) outs(%14 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.abs %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
RESOLVED AS CONSTANT: %17 = linalg.fill(%cst, %16) : f32, tensor<f32> -> tensor<f32>
RESOLVED AS NON_CONSTANT: %7 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%5 : tensor<5x6xf32>) outs(%6 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
RESOLVED AS CONSTANT: %32 = linalg.fill(%c0_i32, %31) : i32, tensor<5x3xi32> -> tensor<5x3xi32>
EXPAND TO UNKNOWN: %33 = linalg.matmul ins(%13, %30 : tensor<5x6xi8>, tensor<6x3xi8>) outs(%32 : tensor<5x3xi32>) -> tensor<5x3xi32>
EXPAND TO UNKNOWN: %13 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%11 : tensor<5x6xf32>) outs(%12 : tensor<5x6xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<5x6xi8>
EXPAND TO UNKNOWN: %12 = linalg.init_tensor [5, 6] : tensor<5x6xi8>
EXPAND TO UNKNOWN: %30 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%28 : tensor<6x3xf32>) outs(%29 : tensor<6x3xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<6x3xi8>
EXPAND TO UNKNOWN: %28 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%26 : tensor<6x3xf32>) outs(%27 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
EXPAND TO UNKNOWN: %27 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
EXPAND TO UNKNOWN: %29 = linalg.init_tensor [6, 3] : tensor<6x3xi8>
RESOLVED AS CONSTANT: %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$1 : tensor<f32>) outs(%0 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x6xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %18 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>], iterator_types = ["reduction", "reduction"]} ins(%15 : tensor<6x3xf32>) outs(%17 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
RESOLVED AS NON_CONSTANT: %9 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%7, %cst_2 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%8 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
RESOLVED AS CONSTANT: %12 = linalg.init_tensor [5, 6] : tensor<5x6xi8>
RESOLVED AS CONSTANT: %27 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
RESOLVED AS CONSTANT: %29 = linalg.init_tensor [6, 3] : tensor<6x3xi8>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %20 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%cst_3, %18 : tensor<f32>, tensor<f32>) outs(%19 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
RESOLVED AS NON_CONSTANT: %11 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%9, %cst_4 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%10 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.minf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
RESOLVED AS NON_CONSTANT: %13 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%11 : tensor<5x6xf32>) outs(%12 : tensor<5x6xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<5x6xi8>
RESOLVED AS CONSTANT: %35 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%_params$1, %20 : tensor<f32>, tensor<f32>) outs(%34 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
EXPAND TO UNKNOWN: %39 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%35 : tensor<f32>) outs(%38 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x3xf32>
EXPAND TO UNKNOWN: %38 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %22 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%20 : tensor<f32>) outs(%21 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<6x3xf32>
RESOLVED AS NON_CONSTANT: %33 = linalg.matmul ins(%13, %30 : tensor<5x6xi8>, tensor<6x3xi8>) outs(%32 : tensor<5x3xi32>) -> tensor<5x3xi32>
RESOLVED AS CONSTANT: %38 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %24 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$0, %22 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%23 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
RESOLVED AS CONSTANT: %39 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%35 : tensor<f32>) outs(%38 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x3xf32>
EXPAND TO UNKNOWN: %41 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%37, %39 : tensor<5x3xf32>, tensor<5x3xf32>) outs(%40 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x3xf32>
EXPAND TO UNKNOWN: %37 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%33 : tensor<5x3xi32>) outs(%36 : tensor<5x3xf32>) {
^bb0(%arg1: i32, %arg2: f32): // no predecessors
%42 = arith.sitofp %arg1 : i32 to f32
linalg.yield %42 : f32
} -> tensor<5x3xf32>
EXPAND TO UNKNOWN: %36 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
EXPAND TO UNKNOWN: %40 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %26 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%24, %cst_0 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%25 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
RESOLVED AS CONSTANT: %28 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%26 : tensor<6x3xf32>) outs(%27 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
RESOLVED AS NON_CONSTANT: %37 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%33 : tensor<5x3xi32>) outs(%36 : tensor<5x3xf32>) {
^bb0(%arg1: i32, %arg2: f32): // no predecessors
%42 = arith.sitofp %arg1 : i32 to f32
linalg.yield %42 : f32
} -> tensor<5x3xf32>
RESOLVED AS CONSTANT: %36 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
RESOLVED AS CONSTANT: %40 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
PROCESS WORKLIST:
RESOLVED AS CONSTANT: %30 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%28 : tensor<6x3xf32>) outs(%29 : tensor<6x3xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<6x3xi8>
RESOLVED AS NON_CONSTANT: %41 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%37, %39 : tensor<5x3xf32>, tensor<5x3xf32>) outs(%40 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x3xf32>
FOUND CONSTANTS:
----------------
::%26 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%24, %cst_0 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%25 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
WITH ROOTS:
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%cst = arith.constant 0xFF800000 : f32
%cst_0 = arith.constant dense<5.000000e-01> : tensor<6x3xf32>
::%24 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$0, %22 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%23 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
WITH ROOTS:
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%cst = arith.constant 0xFF800000 : f32
::%22 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%20 : tensor<f32>) outs(%21 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<6x3xf32>
WITH ROOTS:
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst = arith.constant 0xFF800000 : f32
::%20 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%cst_3, %18 : tensor<f32>, tensor<f32>) outs(%19 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
WITH ROOTS:
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst = arith.constant 0xFF800000 : f32
::%18 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>], iterator_types = ["reduction", "reduction"]} ins(%15 : tensor<6x3xf32>) outs(%17 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
WITH ROOTS:
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst = arith.constant 0xFF800000 : f32
::%15 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$0 : tensor<6x3xf32>) outs(%14 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.abs %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
WITH ROOTS:
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
::%17 = linalg.fill(%cst, %16) : f32, tensor<f32> -> tensor<f32>
WITH ROOTS:
%cst = arith.constant 0xFF800000 : f32
::%32 = linalg.fill(%c0_i32, %31) : i32, tensor<5x3xi32> -> tensor<5x3xi32>
WITH ROOTS:
%c0_i32 = arith.constant 0 : i32
::%35 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%_params$1, %20 : tensor<f32>, tensor<f32>) outs(%34 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
WITH ROOTS:
%_params$1 = util.global.load @_params$1 : tensor<f32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst = arith.constant 0xFF800000 : f32
::%1 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%_params$1 : tensor<f32>) outs(%0 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x6xf32>
WITH ROOTS:
%_params$1 = util.global.load @_params$1 : tensor<f32>
::%30 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%28 : tensor<6x3xf32>) outs(%29 : tensor<6x3xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<6x3xi8>
WITH ROOTS:
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%cst = arith.constant 0xFF800000 : f32
%cst_0 = arith.constant dense<5.000000e-01> : tensor<6x3xf32>
::%28 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%26 : tensor<6x3xf32>) outs(%27 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
WITH ROOTS:
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%cst = arith.constant 0xFF800000 : f32
%cst_0 = arith.constant dense<5.000000e-01> : tensor<6x3xf32>
::%39 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%35 : tensor<f32>) outs(%38 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x3xf32>
WITH ROOTS:
%_params$1 = util.global.load @_params$1 : tensor<f32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%cst = arith.constant 0xFF800000 : f32
#map0 = affine_map<(d0, d1) -> ()>
#map1 = affine_map<(d0, d1) -> (d0, d1)>
#map2 = affine_map<() -> ()>
module @aqt_matmul {
util.global private @_params$0 = dense<[[0.000000e+00, 5.003000e+02, 1.000600e+03], [1500.8999, 2.001200e+03, 2.501500e+03], [3001.7998, 3502.09985, 4.002400e+03], [4502.69971, 5.003000e+03, 5.503300e+03], [6003.59961, 6503.8999, 7004.1997], [7.504500e+03, 8004.7998, 8.505100e+03]]> : tensor<6x3xf32>
util.global private @_params$1 = dense<5.000000e+00> : tensor<f32>
func @compute_native(%arg0: tensor<5x6xf32>) -> tensor<5x3xf32> {
%c0_i32 = arith.constant 0 : i32
%cst = arith.constant 0xFF800000 : f32
%cst_0 = arith.constant dense<5.000000e-01> : tensor<6x3xf32>
%cst_1 = arith.constant dense<5.000000e-01> : tensor<5x6xf32>
%cst_2 = arith.constant dense<-1.270000e+02> : tensor<5x6xf32>
%cst_3 = arith.constant dense<1.270000e+02> : tensor<f32>
%cst_4 = arith.constant dense<1.270000e+02> : tensor<5x6xf32>
%_params$0 = util.global.load @_params$0 : tensor<6x3xf32>
%_params$1 = util.global.load @_params$1 : tensor<f32>
%0 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
%1 = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel"]} ins(%_params$1 : tensor<f32>) outs(%0 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x6xf32>
%2 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
%3 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%arg0, %1 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%2 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
%4 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
%5 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%3, %cst_1 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%4 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
%6 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
%7 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%5 : tensor<5x6xf32>) outs(%6 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
%8 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
%9 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%7, %cst_2 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%8 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
%10 = linalg.init_tensor [5, 6] : tensor<5x6xf32>
%11 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%9, %cst_4 : tensor<5x6xf32>, tensor<5x6xf32>) outs(%10 : tensor<5x6xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.minf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x6xf32>
%12 = linalg.init_tensor [5, 6] : tensor<5x6xi8>
%13 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%11 : tensor<5x6xf32>) outs(%12 : tensor<5x6xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<5x6xi8>
%14 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
%15 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%_params$0 : tensor<6x3xf32>) outs(%14 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.abs %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
%16 = linalg.init_tensor [] : tensor<f32>
%17 = linalg.fill(%cst, %16) : f32, tensor<f32> -> tensor<f32>
%18 = linalg.generic {indexing_maps = [#map1, #map0], iterator_types = ["reduction", "reduction"]} ins(%15 : tensor<6x3xf32>) outs(%17 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = arith.maxf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
%19 = linalg.init_tensor [] : tensor<f32>
%20 = linalg.generic {indexing_maps = [#map2, #map2, #map2], iterator_types = []} ins(%cst_3, %18 : tensor<f32>, tensor<f32>) outs(%19 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
%21 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
%22 = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel"]} ins(%20 : tensor<f32>) outs(%21 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<6x3xf32>
%23 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
%24 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%_params$0, %22 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%23 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
%25 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
%26 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%24, %cst_0 : tensor<6x3xf32>, tensor<6x3xf32>) outs(%25 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.addf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
%27 = linalg.init_tensor [6, 3] : tensor<6x3xf32>
%28 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%26 : tensor<6x3xf32>) outs(%27 : tensor<6x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
%42 = math.floor %arg1 : f32
linalg.yield %42 : f32
} -> tensor<6x3xf32>
%29 = linalg.init_tensor [6, 3] : tensor<6x3xi8>
%30 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%28 : tensor<6x3xf32>) outs(%29 : tensor<6x3xi8>) {
^bb0(%arg1: f32, %arg2: i8): // no predecessors
%42 = arith.fptosi %arg1 : f32 to i8
linalg.yield %42 : i8
} -> tensor<6x3xi8>
%31 = linalg.init_tensor [5, 3] : tensor<5x3xi32>
%32 = linalg.fill(%c0_i32, %31) : i32, tensor<5x3xi32> -> tensor<5x3xi32>
%33 = linalg.matmul ins(%13, %30 : tensor<5x6xi8>, tensor<6x3xi8>) outs(%32 : tensor<5x3xi32>) -> tensor<5x3xi32>
%34 = linalg.init_tensor [] : tensor<f32>
%35 = linalg.generic {indexing_maps = [#map2, #map2, #map2], iterator_types = []} ins(%_params$1, %20 : tensor<f32>, tensor<f32>) outs(%34 : tensor<f32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.mulf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<f32>
%36 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
%37 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%33 : tensor<5x3xi32>) outs(%36 : tensor<5x3xf32>) {
^bb0(%arg1: i32, %arg2: f32): // no predecessors
%42 = arith.sitofp %arg1 : i32 to f32
linalg.yield %42 : f32
} -> tensor<5x3xf32>
%38 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
%39 = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel"]} ins(%35 : tensor<f32>) outs(%38 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32): // no predecessors
linalg.yield %arg1 : f32
} -> tensor<5x3xf32>
%40 = linalg.init_tensor [5, 3] : tensor<5x3xf32>
%41 = linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = ["parallel", "parallel"]} ins(%37, %39 : tensor<5x3xf32>, tensor<5x3xf32>) outs(%40 : tensor<5x3xf32>) {
^bb0(%arg1: f32, %arg2: f32, %arg3: f32): // no predecessors
%42 = arith.divf %arg1, %arg2 : f32
linalg.yield %42 : f32
} -> tensor<5x3xf32>
return %41 : tensor<5x3xf32>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment