trt_ops.td 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9
#ifndef TRT_OPS
#define TRT_OPS

include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/LoopLikeInterface.td"
include "mlir/Interfaces/CallInterfaces.td"
include "mlir/IR/OpBase.td"
include "paddle/infrt/dialect/tensorrt/trt_op_base.td"

W
Wilber 已提交
10 11
include "paddle/infrt/dialect/infrt/ir/infrt_base.td"
include "paddle/infrt/dialect/phi/ir/infrt_phi_base.td"
S
Shang Zhizhou 已提交
12 13 14

def TRT_CreateEngineOp : TRT_Op<"create_engine", [SingleBlockImplicitTerminator<"::infrt::ReturnOp">]> {
  let summary = "trt CreateEngine Op";
15 16 17 18
  let description = [{
    Describe a tensorrt subgraph.
  }];
  let regions = (region SizedRegion<1>:$body);
W
Wilber 已提交
19 20
  let arguments = (ins Variadic<DenseTensor>:$inputs, DefaultValuedAttr<BoolAttr, "true">:$run_once);
  let results = (outs TRT_EngineType:$engine);
S
Shang Zhizhou 已提交
21 22 23 24 25 26 27
}

def TRT_ExecuteOp : TRT_Op<"execute", [NoSideEffect]> {
  let summary = "trt execute Op";
  let description = [{
    Describe a tensorrt runtime.
  }];
W
Wilber 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  let arguments = (ins TRT_EngineType:$engine, Variadic<DenseTensor>:$inputs);
  let results = (outs Variadic<DenseTensor>:$output);
}

def TRT_EngineComputeOp : TRT_Op<"compute", [NoSideEffect]> {
  let summary = "trt compute engine";
  let description = [{
    execute engine
  }];
  let arguments = (ins TRT_EngineType:$engine, Context:$context);
  let results = (outs DenseTensorList:$outputs);
}

def TRT_InspectEngineOp : TRT_Op<"inspect_engine", [NoSideEffect]> {
  let summary = "trt inspect engine";
  let description = [{
    Show engine
  }];
  let arguments = (ins TRT_EngineType:$engine);
47
}
48 49 50 51 52 53 54 55

def TRT_ActivationOp : TRT_Op<"Activation", [NoSideEffect]> {
  let summary = "TensorRT IActivationLayer";
  let description = [{
    
    TensorRT IActivationLayer.
    
  }];
W
Wilber 已提交
56
  let arguments = (ins  DenseTensor:$input, SI32Attr:$activation_type,
57 58 59
                        DefaultValuedAttr<F32Attr, "0.0">:$alpha,
                        DefaultValuedAttr<F32Attr, "0.0">:$beta);

W
Wilber 已提交
60
  let results = (outs DenseTensor:$output);
61 62 63 64 65 66 67 68 69
}

def TRT_ElementWiseOp : TRT_Op<"ElementWise", [NoSideEffect]> {
  let summary = "TensorRT IElementWiseLayer";
  let description = [{
    
    TensorRT IElementWiseLayer.
    
  }];
W
Wilber 已提交
70
  let arguments = (ins  DenseTensor:$input1, DenseTensor:$input2, SI32Attr:$elementwise_operation);
71

W
Wilber 已提交
72
  let results = (outs DenseTensor:$output);
73 74 75 76 77 78 79 80 81
}

def TRT_MatrixMultiplyOp : TRT_Op<"MatrixMultiply", [NoSideEffect]> {
  let summary = "TensorRT IMatrixMultiplyLayer";
  let description = [{
    
    TensorRT IMatrixMultiplyLayer.
    
  }];
W
Wilber 已提交
82 83
  let arguments = (ins  DenseTensor:$input1, BoolAttr:$transpose1,
                        DenseTensor:$input2, BoolAttr:$transpose2);
84

W
Wilber 已提交
85
  let results = (outs DenseTensor:$output);
86 87
}

88
#endif  // TRT_OPS