How to find forOp arg's preOp in MLIR

25 Views Asked by At

    %39 = tt.addptr %38, %37 : tensor<32x64x!tt.ptr<f16>>, tensor<32x64xi32>
    %40 = tt.expand_dims %30 {axis = 1 : i32} : (tensor<64xi32>) -> tensor<64x1xi32>
    %41 = tt.splat %arg7 : (i32) -> tensor<64x1xi32>
    %42 = arith.muli %40, %41 : tensor<64x1xi32>
    %43 = tt.expand_dims %26 {axis = 0 : i32} : (tensor<32xi32>) -> tensor<1x32xi32>
    %44 = tt.broadcast %42 : (tensor<64x1xi32>) -> tensor<64x32xi32>
    %45 = tt.broadcast %43 : (tensor<1x32xi32>) -> tensor<64x32xi32>
    %46 = arith.addi %44, %45 : tensor<64x32xi32>
    %47 = tt.splat %arg1 : (!tt.ptr<f16>) -> tensor<64x32x!tt.ptr<f16>>
    %48 = tt.addptr %47, %46 : tensor<64x32x!tt.ptr<f16>>, tensor<64x32xi32>
    %49 = arith.addi %arg5, %c63_i32 : i32
    %50 = arith.divsi %49, %c64_i32 : i32
    %51 = arith.muli %arg6, %c64_i32 : i32
    %52 = tt.splat %51 : (i32) -> tensor<32x64xi32>
    %53 = arith.muli %arg7, %c64_i32 : i32
    %54 = tt.splat %53 : (i32) -> tensor<64x32xi32>
    %55:3 = scf.for %arg9 = %c0_i32 to %50 step %c1_i32 iter_args(%arg10 = %cst, %arg11 = %39, %arg12 = %48) -> (tensor<32x32xf32>, tensor<32x64x!tt.ptr<f16>>, tensor<64x32x!tt.ptr<f16>>)  : i32 {
      %73 = tt.load %arg11 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<32x64xf16>
      %74 = tt.load %arg12 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64x32xf16>
      %75 = tt.dot %73, %74, %arg10 {allowTF32 = true} : tensor<32x64xf16> * tensor<64x32xf16> -> tensor<32x32xf32>
      %76 = tt.addptr %arg11, %52 : tensor<32x64x!tt.ptr<f16>>, tensor<32x64xi32>
      %77 = tt.addptr %arg12, %54 : tensor<64x32x!tt.ptr<f16>>, tensor<64x32xi32>
      scf.yield %75, %76, %77 : tensor<32x32xf32>, tensor<32x64x!tt.ptr<f16>>, tensor<64x32x!tt.ptr<f16>>
    }

i want find %arg11 PreOp(%39 = tt.addptr) in ForOp

i try to use %arg11.getDefiningOp(),but this func return NULL

try to use getBackwardSlice(%arg11), this func return ForOp's all arg PreOp

how to get %arg11 PreOp, can anyone help me

0

There are 0 best solutions below