[EmitHLSCpp] start of supporting scf ops; [scalehls-gen] start of benchmark generation
This commit is contained in:
parent
24cf815ee6
commit
2fb35bdc68
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "Dialect/HLSCpp/HLSCpp.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/SCF/SCF.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
|
||||
namespace mlir {
|
||||
|
@ -22,6 +23,9 @@ public:
|
|||
auto *thisCast = static_cast<ConcreteType *>(this);
|
||||
return TypeSwitch<Operation *, ResultType>(op)
|
||||
.template Case<
|
||||
// SCF statements.
|
||||
scf::ForOp, scf::IfOp, scf::ParallelOp, scf::ReduceOp,
|
||||
scf::ReduceReturnOp, scf::YieldOp,
|
||||
// Affine statements.
|
||||
AffineForOp, AffineIfOp, AffineParallelOp, AffineApplyOp,
|
||||
AffineMaxOp, AffineMinOp, AffineLoadOp, AffineStoreOp,
|
||||
|
@ -77,6 +81,14 @@ public:
|
|||
return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...); \
|
||||
}
|
||||
|
||||
// SCF statements.
|
||||
HANDLE(scf::ForOp);
|
||||
HANDLE(scf::IfOp);
|
||||
HANDLE(scf::ParallelOp);
|
||||
HANDLE(scf::ReduceOp);
|
||||
HANDLE(scf::ReduceReturnOp);
|
||||
HANDLE(scf::YieldOp);
|
||||
|
||||
// Affine statements.
|
||||
HANDLE(AffineForOp);
|
||||
HANDLE(AffineIfOp);
|
||||
|
|
|
@ -309,6 +309,14 @@ public:
|
|||
StmtVisitor(ModuleEmitter &emitter) : emitter(emitter) {}
|
||||
|
||||
using HLSCppVisitorBase::visitOp;
|
||||
/// SCF statements.
|
||||
bool visitOp(scf::ForOp) { return true; };
|
||||
bool visitOp(scf::IfOp) { return true; };
|
||||
bool visitOp(scf::ParallelOp) { return true; };
|
||||
bool visitOp(scf::ReduceOp) { return true; };
|
||||
bool visitOp(scf::ReduceReturnOp) { return true; };
|
||||
bool visitOp(scf::YieldOp) { return true; };
|
||||
|
||||
/// Affine statements.
|
||||
bool visitOp(AffineForOp op) { return emitter.emitAffineFor(&op), true; }
|
||||
bool visitOp(AffineIfOp op) { return emitter.emitAffineIf(&op), true; }
|
||||
|
|
Loading…
Reference in New Issue