[RefBackend] Rename RefBackend dialect to Refback

I now realize that VerboseCamelCase is not the best choice for dialect
directory/file names and C++ identifiers (take e.g. "Linalg", "Basicpy",
etc. as prior art here; not LinearAlgebra or BasicPython). If I had to
name the convention it seems to be "Shortword" (or of course just
acronym dialects like LLVM, SCF, etc.).

This rename also has the side benefit of differentiating RefBackend
directories, which now refer to the actual backend itself, from
Refback/Refbackrt, which are the dialects which happen to be used by
that backend.
pull/73/head
Sean Silva 2020-10-07 17:30:10 -07:00
parent bf99a82832
commit 7edb5f3641
26 changed files with 75 additions and 75 deletions

View File

@ -1,7 +1,7 @@
add_subdirectory(ATen)
add_subdirectory(Basicpy)
add_subdirectory(Numpy)
add_subdirectory(RefBackend)
add_subdirectory(Refback)
add_subdirectory(Refbackrt)
add_subdirectory(TCF)
add_subdirectory(TCP)

View File

@ -1 +0,0 @@
add_mlir_dialect(RefBackendOps refback)

View File

@ -0,0 +1 @@
add_mlir_dialect(RefbackOps refback)

View File

@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
#ifndef REFBACKEND_BASE
#define REFBACKEND_BASE
#ifndef REFBACK_BASE
#define REFBACK_BASE
include "mlir/IR/OpBase.td"
def RefBackend_Dialect : Dialect {
def Refback_Dialect : Dialect {
let name = "refback";
let cppNamespace = "::mlir::NPCOMP::refback";
let description = [{
@ -20,4 +20,4 @@ def RefBackend_Dialect : Dialect {
}
#endif // REFBACKEND_BASE
#endif // REFBACK_BASE

View File

@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
#ifndef NPCOMP_DIALECT_REFBACKEND_IR_REFBACKENDDIALECT_H
#define NPCOMP_DIALECT_REFBACKEND_IR_REFBACKENDDIALECT_H
#ifndef NPCOMP_DIALECT_REFBACK_IR_REFBACKDIALECT_H
#define NPCOMP_DIALECT_REFBACK_IR_REFBACKDIALECT_H
#include "mlir/IR/Dialect.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOpsDialect.h.inc"
#include "npcomp/Dialect/Refback/IR/RefbackOpsDialect.h.inc"
#endif // NPCOMP_DIALECT_REFBACKEND_IR_REFBACKENDDIALECT_H
#endif // NPCOMP_DIALECT_REFBACK_IR_REFBACKDIALECT_H

View File

@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef NPCOMP_DIALECT_REFBACKEND_IR_REFBACKENDOPS_H
#define NPCOMP_DIALECT_REFBACKEND_IR_REFBACKENDOPS_H
#ifndef NPCOMP_DIALECT_REFBACK_IR_REFBACKOPS_H
#define NPCOMP_DIALECT_REFBACK_IR_REFBACKOPS_H
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/IR/OpDefinition.h"
@ -17,6 +17,6 @@
#include "mlir/Interfaces/SideEffectInterfaces.h"
#define GET_OP_CLASSES
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h.inc"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h.inc"
#endif // NPCOMP_DIALECT_REFBACKEND_IR_REFBACKENDOPS_H
#endif // NPCOMP_DIALECT_REFBACK_IR_REFBACKOPS_H

View File

@ -6,21 +6,21 @@
//
//===----------------------------------------------------------------------===//
#ifndef REFBACKEND_OPS
#define REFBACKEND_OPS
#ifndef REFBACK_OPS
#define REFBACK_OPS
include "npcomp/Dialect/RefBackend/IR/RefBackendBase.td"
include "npcomp/Dialect/Refback/IR/RefbackBase.td"
include "mlir/Dialect/Shape/IR/ShapeBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/ControlFlowInterfaces.td"
include "mlir/IR/SymbolInterfaces.td"
class RefBackend_Op<string mnemonic, list<OpTrait> traits = []>
: Op<RefBackend_Dialect, mnemonic, traits> {
class Refback_Op<string mnemonic, list<OpTrait> traits = []>
: Op<Refback_Dialect, mnemonic, traits> {
}
def RefBackend_GlobalOp : RefBackend_Op<"global", [Symbol]> {
def Refback_GlobalOp : Refback_Op<"global", [Symbol]> {
let summary = "Represents a global variable";
let description = [{
Represents a global variable.
@ -38,11 +38,11 @@ def RefBackend_GlobalOp : RefBackend_Op<"global", [Symbol]> {
//===----------------------------------------------------------------------===//
// Ops related to tensor->memref conversion.
//===----------------------------------------------------------------------===//
// TODO: These ops probably belong in a "RefBackend on memrefs" dialect analogous
// TODO: These ops probably belong in a "Refback on memrefs" dialect analogous
// to `lmhlo`
// TODO: Use TypesMatchWith to verify this better.
def RefBackend_TensorToMemrefOp : RefBackend_Op<"tensor_to_memref", [NoSideEffect]> {
def Refback_TensorToMemrefOp : Refback_Op<"tensor_to_memref", [NoSideEffect]> {
let summary = "Converts a tensor to a memref";
let description = [{
This op is used to materialize conversions to allow incremental lowering of
@ -55,7 +55,7 @@ def RefBackend_TensorToMemrefOp : RefBackend_Op<"tensor_to_memref", [NoSideEffec
}
// TODO: Use TypesMatchWith to verify this better.
def RefBackend_MemrefToTensorOp : RefBackend_Op<"memref_to_tensor", [NoSideEffect]> {
def Refback_MemrefToTensorOp : Refback_Op<"memref_to_tensor", [NoSideEffect]> {
let summary = "Converts a memref to a tensor";
let description = [{
This op is used to materialize conversions to allow incremental lowering of
@ -66,7 +66,7 @@ def RefBackend_MemrefToTensorOp : RefBackend_Op<"memref_to_tensor", [NoSideEffec
let assemblyFormat = "attr-dict $memref `:` type($memref) `->` type($tensor)";
}
def RefBackend_AllocMemRefOp : RefBackend_Op<"alloc_memref", []> {
def Refback_AllocMemRefOp : Refback_Op<"alloc_memref", []> {
let summary = "Allocates a memref of the given shape.";
let description = [{
Allocates a memref of the given shape.
@ -79,7 +79,7 @@ def RefBackend_AllocMemRefOp : RefBackend_Op<"alloc_memref", []> {
let assemblyFormat = "$shape attr-dict `:` type($memref)";
}
def RefBackend_GetGlobalMemrefOp : RefBackend_Op<"get_global_memref"> {
def Refback_GetGlobalMemrefOp : Refback_Op<"get_global_memref"> {
let summary = "Obtain a memref pointing at the given global";
let description = [{
Obtain a memref pointing at the given global.
@ -95,7 +95,7 @@ def RefBackend_GetGlobalMemrefOp : RefBackend_Op<"get_global_memref"> {
//===----------------------------------------------------------------------===//
// TODO: These belong in a shape-related dialect.
def RefBackend_ShapedResultsOp : RefBackend_Op<"shaped_results", [
def Refback_ShapedResultsOp : Refback_Op<"shaped_results", [
DeclareOpInterfaceMethods<RegionBranchOpInterface>,
SingleBlockImplicitTerminator<"YieldOp">,
RecursiveSideEffects,
@ -136,12 +136,12 @@ def RefBackend_ShapedResultsOp : RefBackend_Op<"shaped_results", [
let parser = [{ return ::parse$cppClass(parser, result); }];
}
def RefBackend_YieldOp : RefBackend_Op<"yield", [NoSideEffect, ReturnLike, Terminator,
def Refback_YieldOp : Refback_Op<"yield", [NoSideEffect, ReturnLike, Terminator,
ParentOneOf<["ShapedResultsOp"]>]> {
let summary = "Yield-like terminator for RefBackend dialect";
let summary = "Yield-like terminator for Refback dialect";
let description = "See scf.yield";
let arguments = (ins Variadic<AnyType>:$operands);
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
}
#endif // REFBACKEND_OPS
#endif // REFBACK_OPS

View File

@ -39,7 +39,7 @@ add_mlir_library(NPCOMPInitAll
PUBLIC
# Local depends
NPCOMPRefBackend
NPCOMPRefBackendDialect
NPCOMPRefbackDialect
NPCOMPTCPDialect
NPCOMPTCFDialect
NPCOMPTorchDialect

View File

@ -1,7 +1,7 @@
add_subdirectory(ATen)
add_subdirectory(Basicpy)
add_subdirectory(Numpy)
add_subdirectory(RefBackend)
add_subdirectory(Refback)
add_subdirectory(Refbackrt)
add_subdirectory(TCF)
add_subdirectory(TCP)

View File

@ -1,19 +0,0 @@
add_mlir_dialect_library(NPCOMPRefBackendDialect
RefBackendDialect.cpp
RefBackendOps.cpp
ADDITIONAL_HEADER_DIRS
${PROJECT_SOURCE_DIR}/include/npcomp/Dialect/RefBackend
DEPENDS
MLIRRefBackendOpsIncGen
LINK_COMPONENTS
Core
LINK_LIBS PUBLIC
MLIRIR
MLIRSupport
MLIRSideEffectInterfaces
MLIRShape
)

View File

@ -0,0 +1,19 @@
add_mlir_dialect_library(NPCOMPRefbackDialect
RefbackDialect.cpp
RefbackOps.cpp
ADDITIONAL_HEADER_DIRS
${PROJECT_SOURCE_DIR}/include/npcomp/Dialect/Refback
DEPENDS
MLIRRefbackOpsIncGen
LINK_COMPONENTS
Core
LINK_LIBS PUBLIC
MLIRIR
MLIRSupport
MLIRSideEffectInterfaces
MLIRShape
)

View File

@ -6,19 +6,19 @@
//
//===----------------------------------------------------------------------===//
#include "npcomp/Dialect/RefBackend/IR/RefBackendDialect.h"
#include "npcomp/Dialect/Refback/IR/RefbackDialect.h"
#include "mlir/Transforms/InliningUtils.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
using namespace mlir;
using namespace mlir::NPCOMP::refback;
//===----------------------------------------------------------------------===//
// RefBackendDialect Dialect Interfaces
// RefbackDialect Dialect Interfaces
//===----------------------------------------------------------------------===//
namespace {
struct RefBackendInlinerInterface : public DialectInlinerInterface {
struct RefbackInlinerInterface : public DialectInlinerInterface {
using DialectInlinerInterface::DialectInlinerInterface;
bool isLegalToInline(Region *dest, Region *src,
BlockAndValueMapping &valueMapping) const final {
@ -41,10 +41,10 @@ struct RefBackendInlinerInterface : public DialectInlinerInterface {
};
} // end anonymous namespace
void RefBackendDialect::initialize() {
void RefbackDialect::initialize() {
addOperations<
#define GET_OP_LIST
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.cpp.inc"
#include "npcomp/Dialect/Refback/IR/RefbackOps.cpp.inc"
>();
addInterfaces<RefBackendInlinerInterface>();
addInterfaces<RefbackInlinerInterface>();
}

View File

@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/IR/TypeUtilities.h"
#include "llvm/ADT/STLExtras.h"
@ -123,4 +123,4 @@ static LogicalResult verifyGetGlobalMemrefOp(GetGlobalMemrefOp op) {
}
#define GET_OP_CLASSES
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.cpp.inc"
#include "npcomp/Dialect/Refback/IR/RefbackOps.cpp.inc"

View File

@ -12,10 +12,10 @@
#include "npcomp/Dialect/ATen/ATenPasses.h"
#include "npcomp/Dialect/Basicpy/IR/BasicpyDialect.h"
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h"
#include "npcomp/Dialect/Refbackrt/IR/RefbackrtDialect.h"
#include "npcomp/Dialect/Numpy/IR/NumpyDialect.h"
#include "npcomp/Dialect/Numpy/Transforms/Passes.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendDialect.h"
#include "npcomp/Dialect/Refback/IR/RefbackDialect.h"
#include "npcomp/Dialect/Refbackrt/IR/RefbackrtDialect.h"
#include "npcomp/Dialect/TCF/IR/TCFDialect.h"
#include "npcomp/Dialect/TCF/Transforms/Passes.h"
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
@ -74,7 +74,7 @@ void mlir::NPCOMP::registerAllDialects(mlir::DialectRegistry &registry) {
Basicpy::BasicpyDialect,
Numpy::NumpyDialect,
refbackrt::RefbackrtDialect,
refback::RefBackendDialect,
refback::RefbackDialect,
tcf::TCFDialect,
tcp::TCPDialect,
mlir::NPCOMP::Torch::TorchDialect>();

View File

@ -10,8 +10,8 @@
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendDialect.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackDialect.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
#include "npcomp/Dialect/TCP/IR/TCPOps.h"
#include "npcomp/RefBackend/RefBackend.h"
@ -49,7 +49,7 @@ namespace {
// to be lowered by LowerShapedResults.
class BypassShapes : public BypassShapesBase<BypassShapes> {
void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<shape::ShapeDialect, refback::RefBackendDialect>();
registry.insert<shape::ShapeDialect, refback::RefbackDialect>();
}
void runOnOperation() override {

View File

@ -14,9 +14,9 @@
#include "mlir/IR/Verifier.h"
#include "mlir/Transforms/DialectConversion.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
#include "npcomp/Dialect/Refbackrt/IR/RefbackrtDialect.h"
#include "npcomp/Dialect/Refbackrt/IR/RefbackrtOps.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
using namespace mlir;
using namespace mlir::NPCOMP;

View File

@ -27,7 +27,7 @@
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
#include "npcomp/Conversion/TCFToTCP/TCFToTCP.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
#include "npcomp/Dialect/TCP/IR/TCPOps.h"

View File

@ -17,8 +17,8 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/DialectConversion.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendDialect.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackDialect.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
using namespace mlir;
using namespace mlir::NPCOMP;
@ -81,7 +81,7 @@ namespace {
class LowerConstantTensorsToMemref
: public LowerConstantTensorsToMemrefBase<LowerConstantTensorsToMemref> {
void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<refback::RefBackendDialect>();
registry.insert<refback::RefbackDialect>();
}
void runOnOperation() override {

View File

@ -19,7 +19,7 @@
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/InliningUtils.h"
#include "npcomp/Conversion/TCFToTCP/TCFToTCP.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
#include "npcomp/Dialect/TCP/IR/TCPOps.h"

View File

@ -13,8 +13,8 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/DialectConversion.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendDialect.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackDialect.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
using namespace mlir;
using namespace mlir::NPCOMP;
@ -88,7 +88,7 @@ namespace {
// TODO: Upstream this.
class LowerStdToMemref : public LowerStdToMemrefBase<LowerStdToMemref> {
void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<refback::RefBackendDialect>();
registry.insert<refback::RefbackDialect>();
}
void runOnOperation() override {

View File

@ -14,7 +14,7 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/DialectConversion.h"
#include "npcomp/Dialect/RefBackend/IR/RefBackendOps.h"
#include "npcomp/Dialect/Refback/IR/RefbackOps.h"
using namespace mlir;
using namespace mlir::NPCOMP;