Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/mlir/mlirfront/tilinglinalg/dataflowmap/dmap/dmapmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "dmapdialect.cc.inc"
#include "dmapattr.cc.inc"
#include "dmaptype.cc.inc"
#include "dmapenums.cc.inc"

#include "dmapop.cc.inc"
//#undef GET_OP_LIST
Expand Down Expand Up @@ -119,10 +120,10 @@ void dmapmanager::createdmapfuncByDim(OpBuilder& builder, MLIRContext* ctx,Symbo
mlir::Type myDataHandleType = dmap::dmapdataType::get(ctx);
auto data = builder.create<create_data>(builder.getUnknownLoc(), myDataHandleType, shapettr, elementType);
mlir::Type pgeout = dmap::dmacoreenginegroupType::get(ctx);
auto peg = builder.create<create_core_engine_group>(builder.getUnknownLoc(), pgeout, 0, 4,"row");
auto peg = builder.create<create_core_engine_group>(builder.getUnknownLoc(), pgeout, 0, 4, "row");
mlir::Type ioout = dmap::dmapioenginetypeType::get(ctx);
auto io = builder.create<create_io_engine>(builder.getUnknownLoc(), ioout, 0,"SHIM");
auto memio = builder.create<create_io_engine>(builder.getUnknownLoc(), ioout, 0,"MEM");
auto io = builder.create<create_io_engine>(builder.getUnknownLoc(), ioout, 0, "SHIM");
auto memio = builder.create<create_io_engine>(builder.getUnknownLoc(), ioout, 0, "MEM");
//config port
auto ioconfigret = dmap::dmapioconfigType::get(ctx);
auto dataaccesspattern = dmap::dataaccesspatternAttr::get(ctx, builder.getStringAttr("SEND"), 16, 1, 1);
Expand Down Expand Up @@ -159,8 +160,15 @@ void dmapmanager::createdmapfuncByDim(OpBuilder& builder, MLIRContext* ctx,Symbo
if (opbymemio) {
auto memiorecvconfig = builder.create<configure_io_engine>(builder.getUnknownLoc(), ioconfigret, memio.getResult(),memreceivepattern);
auto memiosendconfig = builder.create<configure_io_engine>(builder.getUnknownLoc(), ioconfigret, memio.getResult(),memsndpattern);
auto streamhandle1 = builder.create<createstream>(builder.getUnknownLoc(), streamret, shimioconfig.getResult(),memiorecvconfig.getResult(),"SH2ME",0, 1);
auto streamhandle2 = builder.create<createstream>(builder.getUnknownLoc(), streamret, memiosendconfig.getResult(),gcmap.getResult(), "ME2CO", 0, 1);

auto shimToMemAttr = dmapioAttr::get(ctx, dmapio::DMAP_SHIMIO);
auto memToCoreAttr = dmapioAttr::get(ctx, dmapio::DMAP_MEMTILEIO);

auto groupIndexAttr = builder.getI32IntegerAttr(0);
auto streamIdAttr1 = builder.getI32IntegerAttr(1);

auto streamhandle1 = builder.create<createstream>(builder.getUnknownLoc(), streamret, shimioconfig.getResult(),memiorecvconfig.getResult(), shimToMemAttr, groupIndexAttr, streamIdAttr1);
auto streamhandle2 = builder.create<createstream>(builder.getUnknownLoc(), streamret, memiosendconfig.getResult(),gcmap.getResult(), memToCoreAttr, groupIndexAttr, streamIdAttr1);

// Create a chained stream from streamhandle1 and streamhandle2, then push once to the chained stream.
auto chainType = dmap::dmapportchainstreamType::get(ctx);
Expand All @@ -175,7 +183,12 @@ void dmapmanager::createdmapfuncByDim(OpBuilder& builder, MLIRContext* ctx,Symbo
auto pchain = builder.create<push>(builder.getUnknownLoc(), data.getResult(), chainStream);

} else {
auto streamhandle = builder.create<createstream>(builder.getUnknownLoc(), streamret, shimioconfig.getResult(),gcmap.getResult(),"SH2CO", 0, 1);
auto shimToCoreAttr = dmapioAttr::get(ctx, dmapio::DMAP_SHIMIO);

auto groupIndexAttr = builder.getI32IntegerAttr(0);
auto streamIdAttr = builder.getI32IntegerAttr(1);

auto streamhandle = builder.create<createstream>(builder.getUnknownLoc(), streamret, shimioconfig.getResult(),gcmap.getResult(), shimToCoreAttr, groupIndexAttr, streamIdAttr);
auto pret = builder.create<push>(builder.getUnknownLoc(), data.getResult(),streamhandle.getResult());
}
//push stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

#include "dmapdialect.h.inc"

#include "dmapenums.h.inc"

using namespace mlir;
using namespace dmap;

Expand All @@ -63,7 +65,7 @@ using namespace dmap;
#define GET_OP_DECLS
#include "dmapop.h.inc"
#undef GET_OP_DECLS
#undef GET_OP_CLASSEST
#undef GET_OP_CLASSES

class dmapmanager{
public:
Expand Down
2 changes: 2 additions & 0 deletions src/mlir/mlirfront/tilinglinalg/dataflowmap/dmap/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ ${LLVM_BIN}/mlir-tblgen -gen-typedef-defs $TD/dmaptype.td -typedefs-dialect=dmap
${LLVM_BIN}/mlir-tblgen -gen-typedef-decls $TD/dmaptype.td -typedefs-dialect=dmap -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} > $INC/dmaptype.h.inc
${LLVM_BIN}/mlir-tblgen --gen-attrdef-defs $TD/dmapattr.td -attrdefs-dialect=dmap -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} > $INC/dmapattr.cc.inc
${LLVM_BIN}/mlir-tblgen --gen-attrdef-decls $TD/dmapattr.td -attrdefs-dialect=dmap -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} > $INC/dmapattr.h.inc
${LLVM_BIN}/mlir-tblgen --gen-enum-decls $TD/dmapattr.td -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} > $INC/dmapenums.h.inc
${LLVM_BIN}/mlir-tblgen --gen-enum-defs $TD/dmapattr.td -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} > $INC/dmapenums.cc.inc

#${LLVM_BIN}/mlir-tblgen --gen-type-interface-defs $TD/dmamapterface.td -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} -o $INC/dmamapterface.cc.inc
#${LLVM_BIN}/mlir-tblgen --gen-type-interface-decls $TD/dmamapterface.td -I $TD -I $GEN_SCRIPT_DIR -I /usr/local/include ${MLIR_INCLUDES} -o $INC/dmamapterface.h.inc
Expand Down
14 changes: 5 additions & 9 deletions src/mlir/mlirfront/tilinglinalg/dataflowmap/dmap/td/dmapattr.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ class dmapattr<string name> : AttrDef<dmapdialect, name>{}
class dmaptype<string name, list<Trait> traits=[]> : TypeDef<dmapdialect, name,traits>{}
class dmapop<string name, list<Trait> traits=[]> : Op<dmapdialect, name, traits>{}

///*
def DMAP_SEND : I32EnumAttrCase<"DMAP_SEND", 0, "DMAP_SEND">;
def DMAP_RECEIVE : I32EnumAttrCase<"DMAP_RECEIVE", 1, "DMAP_RECEIVE">;
def dmapdirectionattr
: I32EnumAttr<"dmapdirection", "dmap direction", [
def dmapdirection : I32EnumAttr<"dmapdirection", "dmap direction", [
DMAP_SEND,
DMAP_RECEIVE]> {
let genSpecializedAttr = 0;
Expand All @@ -43,19 +41,17 @@ def dmapdirectionattr
def DMAP_SHIMIO : I32EnumAttrCase<"DMAP_SHIMIO", 0, "DMAP_SHIMIO">;
def DMAP_MEMTILEIO : I32EnumAttrCase<"DMAP_MEMTILEIO", 1, "DMAP_MEMTILEIO">;
def DMAP_CORETILEIO : I32EnumAttrCase<"DMAP_CORETILEIO", 2, "DMAP_CORETILEIO">;
def dmapio_enumattr
: I32EnumAttr<"dmapio", "dmap direction", [
def dmapio_enum : I32EnumAttr<"dmapio", "dmap direction", [
DMAP_SHIMIO,
DMAP_MEMTILEIO,
DMAP_CORETILEIO]> {
let genSpecializedAttr = 0;
let cppNamespace = "dmap";
}

//def dmapioAttr : EnumAttr<dmapdialect, dmapio_enum, "io"> {
// let assemblyFormat = "`<` $value `>`";
//}
//*/
def dmapioAttr : EnumAttr<dmapdialect, dmapio_enum, "io"> {
let assemblyFormat = "`<` $value `>`";
}

def dataaccesspattern : dmapattr<"dataaccesspattern"> {
let mnemonic = "dataaccesspattern";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef dmap_OPS
#define dmap_OPS
include "dmaptype.td"
include "dmapattr.td"
/*
%data = dataflowmap.create_data {type="i32", dim1=10, dim2 20}
%pegroup = dataflowmap.dmap_create_pe_group {group_idx = 1, pe_count=4, "row"}
Expand Down Expand Up @@ -175,7 +176,7 @@ def dmap_createstream : dmapop<"create_stream"> {
//dmapportorgroup:$source,
AnyTypeOf<[dmapioconfigtype, dmacoregroupconfigtype]>:$source,
AnyTypeOf<[dmapioconfigtype, dmacoregroupconfigtype]>:$destination,
StrAttr:$streamType,
dmapioAttr:$streamType,
I32Attr:$stream_group_index,
I32Attr:$stream_id
);
Expand Down