[HLS] Rename from HLSCpp dialect to HLS dialect

This commit is contained in:
Hanchen Ye 2022-03-28 16:13:42 -05:00
parent 7fc9c9c7f7
commit 780e711c9f
76 changed files with 461 additions and 464 deletions

View File

@ -4,8 +4,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SCALEHLS_C_DIALECT_HLSCPP_H #ifndef SCALEHLS_C_DIALECT_HLS_H
#define SCALEHLS_C_DIALECT_HLSCPP_H #define SCALEHLS_C_DIALECT_HLS_H
#include "mlir-c/Registration.h" #include "mlir-c/Registration.h"
@ -13,10 +13,10 @@
extern "C" { extern "C" {
#endif #endif
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(HLSCpp, hlscpp); MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(HLS, hls);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // SCALEHLS_C_DIALECT_HLSCPP_H #endif // SCALEHLS_C_DIALECT_HLS_H

View File

@ -1 +1 @@
add_subdirectory(HLSCpp) add_subdirectory(HLS)

View File

@ -4,10 +4,10 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLSCPP_ATTRIBUTES_TD #ifndef SCALEHLS_DIALECT_HLS_ATTRIBUTES_TD
#define SCALEHLS_DIALECT_HLSCPP_ATTRIBUTES_TD #define SCALEHLS_DIALECT_HLS_ATTRIBUTES_TD
def Resource : HLSCppAttr<"Resource"> { def Resource : HLSAttr<"Resource"> {
let summary = "Resource utilization information"; let summary = "Resource utilization information";
let description = [{ let description = [{
This attribute includes the utilization of several important on-chip This attribute includes the utilization of several important on-chip
@ -22,7 +22,7 @@ def Resource : HLSCppAttr<"Resource"> {
); );
} }
def Timing : HLSCppAttr<"Timing"> { def Timing : HLSAttr<"Timing"> {
let summary = "Timing information"; let summary = "Timing information";
let description = [{ let description = [{
This attribute indicates the timing of operations, including scheduling This attribute indicates the timing of operations, including scheduling
@ -38,7 +38,7 @@ def Timing : HLSCppAttr<"Timing"> {
); );
} }
def LoopInfo : HLSCppAttr<"LoopInfo"> { def LoopInfo : HLSAttr<"LoopInfo"> {
let summary = "Loop information"; let summary = "Loop information";
let description = [{ let description = [{
This attribute includes loop information used by estimator and optimizer, This attribute includes loop information used by estimator and optimizer,
@ -54,7 +54,7 @@ def LoopInfo : HLSCppAttr<"LoopInfo"> {
); );
} }
def LoopDirective : HLSCppAttr<"LoopDirective"> { def LoopDirective : HLSAttr<"LoopDirective"> {
let summary = "Aggregation of loop directives"; let summary = "Aggregation of loop directives";
let description = [{ let description = [{
This attribute includes all loop directives, including loop pipelining, This attribute includes all loop directives, including loop pipelining,
@ -70,7 +70,7 @@ def LoopDirective : HLSCppAttr<"LoopDirective"> {
); );
} }
def FuncDirective : HLSCppAttr<"FuncDirective"> { def FuncDirective : HLSAttr<"FuncDirective"> {
let summary = "Aggregation of function directives"; let summary = "Aggregation of function directives";
let description = [{ let description = [{
This attribute includes all function directives, including function This attribute includes all function directives, including function
@ -85,4 +85,4 @@ def FuncDirective : HLSCppAttr<"FuncDirective"> {
); );
} }
#endif // SCALEHLS_DIALECT_HLSCPP_ATTRIBUTES_TD #endif // SCALEHLS_DIALECT_HLS_ATTRIBUTES_TD

View File

@ -0,0 +1,11 @@
add_mlir_dialect(HLS hls)
set(LLVM_TARGET_DEFINITIONS HLS.td)
mlir_tablegen(HLSEnums.h.inc -gen-enum-decls)
mlir_tablegen(HLSEnums.cpp.inc -gen-enum-defs)
add_public_tablegen_target(MLIRHLSEnumsIncGen)
set(LLVM_TARGET_DEFINITIONS HLS.td)
mlir_tablegen(HLSAttributes.h.inc -gen-attrdef-decls)
mlir_tablegen(HLSAttributes.cpp.inc -gen-attrdef-defs)
add_public_tablegen_target(MLIRHLSAttributesIncGen)

View File

@ -4,25 +4,25 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLSCPP_HLSCPP_H #ifndef SCALEHLS_DIALECT_HLS_HLS_H
#define SCALEHLS_DIALECT_HLSCPP_HLSCPP_H #define SCALEHLS_DIALECT_HLS_HLS_H
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"
#include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpDefinition.h"
#include "mlir/Interfaces/SideEffectInterfaces.h" #include "mlir/Interfaces/SideEffectInterfaces.h"
#include "scalehls/Dialect/HLSCpp/HLSCppDialect.h.inc" #include "scalehls/Dialect/HLS/HLSDialect.h.inc"
#include "scalehls/Dialect/HLSCpp/HLSCppEnums.h.inc" #include "scalehls/Dialect/HLS/HLSEnums.h.inc"
#define GET_TYPEDEF_CLASSES #define GET_TYPEDEF_CLASSES
#include "scalehls/Dialect/HLSCpp/HLSCppTypes.h.inc" #include "scalehls/Dialect/HLS/HLSTypes.h.inc"
#define GET_ATTRDEF_CLASSES #define GET_ATTRDEF_CLASSES
#include "scalehls/Dialect/HLSCpp/HLSCppAttributes.h.inc" #include "scalehls/Dialect/HLS/HLSAttributes.h.inc"
namespace mlir { namespace mlir {
namespace scalehls { namespace scalehls {
namespace hlscpp { namespace hls {
enum class MemoryKind { BRAM_S2P = 0, BRAM_T2P = 1, BRAM_1P = 2, DRAM = 3 }; enum class MemoryKind { BRAM_S2P = 0, BRAM_T2P = 1, BRAM_1P = 2, DRAM = 3 };
enum class PartitionKind { CYCLIC = 0, BLOCK = 1, NONE = 2 }; enum class PartitionKind { CYCLIC = 0, BLOCK = 1, NONE = 2 };
@ -74,7 +74,7 @@ void setTopFuncAttr(Operation *op);
bool hasRuntimeAttr(Operation *op); bool hasRuntimeAttr(Operation *op);
void setRuntimeAttr(Operation *op); void setRuntimeAttr(Operation *op);
} // namespace hlscpp } // namespace hls
} // namespace scalehls } // namespace scalehls
} // namespace mlir } // namespace mlir
@ -86,7 +86,7 @@ class DeclaresStreamChannel
public: public:
static LogicalResult verifyTrait(Operation *op) { static LogicalResult verifyTrait(Operation *op) {
if (op->getNumResults() != 1 || if (op->getNumResults() != 1 ||
!op->getResult(0).getType().isa<scalehls::hlscpp::StreamType>()) !op->getResult(0).getType().isa<scalehls::hls::StreamType>())
return failure(); return failure();
return success(); return success();
} }
@ -94,8 +94,8 @@ public:
/// Get all users of the channel. /// Get all users of the channel.
SmallVector<Operation *, 2> getChannelUsers() { SmallVector<Operation *, 2> getChannelUsers() {
SmallVector<Operation *, 2> users; SmallVector<Operation *, 2> users;
scalehls::hlscpp::getStreamChannelUsers(this->getOperation()->getResult(0), scalehls::hls::getStreamChannelUsers(this->getOperation()->getResult(0),
users); users);
return users; return users;
} }
}; };
@ -103,6 +103,6 @@ public:
} // namespace mlir } // namespace mlir
#define GET_OP_CLASSES #define GET_OP_CLASSES
#include "scalehls/Dialect/HLSCpp/HLSCpp.h.inc" #include "scalehls/Dialect/HLS/HLS.h.inc"
#endif // SCALEHLS_DIALECT_HLSCPP_HLSCPP_H #endif // SCALEHLS_DIALECT_HLS_HLS_H

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// Copyright 2020-2021 The ScaleHLS Authors.
//
//===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLS_HLS_TD
#define SCALEHLS_DIALECT_HLS_HLS_TD
include "mlir/IR/OpBase.td"
def HLSDialect : Dialect {
let name = "hls";
let summary = "An HLS out-of-tree MLIR dialect";
let description = [{
This dialect contains dedicated operations, types, and attributes designed
for representing HLS C++ specific structures and components in MLIR, while
enabling comprehensive optimization for both performance and area.
}];
let cppNamespace = "::mlir::scalehls::hls";
}
class HLSType<string name> : TypeDef<HLSDialect, name>;
class HLSAttr<string name> : AttrDef<HLSDialect, name>;
class HLSOp<string mnemonic, list<Trait> traits = []> :
Op<HLSDialect, mnemonic, traits>;
include "scalehls/Dialect/HLS/Types.td"
include "scalehls/Dialect/HLS/Attributes.td"
include "scalehls/Dialect/HLS/Ops.td"
#endif // SCALEHLS_DIALECT_HLS_HLS_TD

View File

@ -4,8 +4,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLSCPP_OPS_TD #ifndef SCALEHLS_DIALECT_HLS_OPS_TD
#define SCALEHLS_DIALECT_HLSCPP_OPS_TD #define SCALEHLS_DIALECT_HLS_OPS_TD
include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Interfaces/SideEffectInterfaces.td"
@ -13,7 +13,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
// Dataflow Operations // Dataflow Operations
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
def DataflowNodeOp : HLSCppOp<"dataflow.node", def DataflowNodeOp : HLSOp<"dataflow.node",
[SingleBlockImplicitTerminator<"DataflowOutputOp">]> { [SingleBlockImplicitTerminator<"DataflowOutputOp">]> {
let summary = "Dataflow node operation"; let summary = "Dataflow node operation";
let description = [{ let description = [{
@ -29,7 +29,7 @@ def DataflowNodeOp : HLSCppOp<"dataflow.node",
let extraClassDeclaration = [{ DataflowOutputOp getOutputOp(); }]; let extraClassDeclaration = [{ DataflowOutputOp getOutputOp(); }];
} }
def DataflowOutputOp : HLSCppOp<"dataflow.output", def DataflowOutputOp : HLSOp<"dataflow.output",
[Terminator, HasParent<"DataflowNodeOp">]> { [Terminator, HasParent<"DataflowNodeOp">]> {
let summary = "Output operation of a dataflow node"; let summary = "Output operation of a dataflow node";
let description = [{ let description = [{
@ -43,7 +43,7 @@ def DataflowOutputOp : HLSCppOp<"dataflow.output",
let builders = [ OpBuilder<(ins), "build($_builder, $_state, Value());"> ]; let builders = [ OpBuilder<(ins), "build($_builder, $_state, Value());"> ];
} }
def DataflowSourceOp : HLSCppOp<"dataflow.source"> { def DataflowSourceOp : HLSOp<"dataflow.source"> {
let summary = "Dataflow source operation"; let summary = "Dataflow source operation";
let description = [{ let description = [{
The operation represents the source of a dataflow value. The operation represents the source of a dataflow value.
@ -52,7 +52,7 @@ def DataflowSourceOp : HLSCppOp<"dataflow.source"> {
let results = (outs AnyType:$output); let results = (outs AnyType:$output);
} }
def DataflowSinkOp : HLSCppOp<"dataflow.sink"> { def DataflowSinkOp : HLSOp<"dataflow.sink"> {
let summary = "Dataflow sink operation"; let summary = "Dataflow sink operation";
let description = [{ let description = [{
The operation represents the sink of a dataflow value. The operation represents the sink of a dataflow value.
@ -61,7 +61,7 @@ def DataflowSinkOp : HLSCppOp<"dataflow.sink"> {
let arguments = (ins AnyType:$input); let arguments = (ins AnyType:$input);
} }
def DataflowBufferOp : HLSCppOp<"dataflow.buffer", def DataflowBufferOp : HLSOp<"dataflow.buffer",
[SameOperandsAndResultElementType]> { [SameOperandsAndResultElementType]> {
let summary = "Dataflow buffer operation"; let summary = "Dataflow buffer operation";
let description = [{ let description = [{
@ -79,20 +79,20 @@ def DataflowBufferOp : HLSCppOp<"dataflow.buffer",
def DeclaresStreamChannel : NativeOpTrait<"DeclaresStreamChannel">; def DeclaresStreamChannel : NativeOpTrait<"DeclaresStreamChannel">;
class StreamOf<list<Type> allowedTypes> : Type<And<[ class StreamOf<list<Type> allowedTypes> : Type<And<[
CPred<"$_self.isa<::mlir::scalehls::hlscpp::StreamType>()">, CPred<"$_self.isa<::mlir::scalehls::hls::StreamType>()">,
Concat<"[](::mlir::Type elementType) { return ", Concat<"[](::mlir::Type elementType) { return ",
SubstLeaves<"$_self", "elementType", AnyTypeOf<allowedTypes>.predicate>, SubstLeaves<"$_self", "elementType", AnyTypeOf<allowedTypes>.predicate>,
"; }($_self.cast<::mlir::scalehls::hlscpp::StreamType>().getElementType())"> "; }($_self.cast<::mlir::scalehls::hls::StreamType>().getElementType())">
]>>; ]>>;
def StreamChannelOp : HLSCppOp<"stream.channel", [DeclaresStreamChannel]> { def StreamChannelOp : HLSOp<"stream.channel", [DeclaresStreamChannel]> {
let summary = "Stream channel declaration operation"; let summary = "Stream channel declaration operation";
let hasVerifier = 1; let hasVerifier = 1;
let results = (outs StreamOf<[AnyType]>:$channel); let results = (outs StreamOf<[AnyType]>:$channel);
} }
def StreamReadOp : HLSCppOp<"stream.read"> { def StreamReadOp : HLSOp<"stream.read"> {
let summary = "Stream channel read operation"; let summary = "Stream channel read operation";
let description = [{ let description = [{
Read/pop a value from a stream channel. The absence of the result indicates Read/pop a value from a stream channel. The absence of the result indicates
@ -104,7 +104,7 @@ def StreamReadOp : HLSCppOp<"stream.read"> {
let results = (outs Optional<AnyType>:$result); let results = (outs Optional<AnyType>:$result);
} }
def StreamWriteOp : HLSCppOp<"stream.write"> { def StreamWriteOp : HLSOp<"stream.write"> {
let summary = "Stream channel write operation"; let summary = "Stream channel write operation";
let description = [{ let description = [{
Write/push a value to a stream channel. Each stream channel can only be Write/push a value to a stream channel. Each stream channel can only be
@ -115,7 +115,7 @@ def StreamWriteOp : HLSCppOp<"stream.write"> {
let arguments = (ins StreamOf<[AnyType]>:$channel, AnyType:$value); let arguments = (ins StreamOf<[AnyType]>:$channel, AnyType:$value);
} }
def StreamBufferOp : HLSCppOp<"stream.buffer", [DeclaresStreamChannel]> { def StreamBufferOp : HLSOp<"stream.buffer", [DeclaresStreamChannel]> {
let summary = "Stream channel buffer operation"; let summary = "Stream channel buffer operation";
let hasVerifier = 1; let hasVerifier = 1;
@ -127,7 +127,7 @@ def StreamBufferOp : HLSCppOp<"stream.buffer", [DeclaresStreamChannel]> {
// Primitive Operations // Primitive Operations
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
def PrimMulOp : HLSCppOp<"prim.mul", [NoSideEffect]> { def PrimMulOp : HLSOp<"prim.mul", [NoSideEffect]> {
let summary = "Multiplication primitive operation"; let summary = "Multiplication primitive operation";
let description = [{ let description = [{
This primitive performs C = A * B, where A and B are 8-bits integers, while This primitive performs C = A * B, where A and B are 8-bits integers, while
@ -153,7 +153,7 @@ def PrimMulOp : HLSCppOp<"prim.mul", [NoSideEffect]> {
let extraClassDeclaration = [{ bool isPackMul(); }]; let extraClassDeclaration = [{ bool isPackMul(); }];
} }
def PrimCastOp : HLSCppOp<"prim.cast", def PrimCastOp : HLSOp<"prim.cast",
[SameOperandsAndResultShape, NoSideEffect]> { [SameOperandsAndResultShape, NoSideEffect]> {
let summary = "Cast primitive operation"; let summary = "Cast primitive operation";
@ -168,7 +168,7 @@ def PrimCastOp : HLSCppOp<"prim.cast",
); );
} }
def BufferOp : HLSCppOp<"buffer", def BufferOp : HLSOp<"buffer",
[SameOperandsAndResultElementType, NoSideEffect]> { [SameOperandsAndResultElementType, NoSideEffect]> {
let summary = "Buffer the input value"; let summary = "Buffer the input value";
@ -177,4 +177,4 @@ def BufferOp : HLSCppOp<"buffer",
let results = (outs AnyType:$output); let results = (outs AnyType:$output);
} }
#endif // SCALEHLS_DIALECT_HLSCPP_OPS_TD #endif // SCALEHLS_DIALECT_HLS_OPS_TD

View File

@ -4,11 +4,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLSCPP_TYPES_TD #ifndef SCALEHLS_DIALECT_HLS_TYPES_TD
#define SCALEHLS_DIALECT_HLSCPP_TYPES_TD #define SCALEHLS_DIALECT_HLS_TYPES_TD
def StreamType : HLSCppType<"Stream"> { def StreamType : HLSType<"Stream"> {
let summary = "An HLSCpp stream type"; let summary = "An HLS stream type";
let description = [{ let description = [{
Represents a stream of any type that can be transfered between HLS modules. Represents a stream of any type that can be transfered between HLS modules.
This type is equal to the hls::stream<> type in Xilinx Vivado HLS. This type is equal to the hls::stream<> type in Xilinx Vivado HLS.
@ -23,4 +23,4 @@ def StreamType : HLSCppType<"Stream"> {
let assemblyFormat = "`<` qualified($elementType) `,` $depth `>`"; let assemblyFormat = "`<` qualified($elementType) `,` $depth `>`";
} }
#endif // SCALEHLS_DIALECT_HLSCPP_TYPES_TD #endif // SCALEHLS_DIALECT_HLS_TYPES_TD

View File

@ -4,8 +4,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLSCPP_VISITOR_H #ifndef SCALEHLS_DIALECT_HLS_VISITOR_H
#define SCALEHLS_DIALECT_HLSCPP_VISITOR_H #define SCALEHLS_DIALECT_HLS_VISITOR_H
#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
@ -16,17 +16,17 @@
#include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h" #include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "llvm/ADT/TypeSwitch.h" #include "llvm/ADT/TypeSwitch.h"
namespace mlir { namespace mlir {
namespace scalehls { namespace scalehls {
using namespace hlscpp; using namespace hls;
/// This class is a visitor for SSACFG operation nodes. /// This class is a visitor for SSACFG operation nodes.
template <typename ConcreteType, typename ResultType, typename... ExtraArgs> template <typename ConcreteType, typename ResultType, typename... ExtraArgs>
class HLSCppVisitorBase { class HLSVisitorBase {
public: public:
ResultType dispatchVisitor(Operation *op, ExtraArgs... args) { ResultType dispatchVisitor(Operation *op, ExtraArgs... args) {
auto *thisCast = static_cast<ConcreteType *>(this); auto *thisCast = static_cast<ConcreteType *>(this);
@ -52,7 +52,7 @@ public:
memref::ExpandShapeOp, memref::ReinterpretCastOp, memref::ExpandShapeOp, memref::ReinterpretCastOp,
bufferization::ToMemrefOp, bufferization::ToTensorOp, bufferization::ToMemrefOp, bufferization::ToTensorOp,
// HLSCpp dialect operations. // HLS dialect operations.
StreamChannelOp, StreamReadOp, StreamWriteOp, PrimMulOp, PrimCastOp, StreamChannelOp, StreamReadOp, StreamWriteOp, PrimMulOp, PrimCastOp,
BufferOp, BufferOp,
@ -146,7 +146,7 @@ public:
HANDLE(bufferization::ToMemrefOp); HANDLE(bufferization::ToMemrefOp);
HANDLE(bufferization::ToTensorOp); HANDLE(bufferization::ToTensorOp);
// HLSCpp dialect operations. // HLS dialect operations.
HANDLE(StreamChannelOp); HANDLE(StreamChannelOp);
HANDLE(StreamReadOp); HANDLE(StreamReadOp);
HANDLE(StreamWriteOp); HANDLE(StreamWriteOp);
@ -221,4 +221,4 @@ public:
} // namespace scalehls } // namespace scalehls
} // namespace mlir } // namespace mlir
#endif // SCALEHLS_DIALECT_HLSCPP_VISITOR_H #endif // SCALEHLS_DIALECT_HLS_VISITOR_H

View File

@ -1,11 +0,0 @@
add_mlir_dialect(HLSCpp hlscpp)
set(LLVM_TARGET_DEFINITIONS HLSCpp.td)
mlir_tablegen(HLSCppEnums.h.inc -gen-enum-decls)
mlir_tablegen(HLSCppEnums.cpp.inc -gen-enum-defs)
add_public_tablegen_target(MLIRHLSCppEnumsIncGen)
set(LLVM_TARGET_DEFINITIONS HLSCpp.td)
mlir_tablegen(HLSCppAttributes.h.inc -gen-attrdef-decls)
mlir_tablegen(HLSCppAttributes.cpp.inc -gen-attrdef-defs)
add_public_tablegen_target(MLIRHLSCppAttributesIncGen)

View File

@ -1,34 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Copyright 2020-2021 The ScaleHLS Authors.
//
//===----------------------------------------------------------------------===//
#ifndef SCALEHLS_DIALECT_HLSCPP_HLSCPP_TD
#define SCALEHLS_DIALECT_HLSCPP_HLSCPP_TD
include "mlir/IR/OpBase.td"
def HLSCppDialect : Dialect {
let name = "hlscpp";
let summary = "An HLSCpp out-of-tree MLIR dialect";
let description = [{
This dialect contains dedicated operations, types, and attributes designed
for representing HLS C++ specific structures and components in MLIR, while
enabling comprehensive optimization for both performance and area.
}];
let cppNamespace = "::mlir::scalehls::hlscpp";
}
class HLSCppType<string name> : TypeDef<HLSCppDialect, name>;
class HLSCppAttr<string name> : AttrDef<HLSCppDialect, name>;
class HLSCppOp<string mnemonic, list<Trait> traits = []> :
Op<HLSCppDialect, mnemonic, traits>;
include "scalehls/Dialect/HLSCpp/Types.td"
include "scalehls/Dialect/HLSCpp/Attributes.td"
include "scalehls/Dialect/HLSCpp/Ops.td"
#endif // SCALEHLS_DIALECT_HLSCPP_HLSCPP_TD

View File

@ -19,7 +19,7 @@
#include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h" #include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
namespace mlir { namespace mlir {
namespace scalehls { namespace scalehls {
@ -38,7 +38,7 @@ inline void registerAllDialects(mlir::DialectRegistry &registry) {
mlir::arith::ArithmeticDialect, mlir::arith::ArithmeticDialect,
mlir::vector::VectorDialect, mlir::vector::VectorDialect,
mlir::scf::SCFDialect, mlir::scf::SCFDialect,
mlir::scalehls::hlscpp::HLSCppDialect, mlir::scalehls::hls::HLSDialect,
mlir::LLVM::LLVMDialect, mlir::LLVM::LLVMDialect,
mlir::DLTIDialect mlir::DLTIDialect
>(); >();

View File

@ -10,7 +10,7 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h" #include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/IR/BuiltinOps.h" #include "mlir/IR/BuiltinOps.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
namespace mlir { namespace mlir {
namespace scalehls { namespace scalehls {

View File

@ -75,7 +75,7 @@ std::unique_ptr<Pass> createReduceInitialIntervalPass();
std::unique_ptr<Pass> createFuncPipeliningPass(); std::unique_ptr<Pass> createFuncPipeliningPass();
std::unique_ptr<Pass> createLoopPipeliningPass(); std::unique_ptr<Pass> createLoopPipeliningPass();
std::unique_ptr<Pass> createArrayPartitionPass(); std::unique_ptr<Pass> createArrayPartitionPass();
std::unique_ptr<Pass> createCreateHLSCppPrimitivePass(); std::unique_ptr<Pass> createCreateHLSPrimitivePass();
#define GEN_PASS_CLASSES #define GEN_PASS_CLASSES
#include "scalehls/Transforms/Passes.h.inc" #include "scalehls/Transforms/Passes.h.inc"

View File

@ -359,14 +359,14 @@ def ArrayPartition : Pass<"scalehls-array-partition", "ModuleOp"> {
let constructor = "mlir::scalehls::createArrayPartitionPass()"; let constructor = "mlir::scalehls::createArrayPartitionPass()";
} }
def CreateHLSCppPrimitive : Pass<"scalehls-create-hlscpp-primitive", "FuncOp"> { def CreateHLSPrimitive : Pass<"scalehls-create-hls-primitive", "FuncOp"> {
let summary = "Create HLS C++ multiplification primitives"; let summary = "Create HLS C++ multiplification primitives";
let description = [{ let description = [{
This create-hlscpp-primitive pass will convert 8-bits multiplifications to This create-hls-primitive pass will convert 8-bits multiplifications to HLS
HLS C++ primitives in order to utilize DSP instances in FPGA. C++ primitives in order to utilize DSP instances in FPGA.
}]; }];
let constructor = "mlir::scalehls::createCreateHLSCppPrimitivePass()"; let constructor = "mlir::scalehls::createCreateHLSPrimitivePass()";
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -10,7 +10,7 @@
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h" #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/IR/BuiltinOps.h" #include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Dominance.h" #include "mlir/IR/Dominance.h"
#include "scalehls/Dialect/HLSCpp/Visitor.h" #include "scalehls/Dialect/HLS/Visitor.h"
#include "scalehls/Support/Utils.h" #include "scalehls/Support/Utils.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
#include "llvm/Support/JSON.h" #include "llvm/Support/JSON.h"
@ -29,7 +29,7 @@ void getDspUsageMap(llvm::json::Object *config,
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
class ScaleHLSEstimator class ScaleHLSEstimator
: public HLSCppVisitorBase<ScaleHLSEstimator, bool, int64_t> { : public HLSVisitorBase<ScaleHLSEstimator, bool, int64_t> {
public: public:
explicit ScaleHLSEstimator(llvm::StringMap<int64_t> &latencyMap, explicit ScaleHLSEstimator(llvm::StringMap<int64_t> &latencyMap,
llvm::StringMap<int64_t> &dspUsageMap, llvm::StringMap<int64_t> &dspUsageMap,
@ -41,7 +41,7 @@ public:
void estimateFunc(FuncOp func); void estimateFunc(FuncOp func);
void estimateLoop(AffineForOp loop, FuncOp func); void estimateLoop(AffineForOp loop, FuncOp func);
using HLSCppVisitorBase::visitOp; using HLSVisitorBase::visitOp;
bool visitUnhandledOp(Operation *op, int64_t begin) { bool visitUnhandledOp(Operation *op, int64_t begin) {
// Default latency of any unhandled operation is 0. // Default latency of any unhandled operation is 0.
return setTiming(op, begin, begin, 0, 0), true; return setTiming(op, begin, begin, 0, 0), true;

View File

@ -48,7 +48,7 @@ bool applyDataflow(Block &block, StringRef prefix, unsigned gran, bool balance);
/// Apply the specified array partition factors and kinds. /// Apply the specified array partition factors and kinds.
bool applyArrayPartition(Value array, ArrayRef<unsigned> factors, bool applyArrayPartition(Value array, ArrayRef<unsigned> factors,
ArrayRef<hlscpp::PartitionKind> kinds, ArrayRef<hls::PartitionKind> kinds,
bool updateFuncSignature = true); bool updateFuncSignature = true);
/// Find the suitable array partition factors and kinds for all arrays in the /// Find the suitable array partition factors and kinds for all arrays in the

View File

@ -16,7 +16,7 @@ declare_mlir_python_extension(ScaleHLSBindingsPythonExtension.Core
SOURCES SOURCES
ScaleHLSModule.cpp ScaleHLSModule.cpp
EMBED_CAPI_LINK_LIBS EMBED_CAPI_LINK_LIBS
MLIRScaleHLSCAPIHLSCpp MLIRScaleHLSCAPIHLS
MLIRScaleHLSCAPIEmitHLSCpp MLIRScaleHLSCAPIEmitHLSCpp
PRIVATE_LINK_LIBS PRIVATE_LINK_LIBS
LLVMSupport LLVMSupport
@ -48,10 +48,10 @@ declare_mlir_python_sources(ScaleHLSBindingsPythonSources.Dialects
declare_mlir_dialect_python_bindings( declare_mlir_dialect_python_bindings(
ADD_TO_PARENT ScaleHLSBindingsPythonSources.Dialects ADD_TO_PARENT ScaleHLSBindingsPythonSources.Dialects
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
TD_FILE scalehls/dialects/HLSCppOps.td TD_FILE scalehls/dialects/HLSOps.td
SOURCES SOURCES
scalehls/dialects/hlscpp.py scalehls/dialects/hls.py
DIALECT_NAME hlscpp) DIALECT_NAME hls)
################################################################################ ################################################################################
# Build composite binaries # Build composite binaries

View File

@ -13,7 +13,7 @@
#include "mlir/CAPI/IR.h" #include "mlir/CAPI/IR.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h" #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "scalehls-c/EmitHLSCpp.h" #include "scalehls-c/EmitHLSCpp.h"
#include "scalehls-c/HLSCpp.h" #include "scalehls-c/HLS.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
#include "llvm-c/ErrorHandling.h" #include "llvm-c/ErrorHandling.h"
@ -222,10 +222,10 @@ static bool arrayPartition(MlirValue array, py::object factorsObject,
py::gil_scoped_release(); py::gil_scoped_release();
llvm::SmallVector<unsigned, 4> factors; llvm::SmallVector<unsigned, 4> factors;
getVectorFromUnsignedNpArray(factorsObject.ptr(), factors); getVectorFromUnsignedNpArray(factorsObject.ptr(), factors);
llvm::SmallVector<hlscpp::PartitionKind, 4> kinds( llvm::SmallVector<hls::PartitionKind, 4> kinds(
factors.size(), kind == "cyclic" ? hlscpp::PartitionKind::CYCLIC factors.size(), kind == "cyclic" ? hls::PartitionKind::CYCLIC
: kind == "block" ? hlscpp::PartitionKind::BLOCK : kind == "block" ? hls::PartitionKind::BLOCK
: hlscpp::PartitionKind::NONE); : hls::PartitionKind::NONE);
return applyArrayPartition(unwrap(array), factors, kinds); return applyArrayPartition(unwrap(array), factors, kinds);
} }
@ -254,9 +254,9 @@ PYBIND11_MODULE(_scalehls, m) {
auto wrappedCapsule = capsule.attr(MLIR_PYTHON_CAPI_PTR_ATTR); auto wrappedCapsule = capsule.attr(MLIR_PYTHON_CAPI_PTR_ATTR);
MlirContext context = mlirPythonCapsuleToContext(wrappedCapsule.ptr()); MlirContext context = mlirPythonCapsuleToContext(wrappedCapsule.ptr());
MlirDialectHandle hlscpp = mlirGetDialectHandle__hlscpp__(); MlirDialectHandle hls = mlirGetDialectHandle__hls__();
mlirDialectHandleRegisterDialect(hlscpp, context); mlirDialectHandleRegisterDialect(hls, context);
mlirDialectHandleLoadDialect(hlscpp, context); mlirDialectHandleLoadDialect(hls, context);
}); });
// Loop transform APIs. // Loop transform APIs.

View File

@ -4,10 +4,10 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef BINDINGS_PYTHON_HLSCPP_OPS_TD #ifndef BINDINGS_PYTHON_HLS_OPS_TD
#define BINDINGS_PYTHON_HLSCPP_OPS_TD #define BINDINGS_PYTHON_HLS_OPS_TD
include "mlir/Bindings/Python/Attributes.td" include "mlir/Bindings/Python/Attributes.td"
include "scalehls/Dialect/HLSCpp/HLSCpp.td" include "scalehls/Dialect/HLS/HLS.td"
#endif // BINDINGS_PYTHON_HLSCPP_OPS_TD #endif // BINDINGS_PYTHON_HLS_OPS_TD

View File

@ -4,4 +4,4 @@
# #
# ===----------------------------------------------------------------------=== # # ===----------------------------------------------------------------------=== #
from ._hlscpp_ops_gen import * from ._hls_ops_gen import *

View File

@ -1,10 +1,10 @@
add_mlir_public_c_api_library(MLIRScaleHLSCAPIHLSCpp add_mlir_public_c_api_library(MLIRScaleHLSCAPIHLS
HLSCpp.cpp HLS.cpp
ADDITIONAL_HEADER_DIRS ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir-c ${MLIR_MAIN_INCLUDE_DIR}/mlir-c
LINK_LIBS PUBLIC LINK_LIBS PUBLIC
MLIRCAPIIR MLIRCAPIIR
MLIRHLSCpp MLIRHLS
) )

View File

@ -4,11 +4,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "scalehls-c/HLSCpp.h" #include "scalehls-c/HLS.h"
#include "mlir/CAPI/Registration.h" #include "mlir/CAPI/Registration.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(HLSCpp, hlscpp, hlscpp::HLSCppDialect) MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(HLS, hls, hls::HLSDialect)

View File

@ -1 +1 @@
add_subdirectory(HLSCpp) add_subdirectory(HLS)

View File

@ -0,0 +1,8 @@
add_mlir_dialect_library(MLIRHLS
HLS.cpp
DEPENDS
MLIRHLSIncGen
MLIRHLSEnumsIncGen
MLIRHLSAttributesIncGen
)

View File

@ -4,7 +4,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/DialectImplementation.h" #include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/PatternMatch.h" #include "mlir/IR/PatternMatch.h"
@ -12,39 +12,39 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// HLSCpp dialect // HLS dialect
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
void HLSCppDialect::initialize() { void HLSDialect::initialize() {
addTypes< addTypes<
#define GET_TYPEDEF_LIST #define GET_TYPEDEF_LIST
#include "scalehls/Dialect/HLSCpp/HLSCppTypes.cpp.inc" #include "scalehls/Dialect/HLS/HLSTypes.cpp.inc"
>(); >();
addAttributes< addAttributes<
#define GET_ATTRDEF_LIST #define GET_ATTRDEF_LIST
#include "scalehls/Dialect/HLSCpp/HLSCppAttributes.cpp.inc" #include "scalehls/Dialect/HLS/HLSAttributes.cpp.inc"
>(); >();
addOperations< addOperations<
#define GET_OP_LIST #define GET_OP_LIST
#include "scalehls/Dialect/HLSCpp/HLSCpp.cpp.inc" #include "scalehls/Dialect/HLS/HLS.cpp.inc"
>(); >();
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// HLSCpp dialect utils // HLS dialect utils
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// Get the users of a stream channel. If the channel is used by a function /// Get the users of a stream channel. If the channel is used by a function
/// call, this method will recursively look into the corresponding sub-function. /// call, this method will recursively look into the corresponding sub-function.
/// If the channel is used by a function return, this method will recursively /// If the channel is used by a function return, this method will recursively
/// look into each function that calls the parent function of the return. /// look into each function that calls the parent function of the return.
void hlscpp::getStreamChannelUsers(Value channel, void hls::getStreamChannelUsers(Value channel,
SmallVectorImpl<Operation *> &users) { SmallVectorImpl<Operation *> &users) {
assert(channel.getType().isa<StreamType>() && "channel must be stream type"); assert(channel.getType().isa<StreamType>() && "channel must be stream type");
for (auto &use : channel.getUses()) { for (auto &use : channel.getUses()) {
@ -70,99 +70,98 @@ void hlscpp::getStreamChannelUsers(Value channel,
} }
/// Timing attribute utils. /// Timing attribute utils.
TimingAttr hlscpp::getTiming(Operation *op) { TimingAttr hls::getTiming(Operation *op) {
return op->getAttrOfType<TimingAttr>("timing"); return op->getAttrOfType<TimingAttr>("timing");
} }
void hlscpp::setTiming(Operation *op, TimingAttr timing) { void hls::setTiming(Operation *op, TimingAttr timing) {
assert(timing.getBegin() <= timing.getEnd() && "invalid timing attribute"); assert(timing.getBegin() <= timing.getEnd() && "invalid timing attribute");
op->setAttr("timing", timing); op->setAttr("timing", timing);
} }
void hlscpp::setTiming(Operation *op, int64_t begin, int64_t end, void hls::setTiming(Operation *op, int64_t begin, int64_t end, int64_t latency,
int64_t latency, int64_t minII) { int64_t minII) {
auto timing = TimingAttr::get(op->getContext(), begin, end, latency, minII); auto timing = TimingAttr::get(op->getContext(), begin, end, latency, minII);
setTiming(op, timing); setTiming(op, timing);
} }
/// Resource attribute utils. /// Resource attribute utils.
ResourceAttr hlscpp::getResource(Operation *op) { ResourceAttr hls::getResource(Operation *op) {
return op->getAttrOfType<ResourceAttr>("resource"); return op->getAttrOfType<ResourceAttr>("resource");
} }
void hlscpp::setResource(Operation *op, ResourceAttr resource) { void hls::setResource(Operation *op, ResourceAttr resource) {
op->setAttr("resource", resource); op->setAttr("resource", resource);
} }
void hlscpp::setResource(Operation *op, int64_t lut, int64_t dsp, void hls::setResource(Operation *op, int64_t lut, int64_t dsp, int64_t bram) {
int64_t bram) {
auto resource = ResourceAttr::get(op->getContext(), lut, dsp, bram); auto resource = ResourceAttr::get(op->getContext(), lut, dsp, bram);
setResource(op, resource); setResource(op, resource);
} }
/// Loop information attribute utils. /// Loop information attribute utils.
LoopInfoAttr hlscpp::getLoopInfo(Operation *op) { LoopInfoAttr hls::getLoopInfo(Operation *op) {
return op->getAttrOfType<LoopInfoAttr>("loop_info"); return op->getAttrOfType<LoopInfoAttr>("loop_info");
} }
void hlscpp::setLoopInfo(Operation *op, LoopInfoAttr loopInfo) { void hls::setLoopInfo(Operation *op, LoopInfoAttr loopInfo) {
op->setAttr("loop_info", loopInfo); op->setAttr("loop_info", loopInfo);
} }
void hlscpp::setLoopInfo(Operation *op, int64_t flattenTripCount, void hls::setLoopInfo(Operation *op, int64_t flattenTripCount,
int64_t iterLatency, int64_t minII) { int64_t iterLatency, int64_t minII) {
auto loopInfo = auto loopInfo =
LoopInfoAttr::get(op->getContext(), flattenTripCount, iterLatency, minII); LoopInfoAttr::get(op->getContext(), flattenTripCount, iterLatency, minII);
setLoopInfo(op, loopInfo); setLoopInfo(op, loopInfo);
} }
/// Loop directives attribute utils. /// Loop directives attribute utils.
LoopDirectiveAttr hlscpp::getLoopDirective(Operation *op) { LoopDirectiveAttr hls::getLoopDirective(Operation *op) {
return op->getAttrOfType<LoopDirectiveAttr>("loop_directive"); return op->getAttrOfType<LoopDirectiveAttr>("loop_directive");
} }
void hlscpp::setLoopDirective(Operation *op, LoopDirectiveAttr loopDirective) { void hls::setLoopDirective(Operation *op, LoopDirectiveAttr loopDirective) {
op->setAttr("loop_directive", loopDirective); op->setAttr("loop_directive", loopDirective);
} }
void hlscpp::setLoopDirective(Operation *op, bool pipeline, int64_t targetII, void hls::setLoopDirective(Operation *op, bool pipeline, int64_t targetII,
bool dataflow, bool flatten) { bool dataflow, bool flatten) {
auto loopDirective = LoopDirectiveAttr::get(op->getContext(), pipeline, auto loopDirective = LoopDirectiveAttr::get(op->getContext(), pipeline,
targetII, dataflow, flatten); targetII, dataflow, flatten);
setLoopDirective(op, loopDirective); setLoopDirective(op, loopDirective);
} }
/// Parrallel and point loop attribute utils. /// Parrallel and point loop attribute utils.
void hlscpp::setParallelAttr(Operation *op) { void hls::setParallelAttr(Operation *op) {
op->setAttr("parallel", UnitAttr::get(op->getContext())); op->setAttr("parallel", UnitAttr::get(op->getContext()));
} }
bool hlscpp::hasParallelAttr(Operation *op) { bool hls::hasParallelAttr(Operation *op) {
return op->hasAttrOfType<UnitAttr>("parallel"); return op->hasAttrOfType<UnitAttr>("parallel");
} }
void hlscpp::setPointAttr(Operation *op) { void hls::setPointAttr(Operation *op) {
op->setAttr("point", UnitAttr::get(op->getContext())); op->setAttr("point", UnitAttr::get(op->getContext()));
} }
bool hlscpp::hasPointAttr(Operation *op) { bool hls::hasPointAttr(Operation *op) {
return op->hasAttrOfType<UnitAttr>("point"); return op->hasAttrOfType<UnitAttr>("point");
} }
/// Function directives attribute utils. /// Function directives attribute utils.
FuncDirectiveAttr hlscpp::getFuncDirective(Operation *op) { FuncDirectiveAttr hls::getFuncDirective(Operation *op) {
return op->getAttrOfType<FuncDirectiveAttr>("func_directive"); return op->getAttrOfType<FuncDirectiveAttr>("func_directive");
} }
void hlscpp::setFuncDirective(Operation *op, FuncDirectiveAttr funcDirective) { void hls::setFuncDirective(Operation *op, FuncDirectiveAttr funcDirective) {
op->setAttr("func_directive", funcDirective); op->setAttr("func_directive", funcDirective);
} }
void hlscpp::setFuncDirective(Operation *op, bool pipeline, void hls::setFuncDirective(Operation *op, bool pipeline, int64_t targetInterval,
int64_t targetInterval, bool dataflow) { bool dataflow) {
auto funcDirective = FuncDirectiveAttr::get(op->getContext(), pipeline, auto funcDirective = FuncDirectiveAttr::get(op->getContext(), pipeline,
targetInterval, dataflow); targetInterval, dataflow);
setFuncDirective(op, funcDirective); setFuncDirective(op, funcDirective);
} }
/// Top and runtime function attribute utils. /// Top and runtime function attribute utils.
void hlscpp::setTopFuncAttr(Operation *op) { void hls::setTopFuncAttr(Operation *op) {
op->setAttr("top_func", UnitAttr::get(op->getContext())); op->setAttr("top_func", UnitAttr::get(op->getContext()));
} }
bool hlscpp::hasTopFuncAttr(Operation *op) { bool hls::hasTopFuncAttr(Operation *op) {
return op->hasAttrOfType<UnitAttr>("top_func"); return op->hasAttrOfType<UnitAttr>("top_func");
} }
void hlscpp::setRuntimeAttr(Operation *op) { void hls::setRuntimeAttr(Operation *op) {
op->setAttr("runtime", UnitAttr::get(op->getContext())); op->setAttr("runtime", UnitAttr::get(op->getContext()));
} }
bool hlscpp::hasRuntimeAttr(Operation *op) { bool hls::hasRuntimeAttr(Operation *op) {
return op->hasAttrOfType<UnitAttr>("runtime"); return op->hasAttrOfType<UnitAttr>("runtime");
} }
@ -380,7 +379,7 @@ void FuncDirectiveAttr::print(AsmPrinter &p) const {
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// HLSCpp operation canonicalizers // HLS operation canonicalizers
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
namespace { namespace {
@ -436,14 +435,14 @@ void BufferOp::getCanonicalizationPatterns(RewritePatternSet &results,
// Include tablegen classes // Include tablegen classes
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "scalehls/Dialect/HLSCpp/HLSCppDialect.cpp.inc" #include "scalehls/Dialect/HLS/HLSDialect.cpp.inc"
#include "scalehls/Dialect/HLSCpp/HLSCppEnums.cpp.inc" #include "scalehls/Dialect/HLS/HLSEnums.cpp.inc"
#define GET_TYPEDEF_CLASSES #define GET_TYPEDEF_CLASSES
#include "scalehls/Dialect/HLSCpp/HLSCppTypes.cpp.inc" #include "scalehls/Dialect/HLS/HLSTypes.cpp.inc"
#define GET_ATTRDEF_CLASSES #define GET_ATTRDEF_CLASSES
#include "scalehls/Dialect/HLSCpp/HLSCppAttributes.cpp.inc" #include "scalehls/Dialect/HLS/HLSAttributes.cpp.inc"
#define GET_OP_CLASSES #define GET_OP_CLASSES
#include "scalehls/Dialect/HLSCpp/HLSCpp.cpp.inc" #include "scalehls/Dialect/HLS/HLS.cpp.inc"

View File

@ -1,8 +0,0 @@
add_mlir_dialect_library(MLIRHLSCpp
HLSCpp.cpp
DEPENDS
MLIRHLSCppIncGen
MLIRHLSCppEnumsIncGen
MLIRHLSCppAttributesIncGen
)

View File

@ -2,5 +2,5 @@ add_mlir_library(MLIRScaleHLSSupport
Utils.cpp Utils.cpp
LINK_LIBS PUBLIC LINK_LIBS PUBLIC
MLIRHLSCpp MLIRHLS
) )

View File

@ -15,7 +15,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Memory and loop analysis utils // Memory and loop analysis utils

View File

@ -1,6 +1,6 @@
add_mlir_library(MLIRScaleHLSTransforms add_mlir_library(MLIRScaleHLSTransforms
Directive/ArrayPartition.cpp Directive/ArrayPartition.cpp
Directive/CreateHLSCppPrimitive.cpp Directive/CreateHLSPrimitive.cpp
Directive/FuncPipelining.cpp Directive/FuncPipelining.cpp
Directive/LoopPipelining.cpp Directive/LoopPipelining.cpp
Directive/QoREstimation.cpp Directive/QoREstimation.cpp

View File

@ -13,7 +13,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
static void updateSubFuncs(FuncOp func, Builder builder) { static void updateSubFuncs(FuncOp func, Builder builder) {
func.walk([&](func::CallOp op) { func.walk([&](func::CallOp op) {
@ -47,7 +47,7 @@ static void updateSubFuncs(FuncOp func, Builder builder) {
/// Apply the specified array partition factors and kinds. /// Apply the specified array partition factors and kinds.
bool scalehls::applyArrayPartition(Value array, ArrayRef<unsigned> factors, bool scalehls::applyArrayPartition(Value array, ArrayRef<unsigned> factors,
ArrayRef<hlscpp::PartitionKind> kinds, ArrayRef<hls::PartitionKind> kinds,
bool updateFuncSignature) { bool updateFuncSignature) {
auto builder = Builder(array.getContext()); auto builder = Builder(array.getContext());
auto arrayType = array.getType().dyn_cast<MemRefType>(); auto arrayType = array.getType().dyn_cast<MemRefType>();
@ -399,7 +399,7 @@ bool scalehls::applyAutoArrayPartition(FuncOp func) {
auto memref = pair.first; auto memref = pair.first;
auto partitions = pair.second; auto partitions = pair.second;
SmallVector<hlscpp::PartitionKind, 4> kinds; SmallVector<hls::PartitionKind, 4> kinds;
SmallVector<unsigned, 4> factors; SmallVector<unsigned, 4> factors;
for (auto info : partitions) { for (auto info : partitions) {
kinds.push_back(info.first); kinds.push_back(info.first);

View File

@ -12,7 +12,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
static IntegerType getIntDataType(Type type) { static IntegerType getIntDataType(Type type) {
auto dataType = type.dyn_cast<IntegerType>(); auto dataType = type.dyn_cast<IntegerType>();
@ -98,8 +98,7 @@ struct MulOpRewritePattern : public OpRewritePattern<arith::MulIOp> {
} // namespace } // namespace
namespace { namespace {
struct CreateHLSCppPrimitive struct CreateHLSPrimitive : public CreateHLSPrimitiveBase<CreateHLSPrimitive> {
: public CreateHLSCppPrimitiveBase<CreateHLSCppPrimitive> {
void runOnOperation() override { void runOnOperation() override {
auto func = getOperation(); auto func = getOperation();
@ -111,6 +110,6 @@ struct CreateHLSCppPrimitive
}; };
} // namespace } // namespace
std::unique_ptr<Pass> scalehls::createCreateHLSCppPrimitivePass() { std::unique_ptr<Pass> scalehls::createCreateHLSPrimitivePass() {
return std::make_unique<CreateHLSCppPrimitive>(); return std::make_unique<CreateHLSPrimitive>();
} }

View File

@ -10,7 +10,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
/// Apply function pipelining to the input function, all contained loops are /// Apply function pipelining to the input function, all contained loops are
/// automatically fully unrolled. /// automatically fully unrolled.

View File

@ -9,7 +9,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
/// Apply loop pipelining to the input loop, all inner loops are automatically /// Apply loop pipelining to the input loop, all inner loops are automatically
/// fully unrolled. /// fully unrolled.

View File

@ -15,7 +15,7 @@
using namespace std; using namespace std;
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// LoadOp and StoreOp Related Methods // LoadOp and StoreOp Related Methods

View File

@ -5,13 +5,13 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "scalehls/Transforms/Passes.h" #include "scalehls/Transforms/Passes.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
struct ConvertDataflowToFuncPattern : public OpRewritePattern<DataflowNodeOp> { struct ConvertDataflowToFuncPattern : public OpRewritePattern<DataflowNodeOp> {

View File

@ -4,13 +4,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "scalehls/Transforms/Passes.h" #include "scalehls/Transforms/Passes.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
struct CreateTokenFlow : public CreateTokenFlowBase<CreateTokenFlow> { struct CreateTokenFlow : public CreateTokenFlowBase<CreateTokenFlow> {

View File

@ -7,13 +7,13 @@
#include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/Dominance.h" #include "mlir/IR/Dominance.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "scalehls/Transforms/Passes.h" #include "scalehls/Transforms/Passes.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
/// This pattern will outline ops with the specified type. /// This pattern will outline ops with the specified type.

View File

@ -11,13 +11,13 @@
#include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/Dominance.h" #include "mlir/IR/Dominance.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "scalehls/Transforms/Passes.h" #include "scalehls/Transforms/Passes.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
struct DataflowGraph { struct DataflowGraph {
@ -179,11 +179,11 @@ bool Dataflower::applyLegalizeDataflow(int64_t gran, bool balance) {
copyOp = builder.create<memref::CopyOp>(op->getLoc(), values.back(), copyOp = builder.create<memref::CopyOp>(op->getLoc(), values.back(),
newValue); newValue);
} else if (auto type = value.getType().dyn_cast<StreamType>()) { } else if (auto type = value.getType().dyn_cast<StreamType>()) {
copyOp = builder.create<hlscpp::StreamBufferOp>( copyOp = builder.create<hls::StreamBufferOp>(
op->getLoc(), value.getType(), values.back()); op->getLoc(), value.getType(), values.back());
newValue = copyOp->getResult(0); newValue = copyOp->getResult(0);
} else { } else {
copyOp = builder.create<hlscpp::BufferOp>( copyOp = builder.create<hls::BufferOp>(
op->getLoc(), value.getType(), values.back()); op->getLoc(), value.getType(), values.back());
newValue = copyOp->getResult(0); newValue = copyOp->getResult(0);
} }

View File

@ -10,7 +10,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
// Updates the func op and entry block. Any args appended to the entry block are // Updates the func op and entry block. Any args appended to the entry block are
// added to `appendedEntryArgs`. // added to `appendedEntryArgs`.
@ -22,7 +22,7 @@ static void updateFuncOp(FuncOp func,
SmallVector<Type, 6> erasedResultTypes; SmallVector<Type, 6> erasedResultTypes;
BitVector erasedResultIndices(functionType.getNumResults()); BitVector erasedResultIndices(functionType.getNumResults());
for (const auto &resultType : llvm::enumerate(functionType.getResults())) { for (const auto &resultType : llvm::enumerate(functionType.getResults())) {
if (resultType.value().isa<hlscpp::StreamType>()) { if (resultType.value().isa<hls::StreamType>()) {
erasedResultIndices.set(resultType.index()); erasedResultIndices.set(resultType.index());
erasedResultTypes.push_back(resultType.value()); erasedResultTypes.push_back(resultType.value());
} }
@ -70,7 +70,7 @@ static void updateReturnOps(FuncOp func,
OpBuilder builder(op); OpBuilder builder(op);
for (auto t : llvm::zip(copyIntoOutParams, appendedEntryArgs)) { for (auto t : llvm::zip(copyIntoOutParams, appendedEntryArgs)) {
std::get<0>(t).replaceAllUsesWith(std::get<1>(t)); std::get<0>(t).replaceAllUsesWith(std::get<1>(t));
if (auto stream = std::get<0>(t).getDefiningOp<hlscpp::StreamChannelOp>()) if (auto stream = std::get<0>(t).getDefiningOp<hls::StreamChannelOp>())
stream.erase(); stream.erase();
} }
builder.create<func::ReturnOp>(op.getLoc(), keepAsReturnOperands); builder.create<func::ReturnOp>(op.getLoc(), keepAsReturnOperands);
@ -85,7 +85,7 @@ static void updateCalls(ModuleOp module) {
SmallVector<Value, 6> replaceWithNewCallResults; SmallVector<Value, 6> replaceWithNewCallResults;
SmallVector<Value, 6> replaceWithOutParams; SmallVector<Value, 6> replaceWithOutParams;
for (OpResult result : op.getResults()) { for (OpResult result : op.getResults()) {
if (result.getType().isa<hlscpp::StreamType>()) if (result.getType().isa<hls::StreamType>())
replaceWithOutParams.push_back(result); replaceWithOutParams.push_back(result);
else else
replaceWithNewCallResults.push_back(result); replaceWithNewCallResults.push_back(result);
@ -93,7 +93,7 @@ static void updateCalls(ModuleOp module) {
SmallVector<Value, 6> outParams; SmallVector<Value, 6> outParams;
OpBuilder builder(op); OpBuilder builder(op);
for (Value stream : replaceWithOutParams) { for (Value stream : replaceWithOutParams) {
Value outParam = builder.create<hlscpp::StreamChannelOp>( Value outParam = builder.create<hls::StreamChannelOp>(
op.getLoc(), stream.getType().cast<StreamType>()); op.getLoc(), stream.getType().cast<StreamType>());
stream.replaceAllUsesWith(outParam); stream.replaceAllUsesWith(outParam);
outParams.push_back(outParam); outParams.push_back(outParam);
@ -113,27 +113,26 @@ static void updateCalls(ModuleOp module) {
namespace { namespace {
struct LowerStreamBufferOpRewritePattern struct LowerStreamBufferOpRewritePattern
: public OpRewritePattern<hlscpp::StreamBufferOp> { : public OpRewritePattern<hls::StreamBufferOp> {
using OpRewritePattern<hlscpp::StreamBufferOp>::OpRewritePattern; using OpRewritePattern<hls::StreamBufferOp>::OpRewritePattern;
LogicalResult matchAndRewrite(hlscpp::StreamBufferOp buffer, LogicalResult matchAndRewrite(hls::StreamBufferOp buffer,
PatternRewriter &rewriter) const override { PatternRewriter &rewriter) const override {
auto loc = buffer.getLoc(); auto loc = buffer.getLoc();
auto block = buffer->getBlock(); auto block = buffer->getBlock();
rewriter.setInsertionPointToStart(block); rewriter.setInsertionPointToStart(block);
if (!llvm::any_of(buffer.input().getUsers(), [](Operation *op) { if (!llvm::any_of(buffer.input().getUsers(),
return isa<hlscpp::StreamReadOp>(op); [](Operation *op) { return isa<hls::StreamReadOp>(op); }))
})) rewriter.create<hls::StreamReadOp>(loc, Type(), buffer.input());
rewriter.create<hlscpp::StreamReadOp>(loc, Type(), buffer.input()); auto channel = rewriter.replaceOpWithNewOp<hls::StreamChannelOp>(
auto channel = rewriter.replaceOpWithNewOp<hlscpp::StreamChannelOp>(
buffer, buffer.getType()); buffer, buffer.getType());
rewriter.setInsertionPoint(block->getTerminator()); rewriter.setInsertionPoint(block->getTerminator());
auto tokenType = channel.getType().cast<StreamType>().getElementType(); auto tokenType = channel.getType().cast<StreamType>().getElementType();
auto tokenValue = rewriter.create<arith::ConstantOp>( auto tokenValue = rewriter.create<arith::ConstantOp>(
loc, rewriter.getZeroAttr(tokenType)); loc, rewriter.getZeroAttr(tokenType));
rewriter.create<hlscpp::StreamWriteOp>(loc, channel, tokenValue); rewriter.create<hls::StreamWriteOp>(loc, channel, tokenValue);
return success(); return success();
} }
}; };

View File

@ -7,13 +7,13 @@
#include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/Dominance.h" #include "mlir/IR/Dominance.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "scalehls/Dialect/HLSCpp/HLSCpp.h" #include "scalehls/Dialect/HLS/HLS.h"
#include "scalehls/Transforms/Passes.h" #include "scalehls/Transforms/Passes.h"
#include "scalehls/Transforms/Utils.h" #include "scalehls/Transforms/Utils.h"
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
/// This pattern will outline ops with the specified type. /// This pattern will outline ops with the specified type.

View File

@ -14,7 +14,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
/// Apply loop tiling to the input loop band and sink all intra-tile loops to /// Apply loop tiling to the input loop band and sink all intra-tile loops to
/// the innermost loop with the original loop order. /// the innermost loop with the original loop order.

View File

@ -16,7 +16,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
struct AllocOpRewritePattern : public OpRewritePattern<memref::AllocOp> { struct AllocOpRewritePattern : public OpRewritePattern<memref::AllocOp> {

View File

@ -14,7 +14,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
/// Simple memref load to affine load raising. /// Simple memref load to affine load raising.

View File

@ -12,7 +12,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
namespace { namespace {
struct CreateMemrefSubview struct CreateMemrefSubview

View File

@ -13,7 +13,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
static void createBufferAndCopy(MemRefType type, Value memref, static void createBufferAndCopy(MemRefType type, Value memref,
OpBuilder &builder) { OpBuilder &builder) {

View File

@ -160,7 +160,7 @@ void scalehls::registerScaleHLSPyTorchPipeline() {
pm.addPass(mlir::createCanonicalizerPass()); pm.addPass(mlir::createCanonicalizerPass());
pm.addPass(scalehls::createLoopPipeliningPass()); pm.addPass(scalehls::createLoopPipeliningPass());
pm.addPass(scalehls::createArrayPartitionPass()); pm.addPass(scalehls::createArrayPartitionPass());
pm.addPass(scalehls::createCreateHLSCppPrimitivePass()); pm.addPass(scalehls::createCreateHLSPrimitivePass());
pm.addPass(mlir::createCanonicalizerPass()); pm.addPass(mlir::createCanonicalizerPass());
}); });
} }
@ -279,7 +279,7 @@ void scalehls::registerScaleHLSPyTorchPipelineV2() {
pm.addPass(scalehls::createLoopPipeliningPass()); pm.addPass(scalehls::createLoopPipeliningPass());
pm.addPass(scalehls::createArrayPartitionPass()); pm.addPass(scalehls::createArrayPartitionPass());
pm.addPass(scalehls::createCreateHLSCppPrimitivePass()); pm.addPass(scalehls::createCreateHLSPrimitivePass());
pm.addPass(mlir::createCanonicalizerPass()); pm.addPass(mlir::createCanonicalizerPass());
}); });
} }

View File

@ -11,7 +11,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
// A helper to get corresponding DRAM memref type from normal memref type. // A helper to get corresponding DRAM memref type from normal memref type.
static MemRefType getDramType(MemRefType type) { static MemRefType getDramType(MemRefType type) {

View File

@ -10,7 +10,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
static SmallVector<arith::ConstantOp, 8> static SmallVector<arith::ConstantOp, 8>
collectConstantsAndUpdateFuncionType(FuncOp func) { collectConstantsAndUpdateFuncionType(FuncOp func) {

View File

@ -13,7 +13,7 @@
using namespace mlir; using namespace mlir;
using namespace scalehls; using namespace scalehls;
using namespace hlscpp; using namespace hls;
static void addMemoryOptsPipeline(PassManager &pm) { static void addMemoryOptsPipeline(PassManager &pm) {
// To factor out the redundant affine operations. // To factor out the redundant affine operations.

View File

@ -2,6 +2,6 @@ add_mlir_library(MLIRScaleHLSEmitHLSCpp
EmitHLSCpp.cpp EmitHLSCpp.cpp
LINK_LIBS PUBLIC LINK_LIBS PUBLIC
MLIRHLSCpp MLIRHLS
MLIRScaleHLSSupport MLIRScaleHLSSupport
) )

View File

@ -9,7 +9,7 @@
#include "mlir/IR/AffineExprVisitor.h" #include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/IntegerSet.h" #include "mlir/IR/IntegerSet.h"
#include "mlir/Translation.h" #include "mlir/Translation.h"
#include "scalehls/Dialect/HLSCpp/Visitor.h" #include "scalehls/Dialect/HLS/Visitor.h"
#include "scalehls/InitAllDialects.h" #include "scalehls/InitAllDialects.h"
#include "scalehls/Support/Utils.h" #include "scalehls/Support/Utils.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
@ -226,7 +226,7 @@ public:
void emitTensorToMemref(bufferization::ToMemrefOp op); void emitTensorToMemref(bufferization::ToMemrefOp op);
void emitMemrefToTensor(bufferization::ToTensorOp op); void emitMemrefToTensor(bufferization::ToTensorOp op);
/// HLSCpp dialect operation emitters. /// HLS dialect operation emitters.
void emitStreamChannel(StreamChannelOp op); void emitStreamChannel(StreamChannelOp op);
void emitStreamRead(StreamReadOp op); void emitStreamRead(StreamReadOp op);
void emitStreamWrite(StreamWriteOp op); void emitStreamWrite(StreamWriteOp op);
@ -358,11 +358,11 @@ private:
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
namespace { namespace {
class StmtVisitor : public HLSCppVisitorBase<StmtVisitor, bool> { class StmtVisitor : public HLSVisitorBase<StmtVisitor, bool> {
public: public:
StmtVisitor(ModuleEmitter &emitter) : emitter(emitter) {} StmtVisitor(ModuleEmitter &emitter) : emitter(emitter) {}
using HLSCppVisitorBase::visitOp; using HLSVisitorBase::visitOp;
/// SCF statements. /// SCF statements.
bool visitOp(scf::ForOp op) { return emitter.emitScfFor(op), true; }; bool visitOp(scf::ForOp op) { return emitter.emitScfFor(op), true; };
bool visitOp(scf::IfOp op) { return emitter.emitScfIf(op), true; }; bool visitOp(scf::IfOp op) { return emitter.emitScfIf(op), true; };
@ -429,7 +429,7 @@ public:
return emitter.emitMemrefToTensor(op), true; return emitter.emitMemrefToTensor(op), true;
} }
/// HLSCpp dialect operations. /// HLS dialect operations.
bool visitOp(StreamChannelOp op) { bool visitOp(StreamChannelOp op) {
return emitter.emitStreamChannel(op), true; return emitter.emitStreamChannel(op), true;
} }
@ -449,10 +449,10 @@ private:
} // namespace } // namespace
namespace { namespace {
class ExprVisitor : public HLSCppVisitorBase<ExprVisitor, bool> { class ExprVisitor : public HLSVisitorBase<ExprVisitor, bool> {
public: public:
ExprVisitor(ModuleEmitter &emitter) : emitter(emitter) {} ExprVisitor(ModuleEmitter &emitter) : emitter(emitter) {}
using HLSCppVisitorBase::visitOp; using HLSVisitorBase::visitOp;
/// Unary expressions. /// Unary expressions.
bool visitOp(math::AbsOp op) { return emitter.emitUnary(op, "abs"), true; } bool visitOp(math::AbsOp op) { return emitter.emitUnary(op, "abs"), true; }
@ -1263,7 +1263,7 @@ void ModuleEmitter::emitMemrefToTensor(bufferization::ToTensorOp op) {
} }
} }
/// HLSCpp dialect operation emitters. /// HLS dialect operation emitters.
void ModuleEmitter::emitStreamChannel(StreamChannelOp op) { void ModuleEmitter::emitStreamChannel(StreamChannelOp op) {
indent(); indent();
emitValue(op.channel()); emitValue(op.channel());

View File

@ -4,4 +4,4 @@
import mlir.ir import mlir.ir
from mlir.dialects import builtin from mlir.dialects import builtin
import scalehls import scalehls
from scalehls.dialects import hlscpp from scalehls.dialects import hls

View File

@ -1,22 +1,22 @@
// RUN: scalehls-opt %s -verify-diagnostics // RUN: scalehls-opt %s -verify-diagnostics
func @node0() -> (!hlscpp.stream<i1, 1>) { func @node0() -> (!hls.stream<i1, 1>) {
// expected-error @+1 {{'hlscpp.stream.channel' op stream channel is written by multiple ops}} // expected-error @+1 {{'hls.stream.channel' op stream channel is written by multiple ops}}
%channel = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> %channel = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
return %channel : !hlscpp.stream<i1, 1> return %channel : !hls.stream<i1, 1>
} }
func @node1(%channel : !hlscpp.stream<i1, 1>) { func @node1(%channel : !hls.stream<i1, 1>) {
call @node0() : () -> !hlscpp.stream<i1, 1> call @node0() : () -> !hls.stream<i1, 1>
%false = arith.constant false %false = arith.constant false
"hlscpp.stream.write"(%channel, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%channel, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
func @dataflow() { func @dataflow() {
%channel = call @node0() : () -> !hlscpp.stream<i1, 1> %channel = call @node0() : () -> !hls.stream<i1, 1>
call @node1(%channel) : (!hlscpp.stream<i1, 1>) -> () call @node1(%channel) : (!hls.stream<i1, 1>) -> ()
%false = arith.constant false %false = arith.constant false
"hlscpp.stream.write"(%channel, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%channel, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }

View File

@ -1,6 +1,6 @@
// RUN: scalehls-translate -emit-hlscpp %s | FileCheck %s // RUN: scalehls-translate -emit-hlscpp %s | FileCheck %s
func @callee(%arg0: index, %arg1: memref<16xindex>) -> (index, index, memref<16xindex>, memref<16xindex>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>} { func @callee(%arg0: index, %arg1: memref<16xindex>) -> (index, index, memref<16xindex>, memref<16xindex>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>} {
// CHECK-NOT: #pragma HLS interface s_axilite port=return bundle=ctrl // CHECK-NOT: #pragma HLS interface s_axilite port=return bundle=ctrl
// CHECK-NOT: #pragma HLS interface s_axilite port=v0 bundle=ctrl // CHECK-NOT: #pragma HLS interface s_axilite port=v0 bundle=ctrl
// CHECK-NOT: #pragma HLS interface s_axilite port=v2 bundle=ctrl // CHECK-NOT: #pragma HLS interface s_axilite port=v2 bundle=ctrl
@ -13,7 +13,7 @@ func @callee(%arg0: index, %arg1: memref<16xindex>) -> (index, index, memref<16x
return %0, %1, %2, %3 : index, index, memref<16xindex>, memref<16xindex> return %0, %1, %2, %3 : index, index, memref<16xindex>, memref<16xindex>
} }
func @test_call(%arg0: index, %arg1: memref<16xindex>) -> (index, memref<16xindex>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_call(%arg0: index, %arg1: memref<16xindex>) -> (index, memref<16xindex>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
// CHECK: #pragma HLS interface s_axilite port=return bundle=ctrl // CHECK: #pragma HLS interface s_axilite port=return bundle=ctrl
// CHECK: #pragma HLS interface s_axilite port=v6 bundle=ctrl // CHECK: #pragma HLS interface s_axilite port=v6 bundle=ctrl
// CHECK: #pragma HLS interface s_axilite port=v8 bundle=ctrl // CHECK: #pragma HLS interface s_axilite port=v8 bundle=ctrl

View File

@ -53,7 +53,7 @@
#set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)> #set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)>
#set1 = affine_set<(d0) : (d0 == 0)> #set1 = affine_set<(d0) : (d0 == 0)>
module { module {
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, #map0>, %arg3: memref<16x16xf32, #map1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, #map0>, %arg3: memref<16x16xf32, #map1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -77,9 +77,9 @@ module {
%12 = arith.addf %11, %7 : f32 %12 = arith.addf %11, %7 : f32
affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32, #map1> affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32, #map1>
} }
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>} } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -7,8 +7,8 @@
module { module {
// CHECK-LABEL: func @test_syrk( // CHECK-LABEL: func @test_syrk(
// CHECK-SAME: %arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, #map0>, %arg3: memref<16x16xf32, #map1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { // CHECK-SAME: %arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, #map0>, %arg3: memref<16x16xf32, #map1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32>, %arg3: memref<16x16xf32>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32>, %arg3: memref<16x16xf32>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -38,9 +38,9 @@ module {
// CHECK: affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32, #map1> // CHECK: affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32, #map1>
affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32> affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32>
} }
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }
@ -85,13 +85,13 @@ module {
%11 = arith.muli %8, %9 : vector<2xi8> %11 = arith.muli %8, %9 : vector<2xi8>
%12 = arith.addi %10, %11 : vector<2xi8> %12 = arith.addi %10, %11 : vector<2xi8>
vector.transfer_write %12, %arg2[%arg3, %6, %arg5, %arg6] : vector<2xi8>, memref<1x32x32x64xi8> vector.transfer_write %12, %arg2[%arg3, %6, %arg5, %arg6] : vector<2xi8>, memref<1x32x32x64xi8>
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=1, dataflow=false, flatten=false>} } {loop_directive = #hls.ld<pipeline=true, targetII=1, dataflow=false, flatten=false>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -1,4 +1,4 @@
// RUN: scalehls-opt -scalehls-create-hlscpp-primitive %s | FileCheck %s // RUN: scalehls-opt -scalehls-create-hls-primitive %s | FileCheck %s
#map0 = affine_map<(d0, d1, d2, d3) -> (0, 0, 0, 0, d0, d1, d2, d3)> #map0 = affine_map<(d0, d1, d2, d3) -> (0, 0, 0, 0, d0, d1, d2, d3)>
#map1 = affine_map<(d0, d1, d2, d3) -> (0, 0, 0, d3 mod 2, d0, d1, d2, d3 floordiv 2)> #map1 = affine_map<(d0, d1, d2, d3) -> (0, 0, 0, d3 mod 2, d0, d1, d2, d3 floordiv 2)>
@ -21,14 +21,14 @@ module {
%2 = vector.transfer_read %arg1[%arg7, %arg8, %arg9, %arg6], %c0_i8 : memref<3x3x64x64xi8, #map1>, vector<2xi8> %2 = vector.transfer_read %arg1[%arg7, %arg8, %arg9, %arg6], %c0_i8 : memref<3x3x64x64xi8, #map1>, vector<2xi8>
%3 = vector.transfer_read %arg2[%arg3, %arg4, %arg5, %arg6], %c0_i8 : memref<1x32x32x64xi8, #map2>, vector<2xi8> %3 = vector.transfer_read %arg2[%arg3, %arg4, %arg5, %arg6], %c0_i8 : memref<1x32x32x64xi8, #map2>, vector<2xi8>
// CHECK: %3 = "hlscpp.prim.mul"(%0, %1) : (i8, vector<2xi8>) -> vector<2xi16> // CHECK: %3 = "hls.prim.mul"(%0, %1) : (i8, vector<2xi8>) -> vector<2xi16>
// CHECK: %4 = "hlscpp.prim.cast"(%3) : (vector<2xi16>) -> vector<2xi8> // CHECK: %4 = "hls.prim.cast"(%3) : (vector<2xi16>) -> vector<2xi8>
%4 = arith.muli %1, %2 : vector<2xi8> %4 = arith.muli %1, %2 : vector<2xi8>
// CHECK: %5 = "hlscpp.prim.cast"(%2) : (vector<2xi8>) -> vector<2xi32> // CHECK: %5 = "hls.prim.cast"(%2) : (vector<2xi8>) -> vector<2xi32>
// CHECK: %6 = "hlscpp.prim.cast"(%4) : (vector<2xi8>) -> vector<2xi32> // CHECK: %6 = "hls.prim.cast"(%4) : (vector<2xi8>) -> vector<2xi32>
// CHECK: %7 = arith.addi %5, %6 : vector<2xi32> // CHECK: %7 = arith.addi %5, %6 : vector<2xi32>
// CHECK: %8 = "hlscpp.prim.cast"(%7) : (vector<2xi32>) -> vector<2xi8> // CHECK: %8 = "hls.prim.cast"(%7) : (vector<2xi32>) -> vector<2xi8>
%5 = arith.addi %3, %4 : vector<2xi8> %5 = arith.addi %3, %4 : vector<2xi8>
vector.transfer_write %5, %arg2[%arg3, %arg4, %arg5, %arg6] : vector<2xi8>, memref<1x32x32x64xi8, #map2> vector.transfer_write %5, %arg2[%arg3, %arg4, %arg5, %arg6] : vector<2xi8>, memref<1x32x32x64xi8, #map2>
%6 = affine.apply #map3(%arg4) %6 = affine.apply #map3(%arg4)
@ -39,13 +39,13 @@ module {
%11 = arith.muli %8, %9 : vector<2xi8> %11 = arith.muli %8, %9 : vector<2xi8>
%12 = arith.addi %10, %11 : vector<2xi8> %12 = arith.addi %10, %11 : vector<2xi8>
vector.transfer_write %12, %arg2[%arg3, %6, %arg5, %arg6] : vector<2xi8>, memref<1x32x32x64xi8, #map2> vector.transfer_write %12, %arg2[%arg3, %6, %arg5, %arg6] : vector<2xi8>, memref<1x32x32x64xi8, #map2>
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=1, dataflow=false, flatten=false>} } {loop_directive = #hls.ld<pipeline=true, targetII=1, dataflow=false, flatten=false>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -8,7 +8,7 @@
#set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)> #set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)>
#set1 = affine_set<(d0) : (d0 == 0)> #set1 = affine_set<(d0) : (d0 == 0)>
module { module {
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32>, %arg3: memref<16x16xf32>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32>, %arg3: memref<16x16xf32>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -50,19 +50,19 @@ module {
// CHECK: affine.store %8, %arg3[%arg5, %arg6] : memref<16x16xf32> // CHECK: affine.store %8, %arg3[%arg5, %arg6] : memref<16x16xf32>
// CHECK: } // CHECK: }
// CHECK-NOT: } {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel} // CHECK-NOT: } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel}
// CHECK-NOT: } {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel} // CHECK-NOT: } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel}
// CHECK-NOT: } {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>} // CHECK-NOT: } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>}
// CHECK: } {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel} // CHECK: } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel}
// CHECK: } {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel} // CHECK: } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel}
// CHECK: } {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} // CHECK: } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=false>}
return return
} }
} }

View File

@ -5,8 +5,8 @@
#set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)> #set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)>
#set1 = affine_set<(d0) : (d0 == 0)> #set1 = affine_set<(d0) : (d0 == 0)>
module { module {
// CHECK: attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, resource = #hlscpp.r<lut=0, dsp=11, bram=0>, timing = #hlscpp.t<0 -> 4119, 4119, 4119>, top_func} // CHECK: attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, resource = #hls.r<lut=0, dsp=11, bram=0>, timing = #hls.t<0 -> 4119, 4119, 4119>, top_func}
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, #map0>, %arg3: memref<16x16xf32, #map1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, #map0>, %arg3: memref<16x16xf32, #map1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -30,9 +30,9 @@ module {
%12 = arith.addf %11, %7 : f32 %12 = arith.addf %11, %7 : f32
affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32, #map1> affine.store %12, %arg3[%arg5, %arg6] : memref<16x16xf32, #map1>
} }
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -1,7 +1,7 @@
// RUN: scalehls-opt -scalehls-create-token-flow %s | FileCheck %s // RUN: scalehls-opt -scalehls-create-token-flow %s | FileCheck %s
module { module {
// CHECK: func @forward_node0(%arg0: tensor<1x3x32x32xi8>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node0(%arg0: tensor<1x3x32x32xi8>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) {
func @forward_node0(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8> { func @forward_node0(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8> {
%0 = "tosa.const"() {value = dense<4> : tensor<64x3x3x3xi8>} : () -> tensor<64x3x3x3xi8> %0 = "tosa.const"() {value = dense<4> : tensor<64x3x3x3xi8>} : () -> tensor<64x3x3x3xi8>
%1 = "tosa.const"() {value = dense<5> : tensor<64xi8>} : () -> tensor<64xi8> %1 = "tosa.const"() {value = dense<5> : tensor<64xi8>} : () -> tensor<64xi8>
@ -10,107 +10,107 @@ module {
%4 = "tosa.conv2d"(%3, %0, %1) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x3xi8>, tensor<64x3x3x3xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8> %4 = "tosa.conv2d"(%3, %0, %1) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x3xi8>, tensor<64x3x3x3xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8>
%5 = "tosa.clamp"(%4) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %5 = "tosa.clamp"(%4) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: %6 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> // CHECK: %6 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
// CHECK: %false = arith.constant false // CHECK: %false = arith.constant false
// CHECK: "hlscpp.stream.write"(%6, %false) : (!hlscpp.stream<i1, 1>, i1) -> () // CHECK: "hls.stream.write"(%6, %false) : (!hls.stream<i1, 1>, i1) -> ()
// CHECK: return %5, %6 : tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1> // CHECK: return %5, %6 : tensor<1x32x32x64xi8>, !hls.stream<i1, 1>
return %5 : tensor<1x32x32x64xi8> return %5 : tensor<1x32x32x64xi8>
} }
// CHECK: func @forward_node1(%arg0: tensor<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node1(%arg0: tensor<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) {
func @forward_node1(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> { func @forward_node1(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> {
// CHECK: "hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
%0 = "tosa.const"() {value = dense<3> : tensor<64x3x3x64xi8>} : () -> tensor<64x3x3x64xi8> %0 = "tosa.const"() {value = dense<3> : tensor<64x3x3x64xi8>} : () -> tensor<64x3x3x64xi8>
%1 = "tosa.const"() {value = dense<5> : tensor<64xi8>} : () -> tensor<64xi8> %1 = "tosa.const"() {value = dense<5> : tensor<64xi8>} : () -> tensor<64xi8>
%2 = "tosa.conv2d"(%arg0, %0, %1) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8> %2 = "tosa.conv2d"(%arg0, %0, %1) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8>
%3 = "tosa.clamp"(%2) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %3 = "tosa.clamp"(%2) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: return %3, %4 : tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1> // CHECK: return %3, %4 : tensor<1x32x32x64xi8>, !hls.stream<i1, 1>
return %3 : tensor<1x32x32x64xi8> return %3 : tensor<1x32x32x64xi8>
} }
// CHECK: func @forward_node2(%arg0: tensor<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node2(%arg0: tensor<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) {
func @forward_node2(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> { func @forward_node2(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> {
// CHECK: "hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
%0 = "tosa.const"() {value = dense<2> : tensor<64x3x3x64xi8>} : () -> tensor<64x3x3x64xi8> %0 = "tosa.const"() {value = dense<2> : tensor<64x3x3x64xi8>} : () -> tensor<64x3x3x64xi8>
%1 = "tosa.const"() {value = dense<5> : tensor<64xi8>} : () -> tensor<64xi8> %1 = "tosa.const"() {value = dense<5> : tensor<64xi8>} : () -> tensor<64xi8>
%2 = "tosa.conv2d"(%arg0, %0, %1) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8> %2 = "tosa.conv2d"(%arg0, %0, %1) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: return %2, %3 : tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1> // CHECK: return %2, %3 : tensor<1x32x32x64xi8>, !hls.stream<i1, 1>
return %2 : tensor<1x32x32x64xi8> return %2 : tensor<1x32x32x64xi8>
} }
// CHECK: func @forward_node3(%arg0: tensor<1x32x32x64xi8>, %arg1: tensor<1x32x32x64xi8>, %arg2: !hlscpp.stream<i1, 1>, %arg3: !hlscpp.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node3(%arg0: tensor<1x32x32x64xi8>, %arg1: tensor<1x32x32x64xi8>, %arg2: !hls.stream<i1, 1>, %arg3: !hls.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) {
func @forward_node3(%arg0: tensor<1x32x32x64xi8>, %arg1: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> { func @forward_node3(%arg0: tensor<1x32x32x64xi8>, %arg1: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> {
// CHECK: "hlscpp.stream.read"(%arg3) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg3) : (!hls.stream<i1, 1>) -> ()
// CHECK: "hlscpp.stream.read"(%arg2) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg2) : (!hls.stream<i1, 1>) -> ()
%0 = "tosa.add"(%arg0, %arg1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %0 = "tosa.add"(%arg0, %arg1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
%1 = "tosa.clamp"(%0) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %1 = "tosa.clamp"(%0) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: return %1, %2 : tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1> // CHECK: return %1, %2 : tensor<1x32x32x64xi8>, !hls.stream<i1, 1>
return %1 : tensor<1x32x32x64xi8> return %1 : tensor<1x32x32x64xi8>
} }
// CHECK: func @forward_node4(%arg0: tensor<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>) -> (tensor<1x1x1x64xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node4(%arg0: tensor<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>) -> (tensor<1x1x1x64xi8>, !hls.stream<i1, 1>) {
func @forward_node4(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x1x1x64xi8> { func @forward_node4(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x1x1x64xi8> {
// CHECK: "hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
%0 = "tosa.avg_pool2d"(%arg0) {kernel = [32, 32], pad = [0, 0, 0, 0], quantization_info = {input_zp = 0 : i32, output_zp = 0 : i32}, stride = [32, 32]} : (tensor<1x32x32x64xi8>) -> tensor<1x1x1x64xi8> %0 = "tosa.avg_pool2d"(%arg0) {kernel = [32, 32], pad = [0, 0, 0, 0], quantization_info = {input_zp = 0 : i32, output_zp = 0 : i32}, stride = [32, 32]} : (tensor<1x32x32x64xi8>) -> tensor<1x1x1x64xi8>
// CHECK: return %0, %1 : tensor<1x1x1x64xi8>, !hlscpp.stream<i1, 1> // CHECK: return %0, %1 : tensor<1x1x1x64xi8>, !hls.stream<i1, 1>
return %0 : tensor<1x1x1x64xi8> return %0 : tensor<1x1x1x64xi8>
} }
// CHECK: func @forward_node5(%arg0: tensor<1x1x1x64xi8>, %arg1: !hlscpp.stream<i1, 1>) -> (tensor<1x1x10xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node5(%arg0: tensor<1x1x1x64xi8>, %arg1: !hls.stream<i1, 1>) -> (tensor<1x1x10xi8>, !hls.stream<i1, 1>) {
func @forward_node5(%arg0: tensor<1x1x1x64xi8>) -> tensor<1x1x10xi8> { func @forward_node5(%arg0: tensor<1x1x1x64xi8>) -> tensor<1x1x10xi8> {
// CHECK: "hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
%0 = "tosa.const"() {value = dense<[0, 3, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32> %0 = "tosa.const"() {value = dense<[0, 3, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32>
%1 = "tosa.transpose"(%arg0, %0) : (tensor<1x1x1x64xi8>, tensor<4xi32>) -> tensor<1x64x1x1xi8> %1 = "tosa.transpose"(%arg0, %0) : (tensor<1x1x1x64xi8>, tensor<4xi32>) -> tensor<1x64x1x1xi8>
%2 = "tosa.const"() {value = dense<1> : tensor<1x64x10xi8>} : () -> tensor<1x64x10xi8> %2 = "tosa.const"() {value = dense<1> : tensor<1x64x10xi8>} : () -> tensor<1x64x10xi8>
%3 = "tosa.reshape"(%1) {new_shape = [1, 1, 64]} : (tensor<1x64x1x1xi8>) -> tensor<1x1x64xi8> %3 = "tosa.reshape"(%1) {new_shape = [1, 1, 64]} : (tensor<1x64x1x1xi8>) -> tensor<1x1x64xi8>
%4 = "tosa.matmul"(%3, %2) {quantization_info = {a_zp = 0 : i32, b_zp = 0 : i32}} : (tensor<1x1x64xi8>, tensor<1x64x10xi8>) -> tensor<1x1x10xi8> %4 = "tosa.matmul"(%3, %2) {quantization_info = {a_zp = 0 : i32, b_zp = 0 : i32}} : (tensor<1x1x64xi8>, tensor<1x64x10xi8>) -> tensor<1x1x10xi8>
// CHECK: return %4, %5 : tensor<1x1x10xi8>, !hlscpp.stream<i1, 1> // CHECK: return %4, %5 : tensor<1x1x10xi8>, !hls.stream<i1, 1>
return %4 : tensor<1x1x10xi8> return %4 : tensor<1x1x10xi8>
} }
// CHECK: func @forward_node6(%arg0: tensor<1x1x10xi8>, %arg1: !hlscpp.stream<i1, 1>) -> (tensor<1x10xi8>, !hlscpp.stream<i1, 1>) { // CHECK: func @forward_node6(%arg0: tensor<1x1x10xi8>, %arg1: !hls.stream<i1, 1>) -> (tensor<1x10xi8>, !hls.stream<i1, 1>) {
func @forward_node6(%arg0: tensor<1x1x10xi8>) -> tensor<1x10xi8> { func @forward_node6(%arg0: tensor<1x1x10xi8>) -> tensor<1x10xi8> {
// CHECK: "hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
%0 = "tosa.const"() {value = dense<0> : tensor<1x10xi8>} : () -> tensor<1x10xi8> %0 = "tosa.const"() {value = dense<0> : tensor<1x10xi8>} : () -> tensor<1x10xi8>
%1 = "tosa.reshape"(%arg0) {new_shape = [1, 10]} : (tensor<1x1x10xi8>) -> tensor<1x10xi8> %1 = "tosa.reshape"(%arg0) {new_shape = [1, 10]} : (tensor<1x1x10xi8>) -> tensor<1x10xi8>
%2 = "tosa.add"(%1, %0) : (tensor<1x10xi8>, tensor<1x10xi8>) -> tensor<1x10xi8> %2 = "tosa.add"(%1, %0) : (tensor<1x10xi8>, tensor<1x10xi8>) -> tensor<1x10xi8>
// CHECK: return %2, %3 : tensor<1x10xi8>, !hlscpp.stream<i1, 1> // CHECK: return %2, %3 : tensor<1x10xi8>, !hls.stream<i1, 1>
return %2 : tensor<1x10xi8> return %2 : tensor<1x10xi8>
} }
// CHECK: func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> { // CHECK: func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> {
func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> { func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> {
// CHECK: %0:2 = call @forward_node0(%arg0) : (tensor<1x3x32x32xi8>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) // CHECK: %0:2 = call @forward_node0(%arg0) : (tensor<1x3x32x32xi8>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>)
%0 = call @forward_node0(%arg0) : (tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8> %0 = call @forward_node0(%arg0) : (tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8>
// CHECK: %1:2 = call @forward_node1(%0#0, %0#1) : (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) // CHECK: %1:2 = call @forward_node1(%0#0, %0#1) : (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>)
%1 = call @forward_node1(%0) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %1 = call @forward_node1(%0) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: %2:2 = call @forward_node2(%1#0, %1#1) : (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) // CHECK: %2:2 = call @forward_node2(%1#0, %1#1) : (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>)
%2 = call @forward_node2(%1) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %2 = call @forward_node2(%1) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: %3:2 = call @forward_node3(%2#0, %0#0, %0#1, %2#1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) // CHECK: %3:2 = call @forward_node3(%2#0, %0#0, %0#1, %2#1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>, !hls.stream<i1, 1>, !hls.stream<i1, 1>) -> (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>)
%3 = call @forward_node3(%2, %0) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %3 = call @forward_node3(%2, %0) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK: %4:2 = call @forward_node4(%3#0, %3#1) : (tensor<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) -> (tensor<1x1x1x64xi8>, !hlscpp.stream<i1, 1>) // CHECK: %4:2 = call @forward_node4(%3#0, %3#1) : (tensor<1x32x32x64xi8>, !hls.stream<i1, 1>) -> (tensor<1x1x1x64xi8>, !hls.stream<i1, 1>)
%4 = call @forward_node4(%3) : (tensor<1x32x32x64xi8>) -> tensor<1x1x1x64xi8> %4 = call @forward_node4(%3) : (tensor<1x32x32x64xi8>) -> tensor<1x1x1x64xi8>
// CHECK: %5:2 = call @forward_node5(%4#0, %4#1) : (tensor<1x1x1x64xi8>, !hlscpp.stream<i1, 1>) -> (tensor<1x1x10xi8>, !hlscpp.stream<i1, 1>) // CHECK: %5:2 = call @forward_node5(%4#0, %4#1) : (tensor<1x1x1x64xi8>, !hls.stream<i1, 1>) -> (tensor<1x1x10xi8>, !hls.stream<i1, 1>)
%5 = call @forward_node5(%4) : (tensor<1x1x1x64xi8>) -> tensor<1x1x10xi8> %5 = call @forward_node5(%4) : (tensor<1x1x1x64xi8>) -> tensor<1x1x10xi8>
// CHECK: %6:2 = call @forward_node6(%5#0, %5#1) : (tensor<1x1x10xi8>, !hlscpp.stream<i1, 1>) -> (tensor<1x10xi8>, !hlscpp.stream<i1, 1>) // CHECK: %6:2 = call @forward_node6(%5#0, %5#1) : (tensor<1x1x10xi8>, !hls.stream<i1, 1>) -> (tensor<1x10xi8>, !hls.stream<i1, 1>)
%6 = call @forward_node6(%5) : (tensor<1x1x10xi8>) -> tensor<1x10xi8> %6 = call @forward_node6(%5) : (tensor<1x1x10xi8>) -> tensor<1x10xi8>
// CHECK: return %6#0 : tensor<1x10xi8> // CHECK: return %6#0 : tensor<1x10xi8>

View File

@ -1,44 +1,44 @@
// RUN: scalehls-opt -scalehls-func-dataflow="gran=3 target-func=forward" -split-input-file %s | FileCheck %s // RUN: scalehls-opt -scalehls-func-dataflow="gran=3 target-func=forward" -split-input-file %s | FileCheck %s
module { module {
// CHECK: func @forward_dataflow2(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x1x64xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward_dataflow2(%arg0: tensor<1x32x32x64xi8>) -> tensor<1x1x64xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CHECK: %1 = "tosa.avg_pool2d" // CHECK: %1 = "tosa.avg_pool2d"
// CHECK: %2 = "tosa.transpose" // CHECK: %2 = "tosa.transpose"
// CHECK: %3 = "tosa.reshape" // CHECK: %3 = "tosa.reshape"
// CHECK: return %3 : tensor<1x1x64xi8> // CHECK: return %3 : tensor<1x1x64xi8>
// CHECK: } // CHECK: }
// CHECK: func @forward_dataflow4(%arg0: tensor<1x32x32x64xi8>) -> (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward_dataflow4(%arg0: tensor<1x32x32x64xi8>) -> (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CHECK: %2 = "tosa.clamp" // CHECK: %2 = "tosa.clamp"
// CHECK: %3 = "tosa.conv2d" // CHECK: %3 = "tosa.conv2d"
// CHECK: %4 = "tosa.clamp" // CHECK: %4 = "tosa.clamp"
// CHECK: %5 = "hlscpp.buffer" // CHECK: %5 = "hls.buffer"
// CHECK: %6 = "hlscpp.buffer" // CHECK: %6 = "hls.buffer"
// CHECK: return %4, %6 // CHECK: return %4, %6
// CHECK: } // CHECK: }
// CHECK: func @forward_dataflow1(%arg0: tensor<1x1x64xi8>) -> tensor<1x10xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward_dataflow1(%arg0: tensor<1x1x64xi8>) -> tensor<1x10xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CHECK: %2 = "tosa.matmul" // CHECK: %2 = "tosa.matmul"
// CHECK: %3 = "tosa.reshape" // CHECK: %3 = "tosa.reshape"
// CHECK: %4 = "tosa.add" // CHECK: %4 = "tosa.add"
// CHECK: return %4 // CHECK: return %4
// CHECK: } // CHECK: }
// CHECK: func @forward_dataflow3(%arg0: tensor<1x32x32x64xi8>, %arg1: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward_dataflow3(%arg0: tensor<1x32x32x64xi8>, %arg1: tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CHECK: %2 = "tosa.conv2d" // CHECK: %2 = "tosa.conv2d"
// CHECK: %3 = "hlscpp.buffer" // CHECK: %3 = "hls.buffer"
// CHECK: %4 = "tosa.add" // CHECK: %4 = "tosa.add"
// CHECK: %5 = "tosa.clamp" // CHECK: %5 = "tosa.clamp"
// CHECK: return %5 // CHECK: return %5
// CHECK: } // CHECK: }
// CHECK: func @forward_dataflow5(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward_dataflow5(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CHECK: %3 = "tosa.transpose" // CHECK: %3 = "tosa.transpose"
// CHECK: %4 = "tosa.conv2d" // CHECK: %4 = "tosa.conv2d"
// CHECK: return %4 // CHECK: return %4
// CHECK: } // CHECK: }
// CHECK: func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> { func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> {
// CHECK-NOT: %0 = "tosa.const"() {value = dense<0> : tensor<1x10xi8>} : () -> tensor<1x10xi8> // CHECK-NOT: %0 = "tosa.const"() {value = dense<0> : tensor<1x10xi8>} : () -> tensor<1x10xi8>
// CHECK-NOT: %1 = "tosa.const"() {value = dense<1> : tensor<1x64x10xi8>} : () -> tensor<1x64x10xi8> // CHECK-NOT: %1 = "tosa.const"() {value = dense<1> : tensor<1x64x10xi8>} : () -> tensor<1x64x10xi8>
@ -90,80 +90,80 @@ module {
// RUN: scalehls-opt -scalehls-func-dataflow="target-func=forward" -split-input-file %s | FileCheck %s --check-prefix=CALL // RUN: scalehls-opt -scalehls-func-dataflow="target-func=forward" -split-input-file %s | FileCheck %s --check-prefix=CALL
module { module {
func private @forward_node0(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node0(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
func private @forward_node1(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node1(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
func private @forward_node2(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node2(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
func private @forward_node3(%arg0: memref<1x32x32x64xi8>, %arg1: memref<1x32x32x64xi8>, %arg2: !hlscpp.stream<i1, 1>, %arg3: !hlscpp.stream<i1, 1>, %arg4: memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node3(%arg0: memref<1x32x32x64xi8>, %arg1: memref<1x32x32x64xi8>, %arg2: !hls.stream<i1, 1>, %arg3: !hls.stream<i1, 1>, %arg4: memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
func private @forward_node4(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x1x1x64xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node4(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x1x1x64xi8>) -> !hls.stream<i1, 1>
func private @forward_node5(%arg0: memref<1x1x1x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x64x10xi8>, %arg3: memref<1x1x10xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node5(%arg0: memref<1x1x1x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x64x10xi8>, %arg3: memref<1x1x10xi8>) -> !hls.stream<i1, 1>
func private @forward_node6(%arg0: memref<1x1x10xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x10xi8>) -> !hlscpp.stream<i1, 1> func private @forward_node6(%arg0: memref<1x1x10xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x10xi8>) -> !hls.stream<i1, 1>
// CALL: func @forward_dataflow7(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow7(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<1x32x32x64xi8>) -> !hls.stream<i1, 1> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node0(%arg0, %arg1, %arg2) : (memref<1x3x32x32xi8>, memref<3x3x3x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node0(%arg0, %arg1, %arg2) : (memref<1x3x32x32xi8>, memref<3x3x3x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
// CALL: return %0 : !hlscpp.stream<i1, 1> // CALL: return %0 : !hls.stream<i1, 1>
// CALL: } // CALL: }
// CALL: func @forward_dataflow2(%arg0: memref<1x1x1x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x64x10xi8>, %arg3: memref<1x1x10xi8>) -> !hlscpp.stream<i1, 1> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow2(%arg0: memref<1x1x1x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x64x10xi8>, %arg3: memref<1x1x10xi8>) -> !hls.stream<i1, 1> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node5(%arg0, %arg1, %arg2, %arg3) : (memref<1x1x1x64xi8>, !hlscpp.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node5(%arg0, %arg1, %arg2, %arg3) : (memref<1x1x1x64xi8>, !hls.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>) -> !hls.stream<i1, 1>
// CALL: return %0 : !hlscpp.stream<i1, 1> // CALL: return %0 : !hls.stream<i1, 1>
// CALL: } // CALL: }
// CALL: func @forward_dataflow4(%arg0: memref<1x32x32x64xi8>, %arg1: memref<1x32x32x64xi8>, %arg2: !hlscpp.stream<i1, 1>, %arg3: !hlscpp.stream<i1, 1>, %arg4: memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow4(%arg0: memref<1x32x32x64xi8>, %arg1: memref<1x32x32x64xi8>, %arg2: !hls.stream<i1, 1>, %arg3: !hls.stream<i1, 1>, %arg4: memref<1x32x32x64xi8>) -> !hls.stream<i1, 1> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node3(%arg0, %arg1, %arg2, %arg3, %arg4) : (memref<1x32x32x64xi8>, memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node3(%arg0, %arg1, %arg2, %arg3, %arg4) : (memref<1x32x32x64xi8>, memref<1x32x32x64xi8>, !hls.stream<i1, 1>, !hls.stream<i1, 1>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
// CALL: return %0 : !hlscpp.stream<i1, 1> // CALL: return %0 : !hls.stream<i1, 1>
// CALL: } // CALL: }
// CALL: func @forward_dataflow6(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>) -> (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow6(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>) -> (!hls.stream<i1, 1>, !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node1(%arg0, %arg1, %arg2, %arg3) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node1(%arg0, %arg1, %arg2, %arg3) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
// CALL: %1 = "hlscpp.stream.buffer"(%arg1) : (!hlscpp.stream<i1, 1>) -> !hlscpp.stream<i1, 1> // CALL: %1 = "hls.stream.buffer"(%arg1) : (!hls.stream<i1, 1>) -> !hls.stream<i1, 1>
// CALL: return %0, %1 : !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1> // CALL: return %0, %1 : !hls.stream<i1, 1>, !hls.stream<i1, 1>
// CALL: } // CALL: }
// CALL: func @forward_dataflow1(%arg0: memref<1x1x10xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x10xi8>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow1(%arg0: memref<1x1x10xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x10xi8>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node6(%arg0, %arg1, %arg2) : (memref<1x1x10xi8>, !hlscpp.stream<i1, 1>, memref<1x10xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node6(%arg0, %arg1, %arg2) : (memref<1x1x10xi8>, !hls.stream<i1, 1>, memref<1x10xi8>) -> !hls.stream<i1, 1>
// CALL: return // CALL: return
// CALL: } // CALL: }
// CALL: func @forward_dataflow3(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x1x1x64xi8>) -> !hlscpp.stream<i1, 1> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow3(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x1x1x64xi8>) -> !hls.stream<i1, 1> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node4(%arg0, %arg1, %arg2) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<1x1x1x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node4(%arg0, %arg1, %arg2) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<1x1x1x64xi8>) -> !hls.stream<i1, 1>
// CALL: return %0 : !hlscpp.stream<i1, 1> // CALL: return %0 : !hls.stream<i1, 1>
// CALL: } // CALL: }
// CALL: func @forward_dataflow5(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>, %arg4: !hlscpp.stream<i1, 1>) -> (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CALL: func @forward_dataflow5(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<1x32x32x64xi8>, %arg4: !hls.stream<i1, 1>) -> (!hls.stream<i1, 1>, !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
// CALL: %0 = call @forward_node2(%arg0, %arg1, %arg2, %arg3) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %0 = call @forward_node2(%arg0, %arg1, %arg2, %arg3) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
// CALL: %1 = "hlscpp.stream.buffer"(%arg4) : (!hlscpp.stream<i1, 1>) -> !hlscpp.stream<i1, 1> // CALL: %1 = "hls.stream.buffer"(%arg4) : (!hls.stream<i1, 1>) -> !hls.stream<i1, 1>
// CALL: return %0, %1 : !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1> // CALL: return %0, %1 : !hls.stream<i1, 1>, !hls.stream<i1, 1>
// CALL: } // CALL: }
// CALL: func @forward(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<3x3x64x64xi8>, %arg4: memref<1x64x10xi8>, %arg5: memref<1x10xi8>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>, top_func} { // CALL: func @forward(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<3x3x64x64xi8>, %arg4: memref<1x64x10xi8>, %arg5: memref<1x10xi8>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>, top_func} {
func @forward(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<3x3x64x64xi8>, %arg4: memref<1x64x10xi8>, %arg5: memref<1x10xi8>) attributes {top_func} { func @forward(%arg0: memref<1x3x32x32xi8>, %arg1: memref<3x3x3x64xi8>, %arg2: memref<3x3x64x64xi8>, %arg3: memref<3x3x64x64xi8>, %arg4: memref<1x64x10xi8>, %arg5: memref<1x10xi8>) attributes {top_func} {
%0 = memref.alloc() : memref<1x32x32x64xi8> %0 = memref.alloc() : memref<1x32x32x64xi8>
// CALL: %1 = call @forward_dataflow7(%arg0, %arg1, %0) : (memref<1x3x32x32xi8>, memref<3x3x3x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %1 = call @forward_dataflow7(%arg0, %arg1, %0) : (memref<1x3x32x32xi8>, memref<3x3x3x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
%1 = call @forward_node0(%arg0, %arg1, %0) : (memref<1x3x32x32xi8>, memref<3x3x3x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> %1 = call @forward_node0(%arg0, %arg1, %0) : (memref<1x3x32x32xi8>, memref<3x3x3x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
%2 = memref.alloc() : memref<1x32x32x64xi8> %2 = memref.alloc() : memref<1x32x32x64xi8>
// CALL: %5:2 = call @forward_dataflow6(%0, %1, %arg2, %2) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) // CALL: %5:2 = call @forward_dataflow6(%0, %1, %arg2, %2) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> (!hls.stream<i1, 1>, !hls.stream<i1, 1>)
%3 = call @forward_node1(%0, %1, %arg2, %2) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> %3 = call @forward_node1(%0, %1, %arg2, %2) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
%4 = memref.alloc() : memref<1x32x32x64xi8> %4 = memref.alloc() : memref<1x32x32x64xi8>
// CALL: %6:2 = call @forward_dataflow5(%2, %5#0, %arg3, %3, %5#1) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>) -> (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) // CALL: %6:2 = call @forward_dataflow5(%2, %5#0, %arg3, %3, %5#1) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>, !hls.stream<i1, 1>) -> (!hls.stream<i1, 1>, !hls.stream<i1, 1>)
%5 = call @forward_node2(%2, %3, %arg3, %4) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> %5 = call @forward_node2(%2, %3, %arg3, %4) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<3x3x64x64xi8>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
%6 = memref.alloc() : memref<1x32x32x64xi8> %6 = memref.alloc() : memref<1x32x32x64xi8>
// CALL: %7 = call @forward_dataflow4(%3, %0, %6#1, %6#0, %4) : (memref<1x32x32x64xi8>, memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %7 = call @forward_dataflow4(%3, %0, %6#1, %6#0, %4) : (memref<1x32x32x64xi8>, memref<1x32x32x64xi8>, !hls.stream<i1, 1>, !hls.stream<i1, 1>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
%7 = call @forward_node3(%4, %0, %1, %5, %6) : (memref<1x32x32x64xi8>, memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>, memref<1x32x32x64xi8>) -> !hlscpp.stream<i1, 1> %7 = call @forward_node3(%4, %0, %1, %5, %6) : (memref<1x32x32x64xi8>, memref<1x32x32x64xi8>, !hls.stream<i1, 1>, !hls.stream<i1, 1>, memref<1x32x32x64xi8>) -> !hls.stream<i1, 1>
%8 = memref.alloc() : memref<1x1x1x64xi8> %8 = memref.alloc() : memref<1x1x1x64xi8>
// CALL: %9 = call @forward_dataflow3(%4, %7, %8) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<1x1x1x64xi8>) -> !hlscpp.stream<i1, 1> // CALL: %9 = call @forward_dataflow3(%4, %7, %8) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<1x1x1x64xi8>) -> !hls.stream<i1, 1>
%9 = call @forward_node4(%6, %7, %8) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<1x1x1x64xi8>) -> !hlscpp.stream<i1, 1> %9 = call @forward_node4(%6, %7, %8) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<1x1x1x64xi8>) -> !hls.stream<i1, 1>
%10 = memref.alloc() : memref<1x1x10xi8> %10 = memref.alloc() : memref<1x1x10xi8>
// CALL: %11 = call @forward_dataflow2(%8, %9, %arg4, %10) : (memref<1x1x1x64xi8>, !hlscpp.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>) -> !hlscpp.stream<i1, 1> // CALL: %11 = call @forward_dataflow2(%8, %9, %arg4, %10) : (memref<1x1x1x64xi8>, !hls.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>) -> !hls.stream<i1, 1>
%11 = call @forward_node5(%8, %9, %arg4, %10) : (memref<1x1x1x64xi8>, !hlscpp.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>) -> !hlscpp.stream<i1, 1> %11 = call @forward_node5(%8, %9, %arg4, %10) : (memref<1x1x1x64xi8>, !hls.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>) -> !hls.stream<i1, 1>
// CALL: call @forward_dataflow1(%10, %11, %arg5) : (memref<1x1x10xi8>, !hlscpp.stream<i1, 1>, memref<1x10xi8>) -> () // CALL: call @forward_dataflow1(%10, %11, %arg5) : (memref<1x1x10xi8>, !hls.stream<i1, 1>, memref<1x10xi8>) -> ()
%12 = call @forward_node6(%10, %11, %arg5) : (memref<1x1x10xi8>, !hlscpp.stream<i1, 1>, memref<1x10xi8>) -> !hlscpp.stream<i1, 1> %12 = call @forward_node6(%10, %11, %arg5) : (memref<1x1x10xi8>, !hls.stream<i1, 1>, memref<1x10xi8>) -> !hls.stream<i1, 1>
return return
} }
} }

View File

@ -1,33 +1,33 @@
// RUN: scalehls-opt -scalehls-hoist-stream-channel %s | FileCheck %s // RUN: scalehls-opt -scalehls-hoist-stream-channel %s | FileCheck %s
// CHECK: module { // CHECK: module {
// CHECK: func @forward_dataflow5(%arg0: !hlscpp.stream<i1, 1>, %arg1: !hlscpp.stream<i1, 1>, %arg2: !hlscpp.stream<i1, 1>, %arg3: !hlscpp.stream<i1, 1>) { // CHECK: func @forward_dataflow5(%arg0: !hls.stream<i1, 1>, %arg1: !hls.stream<i1, 1>, %arg2: !hls.stream<i1, 1>, %arg3: !hls.stream<i1, 1>) {
// CHECK: %false = arith.constant false // CHECK: %false = arith.constant false
// CHECK: "hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
// CHECK: "hlscpp.stream.read"(%arg0) : (!hlscpp.stream<i1, 1>) -> () // CHECK: "hls.stream.read"(%arg0) : (!hls.stream<i1, 1>) -> ()
// CHECK: "hlscpp.stream.write"(%arg2, %false) : (!hlscpp.stream<i1, 1>, i1) -> () // CHECK: "hls.stream.write"(%arg2, %false) : (!hls.stream<i1, 1>, i1) -> ()
// CHECK: "hlscpp.stream.write"(%arg3, %false) : (!hlscpp.stream<i1, 1>, i1) -> () // CHECK: "hls.stream.write"(%arg3, %false) : (!hls.stream<i1, 1>, i1) -> ()
// CHECK: return // CHECK: return
// CHECK: } // CHECK: }
// CHECK: func @forward(%arg0: !hlscpp.stream<i1, 1>, %arg1: !hlscpp.stream<i1, 1>) { // CHECK: func @forward(%arg0: !hls.stream<i1, 1>, %arg1: !hls.stream<i1, 1>) {
// CHECK: %0 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> // CHECK: %0 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
// CHECK: %1 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> // CHECK: %1 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
// CHECK: call @forward_dataflow5(%arg0, %arg1, %0, %1) : (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) -> () // CHECK: call @forward_dataflow5(%arg0, %arg1, %0, %1) : (!hls.stream<i1, 1>, !hls.stream<i1, 1>, !hls.stream<i1, 1>, !hls.stream<i1, 1>) -> ()
// CHECK: return // CHECK: return
// CHECK: } // CHECK: }
// CHECK: } // CHECK: }
module { module {
func @forward_dataflow5(%arg0: !hlscpp.stream<i1, 1>, %arg1: !hlscpp.stream<i1, 1>) -> (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) { func @forward_dataflow5(%arg0: !hls.stream<i1, 1>, %arg1: !hls.stream<i1, 1>) -> (!hls.stream<i1, 1>, !hls.stream<i1, 1>) {
%false = arith.constant false %false = arith.constant false
"hlscpp.stream.read"(%arg0) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg0) : (!hls.stream<i1, 1>) -> ()
%0 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> %0 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
"hlscpp.stream.write"(%0, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%0, %false) : (!hls.stream<i1, 1>, i1) -> ()
%1 = "hlscpp.stream.buffer"(%arg1) : (!hlscpp.stream<i1, 1>) -> !hlscpp.stream<i1, 1> %1 = "hls.stream.buffer"(%arg1) : (!hls.stream<i1, 1>) -> !hls.stream<i1, 1>
return %0, %1 : !hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1> return %0, %1 : !hls.stream<i1, 1>, !hls.stream<i1, 1>
} }
func @forward(%arg0: !hlscpp.stream<i1, 1>, %arg1: !hlscpp.stream<i1, 1>) { func @forward(%arg0: !hls.stream<i1, 1>, %arg1: !hls.stream<i1, 1>) {
%0:2 = call @forward_dataflow5(%arg0, %arg1) : (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) -> (!hlscpp.stream<i1, 1>, !hlscpp.stream<i1, 1>) %0:2 = call @forward_dataflow5(%arg0, %arg1) : (!hls.stream<i1, 1>, !hls.stream<i1, 1>) -> (!hls.stream<i1, 1>, !hls.stream<i1, 1>)
return return
} }
} }

View File

@ -8,15 +8,15 @@
#set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)> #set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)>
#set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)> #set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)>
module { module {
// CHECK: func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hlscpp.stream<i1, 1>, %arg5: !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { // CHECK: func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hls.stream<i1, 1>, %arg5: !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hlscpp.stream<i1, 1>, %arg5: !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hls.stream<i1, 1>, %arg5: !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
%c127_i8 = arith.constant 127 : i8 %c127_i8 = arith.constant 127 : i8
%cst = arith.constant dense<5> : tensor<64xi8> %cst = arith.constant dense<5> : tensor<64xi8>
%c0_i8 = arith.constant 0 : i8 %c0_i8 = arith.constant 0 : i8
%false = arith.constant false %false = arith.constant false
%0 = memref.alloc() : memref<1x1x1x1xi8> %0 = memref.alloc() : memref<1x1x1x1xi8>
%1 = bufferization.to_memref %cst : memref<64xi8> %1 = bufferization.to_memref %cst : memref<64xi8>
"hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
%2 = memref.alloc() : memref<1x4x4x4xi8> %2 = memref.alloc() : memref<1x4x4x4xi8>
%3 = memref.alloc() : memref<1x1x4x4xi8> %3 = memref.alloc() : memref<1x1x4x4xi8>
%4 = memref.alloc() : memref<1x4x4x4xi8> %4 = memref.alloc() : memref<1x4x4x4xi8>
@ -30,7 +30,7 @@ module {
// CHECK: call @loop0_dataflow3 // CHECK: call @loop0_dataflow3
// CHECK: call @loop0_dataflow2 // CHECK: call @loop0_dataflow2
// CHECK: call @loop0_dataflow1 // CHECK: call @loop0_dataflow1
// CHECK: } {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=true, flatten=false>} // CHECK: } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=true, flatten=false>}
affine.for %arg11 = 0 to 16 { affine.for %arg11 = 0 to 16 {
affine.for %arg12 = 0 to 4 { affine.for %arg12 = 0 to 4 {
affine.for %arg13 = 0 to 4 { affine.for %arg13 = 0 to 4 {
@ -87,8 +87,8 @@ module {
} }
} }
} }
"hlscpp.stream.write"(%arg4, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg4, %false) : (!hls.stream<i1, 1>, i1) -> ()
"hlscpp.stream.write"(%arg5, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg5, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
} }

View File

@ -9,14 +9,14 @@
#set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)> #set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)>
#set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)> #set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)>
module { module {
func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hlscpp.stream<i1, 1>, %arg5: !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hls.stream<i1, 1>, %arg5: !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
%false = arith.constant false %false = arith.constant false
%c0_i8 = arith.constant 0 : i8 %c0_i8 = arith.constant 0 : i8
%cst = arith.constant dense<5> : tensor<64xi8> %cst = arith.constant dense<5> : tensor<64xi8>
%c127_i8 = arith.constant 127 : i8 %c127_i8 = arith.constant 127 : i8
%0 = memref.alloc() : memref<1x1x1x1xi8> %0 = memref.alloc() : memref<1x1x1x1xi8>
%1 = bufferization.to_memref %cst : memref<64xi8> %1 = bufferization.to_memref %cst : memref<64xi8>
"hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
// CHECK: affine.for %arg6 = 0 to 32 step 4 { // CHECK: affine.for %arg6 = 0 to 32 step 4 {
// CHECK: affine.for %arg7 = 0 to 32 step 4 { // CHECK: affine.for %arg7 = 0 to 32 step 4 {
@ -67,8 +67,8 @@ module {
} }
} }
} }
"hlscpp.stream.write"(%arg4, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg4, %false) : (!hls.stream<i1, 1>, i1) -> ()
"hlscpp.stream.write"(%arg5, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg5, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
} }

View File

@ -28,11 +28,11 @@ module {
} }
// CHECK-NOT: %[[VAL2:.*]] = bufferization.to_tensor %[[VAL0:.*]] : memref<1x32x32x64xi8> // CHECK-NOT: %[[VAL2:.*]] = bufferization.to_tensor %[[VAL0:.*]] : memref<1x32x32x64xi8>
// CHECK-NOT: %[[VAL3:.*]] = "hlscpp.buffer"(%[[VAL2:.*]]) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> // CHECK-NOT: %[[VAL3:.*]] = "hls.buffer"(%[[VAL2:.*]]) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
// CHECK-NOT: %[[VAL4:.*]] = bufferization.to_memref %[[VAL3:.*]] : memref<1x32x32x64xi8> // CHECK-NOT: %[[VAL4:.*]] = bufferization.to_memref %[[VAL3:.*]] : memref<1x32x32x64xi8>
// CHECK-NOT: memref.copy %[[VAL4:.*]], %arg1 : memref<1x32x32x64xi8> to memref<1x32x32x64xi8> // CHECK-NOT: memref.copy %[[VAL4:.*]], %arg1 : memref<1x32x32x64xi8> to memref<1x32x32x64xi8>
%2 = bufferization.to_tensor %1 : memref<1x32x32x64xi8> %2 = bufferization.to_tensor %1 : memref<1x32x32x64xi8>
%10 = "hlscpp.buffer"(%2) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %10 = "hls.buffer"(%2) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
%11 = bufferization.to_memref %10 : memref<1x32x32x64xi8> %11 = bufferization.to_memref %10 : memref<1x32x32x64xi8>
memref.copy %11, %arg1 : memref<1x32x32x64xi8> to memref<1x32x32x64xi8> memref.copy %11, %arg1 : memref<1x32x32x64xi8> to memref<1x32x32x64xi8>
return return

View File

@ -53,9 +53,9 @@ func @test_buffer(%arg0: f32, %arg1: memref<16xf32, 1>) -> (f32, memref<16xf32,
%cst = arith.constant dense<[[11, 0], [0, -42]]> : tensor<2x2xi32> %cst = arith.constant dense<[[11, 0], [0, -42]]> : tensor<2x2xi32>
%cst_memref = bufferization.to_memref %cst : memref<2x2xi32, 1> %cst_memref = bufferization.to_memref %cst : memref<2x2xi32, 1>
// CHECK: %1 = "hlscpp.buffer"(%arg0) : (f32) -> f32 // CHECK: %1 = "hls.buffer"(%arg0) : (f32) -> f32
// CHECK: %2 = "hlscpp.buffer"(%arg1) : (memref<16xf32, 1>) -> memref<16xf32, 1> // CHECK: %2 = "hls.buffer"(%arg1) : (memref<16xf32, 1>) -> memref<16xf32, 1>
// CHECK: %3 = "hlscpp.buffer"(%c11_i32) : (i32) -> i32 // CHECK: %3 = "hls.buffer"(%c11_i32) : (i32) -> i32
// CHECK: return %1, %2, %3, %0 : f32, memref<16xf32, 1>, i32, memref<2x2xi32, 1> // CHECK: return %1, %2, %3, %0 : f32, memref<16xf32, 1>, i32, memref<2x2xi32, 1>
return %arg0, %arg1, %c11_i32, %cst_memref : f32, memref<16xf32, 1>, i32, memref<2x2xi32, 1> return %arg0, %arg1, %c11_i32, %cst_memref : f32, memref<16xf32, 1>, i32, memref<2x2xi32, 1>
} }

View File

@ -4,7 +4,7 @@
#set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)> #set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)>
#set1 = affine_set<(d0) : (d0 == 0)> #set1 = affine_set<(d0) : (d0 == 0)>
module { module {
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, 1>, %arg3: memref<16x16xf32, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, 1>, %arg3: memref<16x16xf32, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -46,9 +46,9 @@ module {
%8 = arith.addf %7, %5 : f32 %8 = arith.addf %7, %5 : f32
affine.store %8, %arg3[%arg5, %arg6] : memref<16x16xf32, 1> affine.store %8, %arg3[%arg5, %arg6] : memref<16x16xf32, 1>
} }
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -4,7 +4,7 @@
#set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)> #set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)>
#set1 = affine_set<(d0) : (d0 == 0)> #set1 = affine_set<(d0) : (d0 == 0)>
module { module {
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, 1>, %arg3: memref<16x16xf32, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, 1>, %arg3: memref<16x16xf32, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -43,9 +43,9 @@ module {
%16 = arith.addf %15, %13 : f32 %16 = arith.addf %15, %13 : f32
affine.store %16, %arg3[%arg5, %arg6] : memref<16x16xf32, 1> affine.store %16, %arg3[%arg5, %arg6] : memref<16x16xf32, 1>
} }
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -13,14 +13,14 @@
#set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)> #set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)>
#set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)> #set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)>
module { module {
func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hlscpp.stream<i1, 1>, %arg5: !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hls.stream<i1, 1>, %arg5: !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
%c127_i8 = arith.constant 127 : i8 %c127_i8 = arith.constant 127 : i8
%cst = arith.constant dense<5> : tensor<64xi8> %cst = arith.constant dense<5> : tensor<64xi8>
%c0_i8 = arith.constant 0 : i8 %c0_i8 = arith.constant 0 : i8
%false = arith.constant false %false = arith.constant false
%0 = memref.alloc() : memref<1x1x1x1xi8> %0 = memref.alloc() : memref<1x1x1x1xi8>
%1 = bufferization.to_memref %cst : memref<64xi8> %1 = bufferization.to_memref %cst : memref<64xi8>
"hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
affine.for %arg6 = 0 to 8 { affine.for %arg6 = 0 to 8 {
affine.for %arg7 = 0 to 8 { affine.for %arg7 = 0 to 8 {
affine.for %arg8 = 0 to 16 { affine.for %arg8 = 0 to 16 {
@ -82,8 +82,8 @@ module {
} }
} }
} }
"hlscpp.stream.write"(%arg4, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg4, %false) : (!hls.stream<i1, 1>, i1) -> ()
"hlscpp.stream.write"(%arg5, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg5, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
} }

View File

@ -8,14 +8,14 @@
#set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)> #set0 = affine_set<(d0, d1, d2) : (d0 == 0, d1 == 0, d2 == 0)>
#set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)> #set1 = affine_set<(d0, d1, d2) : (-d0 + 2 == 0, -d1 + 2 == 0, -d2 + 63 == 0)>
module { module {
func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hlscpp.stream<i1, 1>, %arg5: !hlscpp.stream<i1, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { func @forward_dataflow6(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<3x3x64x64xi8, 3>, %arg3: memref<1x32x32x64xi8, 3>, %arg4: !hls.stream<i1, 1>, %arg5: !hls.stream<i1, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
%false = arith.constant false %false = arith.constant false
%c0_i8 = arith.constant 0 : i8 %c0_i8 = arith.constant 0 : i8
%cst = arith.constant dense<5> : tensor<64xi8> %cst = arith.constant dense<5> : tensor<64xi8>
%c127_i8 = arith.constant 127 : i8 %c127_i8 = arith.constant 127 : i8
%0 = memref.alloc() : memref<1x1x1x1xi8> %0 = memref.alloc() : memref<1x1x1x1xi8>
%1 = bufferization.to_memref %cst : memref<64xi8> %1 = bufferization.to_memref %cst : memref<64xi8>
"hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
affine.for %arg6 = 0 to 8 { affine.for %arg6 = 0 to 8 {
affine.for %arg7 = 0 to 8 { affine.for %arg7 = 0 to 8 {
affine.for %arg8 = 0 to 16 { affine.for %arg8 = 0 to 16 {
@ -74,8 +74,8 @@ module {
} }
} }
} }
"hlscpp.stream.write"(%arg4, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg4, %false) : (!hls.stream<i1, 1>, i1) -> ()
"hlscpp.stream.write"(%arg5, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg5, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
} }

View File

@ -4,7 +4,7 @@
#set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)> #set0 = affine_set<(d0, d1) : (d0 - d1 >= 0)>
#set1 = affine_set<(d0) : (d0 == 0)> #set1 = affine_set<(d0) : (d0 == 0)>
module { module {
func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, 1>, %arg3: memref<16x16xf32, 1>) attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} { func @test_syrk(%arg0: f32, %arg1: f32, %arg2: memref<16x16xf32, 1>, %arg3: memref<16x16xf32, 1>) attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=false>, top_func} {
affine.for %arg4 = 0 to 16 step 2 { affine.for %arg4 = 0 to 16 step 2 {
affine.for %arg5 = 0 to 16 { affine.for %arg5 = 0 to 16 {
affine.for %arg6 = 0 to 16 { affine.for %arg6 = 0 to 16 {
@ -43,9 +43,9 @@ module {
// CHECK: affine.store %[[VAL_15:.*]], %arg3[%arg5, %arg6] : memref<16x16xf32, 1> // CHECK: affine.store %[[VAL_15:.*]], %arg3[%arg5, %arg6] : memref<16x16xf32, 1>
affine.store %15, %arg3[%arg5, %arg6] : memref<16x16xf32, 1> affine.store %15, %arg3[%arg5, %arg6] : memref<16x16xf32, 1>
} }
} {loop_directive = #hlscpp.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel} } {loop_directive = #hls.ld<pipeline=true, targetII=2, dataflow=false, flatten=false>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>, parallel}
} {loop_directive = #hlscpp.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>} } {loop_directive = #hls.ld<pipeline=false, targetII=1, dataflow=false, flatten=true>}
return return
} }
} }

View File

@ -1,11 +1,11 @@
// RUN: scalehls-opt -scalehls-create-axi-interface %s | FileCheck %s // RUN: scalehls-opt -scalehls-create-axi-interface %s | FileCheck %s
module { module {
// CHECK: func @forward_dataflow2(%arg0: memref<1x1x1x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x64x10xi8, 3>, %arg3: memref<1x1x10xi8, 3>, %arg4: !hlscpp.stream<i1, 1>) { // CHECK: func @forward_dataflow2(%arg0: memref<1x1x1x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x64x10xi8, 3>, %arg3: memref<1x1x10xi8, 3>, %arg4: !hls.stream<i1, 1>) {
func @forward_dataflow2(%arg0: memref<1x1x1x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x64x10xi8>, %arg3: memref<1x1x10xi8>, %arg4: !hlscpp.stream<i1, 1>) { func @forward_dataflow2(%arg0: memref<1x1x1x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x64x10xi8>, %arg3: memref<1x1x10xi8>, %arg4: !hls.stream<i1, 1>) {
%false = arith.constant false %false = arith.constant false
%c0_i8 = arith.constant 0 : i8 %c0_i8 = arith.constant 0 : i8
"hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
affine.for %arg5 = 0 to 10 { affine.for %arg5 = 0 to 10 {
affine.store %c0_i8, %arg3[0, 0, %arg5] : memref<1x1x10xi8> affine.store %c0_i8, %arg3[0, 0, %arg5] : memref<1x1x10xi8>
affine.for %arg6 = 0 to 64 { affine.for %arg6 = 0 to 64 {
@ -17,12 +17,12 @@ module {
affine.store %4, %arg3[0, 0, %arg5] : memref<1x1x10xi8> affine.store %4, %arg3[0, 0, %arg5] : memref<1x1x10xi8>
} }
} }
"hlscpp.stream.write"(%arg4, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg4, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
// CHECK: func @forward_dataflow3(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x1x1x64xi8, 3>, %arg3: !hlscpp.stream<i1, 1>) { // CHECK: func @forward_dataflow3(%arg0: memref<1x32x32x64xi8, 3>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x1x1x64xi8, 3>, %arg3: !hls.stream<i1, 1>) {
func @forward_dataflow3(%arg0: memref<1x32x32x64xi8>, %arg1: !hlscpp.stream<i1, 1>, %arg2: memref<1x1x1x64xi8>, %arg3: !hlscpp.stream<i1, 1>) { func @forward_dataflow3(%arg0: memref<1x32x32x64xi8>, %arg1: !hls.stream<i1, 1>, %arg2: memref<1x1x1x64xi8>, %arg3: !hls.stream<i1, 1>) {
%false = arith.constant false %false = arith.constant false
%c127_i32 = arith.constant 127 : i32 %c127_i32 = arith.constant 127 : i32
%c-128_i32 = arith.constant -128 : i32 %c-128_i32 = arith.constant -128 : i32
@ -31,7 +31,7 @@ module {
%c1048576_i64 = arith.constant 1048576 : i64 %c1048576_i64 = arith.constant 1048576 : i64
%c30_i64 = arith.constant 30 : i64 %c30_i64 = arith.constant 30 : i64
%0 = memref.alloc() : memref<1x1x1x1xi32> %0 = memref.alloc() : memref<1x1x1x1xi32>
"hlscpp.stream.read"(%arg1) : (!hlscpp.stream<i1, 1>) -> () "hls.stream.read"(%arg1) : (!hls.stream<i1, 1>) -> ()
affine.for %arg4 = 0 to 64 { affine.for %arg4 = 0 to 64 {
affine.store %c0_i32, %0[0, 0, 0, 0] : memref<1x1x1x1xi32> affine.store %c0_i32, %0[0, 0, 0, 0] : memref<1x1x1x1xi32>
affine.for %arg5 = 0 to 32 { affine.for %arg5 = 0 to 32 {
@ -56,27 +56,27 @@ module {
%11 = arith.trunci %10 : i32 to i8 %11 = arith.trunci %10 : i32 to i8
affine.store %11, %arg2[0, 0, 0, %arg4] : memref<1x1x1x64xi8> affine.store %11, %arg2[0, 0, 0, %arg4] : memref<1x1x1x64xi8>
} }
"hlscpp.stream.write"(%arg3, %false) : (!hlscpp.stream<i1, 1>, i1) -> () "hls.stream.write"(%arg3, %false) : (!hls.stream<i1, 1>, i1) -> ()
return return
} }
// CHECK: func @forward(%arg0: memref<1x32x32x64xi8, 3>, %arg1: memref<1x64x10xi8, 3>, %arg2: memref<1x1x1x64xi8, 3>, %arg3: memref<1x1x10xi8, 3>) attributes {top_func} { // CHECK: func @forward(%arg0: memref<1x32x32x64xi8, 3>, %arg1: memref<1x64x10xi8, 3>, %arg2: memref<1x1x1x64xi8, 3>, %arg3: memref<1x1x10xi8, 3>) attributes {top_func} {
func @forward(%arg0: memref<1x32x32x64xi8>, %arg4: memref<1x64x10xi8>) attributes {top_func} { func @forward(%arg0: memref<1x32x32x64xi8>, %arg4: memref<1x64x10xi8>) attributes {top_func} {
%9 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> %9 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
// CHECK-NOT: memref.alloc() : memref<1x1x1x64xi8> // CHECK-NOT: memref.alloc() : memref<1x1x1x64xi8>
%10 = memref.alloc() : memref<1x1x1x64xi8> %10 = memref.alloc() : memref<1x1x1x64xi8>
%11 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> %11 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
// CHECK: call @forward_dataflow3(%arg0, %0, %arg2, %1) : (memref<1x32x32x64xi8, 3>, !hlscpp.stream<i1, 1>, memref<1x1x1x64xi8, 3>, !hlscpp.stream<i1, 1>) -> () // CHECK: call @forward_dataflow3(%arg0, %0, %arg2, %1) : (memref<1x32x32x64xi8, 3>, !hls.stream<i1, 1>, memref<1x1x1x64xi8, 3>, !hls.stream<i1, 1>) -> ()
call @forward_dataflow3(%arg0, %9, %10, %11) : (memref<1x32x32x64xi8>, !hlscpp.stream<i1, 1>, memref<1x1x1x64xi8>, !hlscpp.stream<i1, 1>) -> () call @forward_dataflow3(%arg0, %9, %10, %11) : (memref<1x32x32x64xi8>, !hls.stream<i1, 1>, memref<1x1x1x64xi8>, !hls.stream<i1, 1>) -> ()
// CHECK-NOT: memref.alloc() : memref<1x1x10xi8> // CHECK-NOT: memref.alloc() : memref<1x1x10xi8>
%12 = memref.alloc() : memref<1x1x10xi8> %12 = memref.alloc() : memref<1x1x10xi8>
%13 = "hlscpp.stream.channel"() : () -> !hlscpp.stream<i1, 1> %13 = "hls.stream.channel"() : () -> !hls.stream<i1, 1>
// CHECK: call @forward_dataflow2(%arg2, %1, %arg1, %arg3, %2) : (memref<1x1x1x64xi8, 3>, !hlscpp.stream<i1, 1>, memref<1x64x10xi8, 3>, memref<1x1x10xi8, 3>, !hlscpp.stream<i1, 1>) -> () // CHECK: call @forward_dataflow2(%arg2, %1, %arg1, %arg3, %2) : (memref<1x1x1x64xi8, 3>, !hls.stream<i1, 1>, memref<1x64x10xi8, 3>, memref<1x1x10xi8, 3>, !hls.stream<i1, 1>) -> ()
call @forward_dataflow2(%10, %11, %arg4, %12, %13) : (memref<1x1x1x64xi8>, !hlscpp.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>, !hlscpp.stream<i1, 1>) -> () call @forward_dataflow2(%10, %11, %arg4, %12, %13) : (memref<1x1x1x64xi8>, !hls.stream<i1, 1>, memref<1x64x10xi8>, memref<1x1x10xi8>, !hls.stream<i1, 1>) -> ()
return return
} }

View File

@ -18,7 +18,7 @@ module {
%0 = "tosa.clamp"(%arg0) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %0 = "tosa.clamp"(%arg0) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
%1 = "tosa.conv2d"(%0, %cst, %cst_0) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8> %1 = "tosa.conv2d"(%0, %cst, %cst_0) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8>
%2 = "tosa.clamp"(%1) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %2 = "tosa.clamp"(%1) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
%3 = "hlscpp.buffer"(%0) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %3 = "hls.buffer"(%0) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
return %2, %3 : tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8> return %2, %3 : tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>
} }
@ -40,7 +40,7 @@ module {
%cst = arith.constant dense<2> : tensor<64x3x3x64xi8> %cst = arith.constant dense<2> : tensor<64x3x3x64xi8>
%cst_0 = arith.constant dense<5> : tensor<64xi8> %cst_0 = arith.constant dense<5> : tensor<64xi8>
%0 = "tosa.conv2d"(%arg0, %cst, %cst_0) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8> %0 = "tosa.conv2d"(%arg0, %cst, %cst_0) {dilation = [1, 1], pad = [1, 1, 1, 1], quantization_info = {input_zp = 0 : i32, weight_zp = 0 : i32}, stride = [1, 1]} : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>, tensor<64xi8>) -> tensor<1x32x32x64xi8>
%1 = "hlscpp.buffer"(%arg1) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %1 = "hls.buffer"(%arg1) : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
%2 = "tosa.add"(%0, %1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %2 = "tosa.add"(%0, %1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
%3 = "tosa.clamp"(%2) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %3 = "tosa.clamp"(%2) {max_fp = 3.40282347E+38 : f32, max_int = 2147483647 : i64, min_fp = 0.000000e+00 : f32, min_int = 0 : i64} : (tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>
return %3 : tensor<1x32x32x64xi8> return %3 : tensor<1x32x32x64xi8>
@ -57,7 +57,7 @@ module {
return %1 : tensor<1x32x32x64xi8> return %1 : tensor<1x32x32x64xi8>
} }
// CHECK: func @forward(%arg0: tensor<1x3x32x32xi8>, %arg1: tensor<64x3x3x3xi8>, %arg2: tensor<64x3x3x64xi8>, %arg3: tensor<64x3x3x64xi8>, %arg4: tensor<1x64x10xi8>) -> tensor<1x10xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>, top_func} { // CHECK: func @forward(%arg0: tensor<1x3x32x32xi8>, %arg1: tensor<64x3x3x3xi8>, %arg2: tensor<64x3x3x64xi8>, %arg3: tensor<64x3x3x64xi8>, %arg4: tensor<1x64x10xi8>) -> tensor<1x10xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>, top_func} {
// CHECK: %0 = call @dataflow5(%arg0, %arg1) : (tensor<1x3x32x32xi8>, tensor<64x3x3x3xi8>) -> tensor<1x32x32x64xi8> // CHECK: %0 = call @dataflow5(%arg0, %arg1) : (tensor<1x3x32x32xi8>, tensor<64x3x3x3xi8>) -> tensor<1x32x32x64xi8>
// CHECK: %1:2 = call @dataflow4(%0, %arg2) : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>) -> (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) // CHECK: %1:2 = call @dataflow4(%0, %arg2) : (tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>) -> (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>)
// CHECK: %2 = call @dataflow3(%1#0, %1#1, %arg3) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>) -> tensor<1x32x32x64xi8> // CHECK: %2 = call @dataflow3(%1#0, %1#1, %arg3) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>, tensor<64x3x3x64xi8>) -> tensor<1x32x32x64xi8>
@ -65,7 +65,7 @@ module {
// CHECK: %4 = call @dataflow1(%3, %arg4) : (tensor<1x1x64xi8>, tensor<1x64x10xi8>) -> tensor<1x10xi8> // CHECK: %4 = call @dataflow1(%3, %arg4) : (tensor<1x1x64xi8>, tensor<1x64x10xi8>) -> tensor<1x10xi8>
// CHECK: return %4 : tensor<1x10xi8> // CHECK: return %4 : tensor<1x10xi8>
// CHECK: } // CHECK: }
func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> attributes {func_directive = #hlscpp.fd<pipeline=false, targetInterval=1, dataflow=true>} { func @forward(%arg0: tensor<1x3x32x32xi8>) -> tensor<1x10xi8> attributes {func_directive = #hls.fd<pipeline=false, targetInterval=1, dataflow=true>} {
%0 = call @dataflow5(%arg0) : (tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8> %0 = call @dataflow5(%arg0) : (tensor<1x3x32x32xi8>) -> tensor<1x32x32x64xi8>
%1:2 = call @dataflow4(%0) : (tensor<1x32x32x64xi8>) -> (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) %1:2 = call @dataflow4(%0) : (tensor<1x32x32x64xi8>) -> (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>)
%2 = call @dataflow3(%1#0, %1#1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8> %2 = call @dataflow3(%1#0, %1#1) : (tensor<1x32x32x64xi8>, tensor<1x32x32x64xi8>) -> tensor<1x32x32x64xi8>

View File

@ -13,7 +13,7 @@ target_link_libraries(scalehls-opt
${conversion_libs} ${conversion_libs}
MLIROptLib MLIROptLib
MLIRHLSCpp MLIRHLS
MLIRScaleHLSSupport MLIRScaleHLSSupport
MLIRScaleHLSTransforms MLIRScaleHLSTransforms

View File

@ -16,7 +16,7 @@ target_link_libraries(scalehls-translate
${dialect_libs} ${dialect_libs}
${translation_libs} ${translation_libs}
MLIRHLSCpp MLIRHLS
MLIRScaleHLSSupport MLIRScaleHLSSupport
MLIRScaleHLSEmitHLSCpp MLIRScaleHLSEmitHLSCpp
) )