infrt_phi_base.td 895 字节
Newer Older
1 2
#ifndef PHI_BASE
#define PHI_BASE
3 4 5

include "mlir/IR/OpBase.td"

6 7
def PHI_Dialect : Dialect {
  let name = "phi";
8 9

  let description = [{
10
    The PHI host dialect.
11 12
  }];

13
  let cppNamespace = "::infrt::phi";
14 15 16
}

class AllocatorTypeOf<string place, list<Trait> traits=[]>:
17 18
    TypeDef<PHI_Dialect, place # "Allocator", traits> {
    let summary = !strconcat("!phi.allocator_", place, " type");
19 20 21
}

class ContextTypeOf<string place, list<Trait> traits=[]>:
22 23
    TypeDef<PHI_Dialect, place # "Context", traits> {
    let summary = !strconcat("!phi.context_", place, " type");
24 25 26 27 28 29 30 31 32 33 34 35
}

def CPU_Allocator : AllocatorTypeOf<"CPU">;
def GPU_Allocator : AllocatorTypeOf<"GPU">;

def CPU_Context : ContextTypeOf<"CPU">;
def GPU_Context : ContextTypeOf<"GPU">;

def Allocator : AnyTypeOf<[CPU_Allocator, GPU_Allocator], "Allocator type">;
def Context : AnyTypeOf<[CPU_Context, GPU_Context], "Context type">;

#endif