Files
concrete/compiler/lib/Dialect/SDFG/IR/SDFGDialect.cpp
Andi Drebes 9f3615513b feat(compiler): Add new dialect SDFG for static data flow graphs
This adds a new dialect called "SDFG" for data flow graphs. An SDFG
data flow graph is composed of a set of processes, connected through
data streams. Special streams allow for data to be injected into and
to be retrieved from the data flow graph.

The dialect is intended to be lowered to API calls that allow for
offloading of the graph on hardware accelerators.
2022-12-08 14:54:14 +01:00

59 lines
1.4 KiB
C++

// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// for license information.
#include "mlir/IR/Builders.h"
#include "concretelang/Dialect/SDFG/IR/SDFGDialect.h"
#include "concretelang/Dialect/SDFG/IR/SDFGOps.h"
#include "concretelang/Dialect/SDFG/IR/SDFGTypes.h"
using namespace mlir::concretelang::SDFG;
#define GET_TYPEDEF_CLASSES
#include "concretelang/Dialect/SDFG/IR/SDFGTypes.cpp.inc"
void SDFGDialect::initialize() {
addOperations<
#define GET_OP_LIST
#include "concretelang/Dialect/SDFG/IR/SDFGOps.cpp.inc"
>();
addTypes<
#define GET_TYPEDEF_LIST
#include "concretelang/Dialect/SDFG/IR/SDFGTypes.cpp.inc"
>();
addAttributes<
#define GET_ATTRDEF_LIST
#include "concretelang/Dialect/SDFG/IR/SDFGAttributes.cpp.inc"
>();
}
#define GET_ATTRDEF_CLASSES
#include "concretelang/Dialect/SDFG/IR/SDFGAttributes.cpp.inc"
#define GET_TYPEDEF_CLASSES
#include "concretelang/Dialect/SDFG/IR/SDFGDialect.cpp.inc"
void StreamType::print(mlir::AsmPrinter &p) const {
p << "<" << getElementType() << ">";
}
mlir::Type StreamType::parse(mlir::AsmParser &p) {
if (p.parseLess())
return mlir::Type();
mlir::Type t;
if (p.parseType(t))
return mlir::Type();
if (p.parseGreater())
return mlir::Type();
mlir::Location loc = p.getEncodedSourceLoc(p.getNameLoc());
return getChecked(loc, loc.getContext(), t);
}