2020-04-27 08:20:58 +08:00
|
|
|
//===- NumpyDialect.td - Core numpy dialect ----------------*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef NPCOMP_DIALECT_NUMPY_NUMPY_DIALECT
|
|
|
|
#define NPCOMP_DIALECT_NUMPY_NUMPY_DIALECT
|
|
|
|
|
|
|
|
include "mlir/IR/OpBase.td"
|
|
|
|
|
2020-04-30 08:49:56 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Dialect definition
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-04-27 08:20:58 +08:00
|
|
|
def Numpy_Dialect : Dialect {
|
|
|
|
let name = "numpy";
|
|
|
|
let summary = "Core numpy dialect";
|
|
|
|
let description = [{
|
|
|
|
Dialect of types and core numpy ops and abstractions.
|
|
|
|
}];
|
2020-04-30 09:20:42 +08:00
|
|
|
let cppNamespace = "Numpy";
|
2020-04-27 08:20:58 +08:00
|
|
|
}
|
|
|
|
|
2020-04-30 08:49:56 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Op templates
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-04-27 08:20:58 +08:00
|
|
|
class Numpy_Op<string mnemonic, list<OpTrait> traits = []> :
|
2020-04-29 11:32:49 +08:00
|
|
|
Op<Numpy_Dialect, mnemonic, traits> {
|
|
|
|
let parser = [{ return parse$cppClass(parser, &result); }];
|
|
|
|
let printer = [{ return print$cppClass(p, *this); }];
|
|
|
|
}
|
2020-04-27 08:20:58 +08:00
|
|
|
|
2020-04-30 09:20:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Dialect types
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def Numpy_AnyDtype : DialectType<Numpy_Dialect,
|
|
|
|
CPred<"$_self.isa<::mlir::NPCOMP::Numpy::AnyDtypeType>()">, "any dtype">,
|
2020-05-06 09:16:01 +08:00
|
|
|
BuildableType<"$_builder.getType<::mlir::NPCOMP::Numpy::AnyDtypeType>()"> {
|
2020-04-30 09:20:42 +08:00
|
|
|
let typeDescription = [{
|
|
|
|
Placeholder for an unknown dtype in a tensor.
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
2020-04-30 08:49:56 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Type predicates
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def Numpy_AnyArray : TensorOf<[AnyType]>;
|
|
|
|
|
2020-04-27 08:20:58 +08:00
|
|
|
#endif // NPCOMP_DIALECT_NUMPY_NUMPY_DIALECT
|