#ifdef PHI_TENSOR #else #define PHI_TENSOR include "paddle/infrt/dialect/phi/ir/infrt_phi_base.td" include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/IR/OpBase.td" include "paddle/infrt/dialect/infrt_base.td" def PHI_DenseTensorDialect : Dialect { let name = "phi_dt"; let description = [{ The PHI DenseTensor dialect. }]; let cppNamespace = "::infrt::phi"; } // PHI DenseTensor related Op. class PDT_Op traits = []> : Op {} class CreateDenseTensorOp : PDT_Op<"create_dense_tensor", [NoSideEffect]> { let arguments = (ins Context:$context, I64ArrayAttr:$dims, LayoutAttr:$layout, I64ArrayAttr:$lod, PrecisionAttr:$precision); let results = (outs DenseTensor:$output); } class FillDenseTensorOp : PDT_Op<"fill_dense_tensor." # dtype> { let arguments = (ins DenseTensor:$input, attr_type:$value ); let results = (outs); let assemblyFormat = "`(` $input `:` type($input) `)` attr-dict"; } class PrintDenseTensorOp: PDT_Op<"print_tensor"> { let arguments = (ins DenseTensor:$input); let results = (outs); let assemblyFormat = "`(` $input `:` type($input) `)` attr-dict"; } class CreateContextOp : PDT_Op<"create_context." # target, [NoSideEffect]> { let arguments = (ins); let results = (outs Context:$output); } def PDT_CreateDenseTensorOp : CreateDenseTensorOp; def PDT_FillDenseTensorOp_f32 : FillDenseTensorOp; def PDT_CreateCPUContextOp : CreateContextOp<"cpu">; def PDT_PrintDenseTensor : PrintDenseTensorOp; def FakeKernelOp : PDT_Op<"fake_phi_kernel"> { let arguments = (ins Context:$dev_ctx, DenseTensor:$x, DenseTensor:$y, BoolAttr:$transpose_x, BoolAttr:$transpose_y); let results = (outs DenseTensor:$output); } #endif