mechanical rename hlsld to scalehls; update file structure

This commit is contained in:
Hanchen Ye 2020-09-06 18:05:16 -05:00
parent 417b10f68d
commit 1f4200e88a
45 changed files with 55 additions and 1057 deletions

View File

@ -1,2 +1 @@
BasedOnStyle: LLVM
AlwaysBreakTemplateDeclarations: Yes

View File

@ -13,7 +13,7 @@ if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
project(hlsld LANGUAGES CXX C)
project(scalehls LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
@ -27,12 +27,12 @@ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
set(MLIR_BINARY_DIR ${CMAKE_BINARY_DIR})
set(HLSLD_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include )
set(HLSLD_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include )
set(SCALEHLS_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include )
set(SCALEHLS_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include )
set(HLSLD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(HLSLD_BINARY_DIR ${CMAKE_BINARY_DIR}/bin)
set(HLSLD_TOOLS_DIR ${CMAKE_BINARY_DIR}/bin)
set(SCALEHLS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SCALEHLS_BINARY_DIR ${CMAKE_BINARY_DIR}/bin)
set(SCALEHLS_TOOLS_DIR ${CMAKE_BINARY_DIR}/bin)
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")

View File

@ -1,4 +1,4 @@
# HLS Large Design Project (HLSLD)
# ScaleHLS Project (SCALEHLS)
This project aims to create a framework that ultimately converts an algorithm written in a high level language into an efficient hardware implementation. With multiple levels of intermediate representations (IRs), MLIR appears to be the ideal tool for exploring ways to optimize the eventual design at various levels of abstraction (e.g. various levels of parallelism). Our framework will be based on MLIR, it will incorporate a backend for high level synthesis (HLS) C/C++ code. However, the key contribution will be our parametrization and optimization of a tremendously large design space.
@ -7,24 +7,24 @@ This setup assumes that you have built LLVM and MLIR in `$LLVM_BUILD_DIR`. To bu
```sh
mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$LLVM_BUILD_DIR/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$LLVM_BUILD_DIR/bin/llvm-lit
cmake --build . --target check-hlsld
cmake --build . --target check-scalehls
```
After the installation and test successfully completed, you should be able to run
```sh
bin/hlsld-translate -emit-hlscpp ../test/EmitHLSCpp/test_*.mlir
bin/scalehls-translate -emit-hlscpp ../test/EmitHLSCpp/test_*.mlir
```
## TODO List
### hlsld-translate: EmitHLSCpp
### scalehls-translate EmitHLSCpp
1. **Test HLS C++ emitter with some real benchmarks;**
2. **TODOs in EmitHLSCpp.cpp;**
3. **Create testcase for each important operation;**
4. Support memref/tensor cast/view/subview operations;
5. Support atomic/complex/extend -related operations.
### hlsld-opt
### scalehls-opt
1. Initial implementation.
### HLSCpp Dialect (?)
### HLSCpp Dialect
1. **Think about the dialect design.**
2. Initial implementation.

View File

@ -0,0 +1,2 @@
add_subdirectory(Conversion)
add_subdirectory(Dialect)

View File

View File

@ -0,0 +1 @@
add_subdirectory(HLSCpp)

View File

View File

@ -2,11 +2,11 @@
//
//===----------------------------------------------------------------------===//
#ifndef HLSLD_EMIT_HLSCPP_H
#define HLSLD_EMIT_HLSCPP_H
#ifndef SCALEHLS_EMIT_HLSCPP_H
#define SCALEHLS_EMIT_HLSCPP_H
namespace hlsld {
namespace scalehls {
void registerHLSCppEmitterTranslation();
} // namespace hlsld
} // namespace scalehls
#endif // HLSLD_EMIT_HLSCPP_H
#endif // SCALEHLS_EMIT_HLSCPP_H

View File

@ -1 +1,3 @@
add_subdirectory(Conversion)
add_subdirectory(Dialect)
add_subdirectory(EmitHLSCpp)

View File

View File

@ -0,0 +1 @@
add_subdirectory(HLSCpp)

View File

View File

@ -1,6 +1,6 @@
file(GLOB globbed *.cpp)
add_mlir_library(HLSLDEmitHLSCpp
add_mlir_library(SCALEHLSEmitHLSCpp
${globbed}
ADDITIONAL_HEADER_DIRS

View File

@ -311,8 +311,7 @@ public:
void emitAffineYield(AffineYieldOp *op);
/// Memref-related statement emitters.
template <typename OpType>
void emitAlloc(OpType *op);
template <typename OpType> void emitAlloc(OpType *op);
void emitLoad(LoadOp *op);
void emitStore(StoreOp *op);
@ -925,8 +924,7 @@ void ModuleEmitter::emitAffineYield(AffineYieldOp *op) {
}
/// Memref-related statement emitters.
template <typename OpType>
void ModuleEmitter::emitAlloc(OpType *op) {
template <typename OpType> void ModuleEmitter::emitAlloc(OpType *op) {
// This indicates that the memref is output of the function, and has been
// declared in the function signature.
if (isDeclared(op->getResult()))
@ -1315,7 +1313,7 @@ using namespace std;
}
//===----------------------------------------------------------------------===//
// Entry of hlsld-translate
// Entry of scalehls-translate
//===----------------------------------------------------------------------===//
static LogicalResult emitHLSCpp(ModuleOp module, llvm::raw_ostream &os) {
@ -1324,6 +1322,6 @@ static LogicalResult emitHLSCpp(ModuleOp module, llvm::raw_ostream &os) {
return failure(state.encounteredError);
}
void hlsld::registerHLSCppEmitterTranslation() {
void scalehls::registerHLSCppEmitterTranslation() {
static TranslateFromMLIRRegistration toHLSCpp("emit-hlscpp", emitHLSCpp);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,149 +0,0 @@
digraph "main_graph" {
label="main_graph";
Node0x55d78d48f320 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":19:19)\ni64\n\nvalue: 10240 : i64}"];
Node0x55d78d48f320 -> Node0x55d78d49a760;
Node0x55d78d45be40 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":20:11)\nindex\n\nvalue: 2 : index}"];
Node0x55d78d45be40 -> Node0x55d78d4a68e0;
Node0x55d78d45be40 -> Node0x55d78d4a6840;
Node0x55d78d45be40 -> Node0x55d78d4a2410;
Node0x55d78d45be40 -> Node0x55d78d4a22d0;
Node0x55d78d45be40 -> Node0x55d78d496fb0;
Node0x55d78d45be40 -> Node0x55d78d496eb0;
Node0x55d78d45b4e0 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":21:12)\nf32\n\nvalue: 0xFF800000 : f32}"];
Node0x55d78d45b4e0 -> Node0x55d78d4ab530;
Node0x55d78d45b4e0 -> Node0x55d78d4a0dd0;
Node0x55d78d45b1c0 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":22:11)\nindex\n\nvalue: 3 : index}"];
Node0x55d78d45b1c0 -> Node0x55d78d4abba0;
Node0x55d78d45b1c0 -> Node0x55d78d4aba20;
Node0x55d78d45a590 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":23:18)\ni64\n\nvalue: 1024 : i64}"];
Node0x55d78d45a590 -> Node0x55d78d4ad400;
Node0x55d78d431600 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":24:14)\nf32\n\nvalue: 1.000000e+00 : f32}"];
Node0x55d78d431600 -> Node0x55d78d4adeb0;
Node0x55d78d431600 -> Node0x55d78d4add50;
Node0x55d78d42a2f0 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":25:14)\nf32\n\nvalue: 0.000000e+00 : f32}"];
Node0x55d78d42a2f0 -> Node0x55d78d4aa340;
Node0x55d78d42a2f0 -> Node0x55d78d4aadb0;
Node0x55d78d42a2f0 -> Node0x55d78d4aacf0;
Node0x55d78d42a2f0 -> Node0x55d78d49cdf0;
Node0x55d78d42a2f0 -> Node0x55d78d4a6280;
Node0x55d78d42a2f0 -> Node0x55d78d4a0630;
Node0x55d78d42a2f0 -> Node0x55d78d4a0590;
Node0x55d78d42a2f0 -> Node0x55d78d49e160;
Node0x55d78d42a2f0 -> Node0x55d78d49c8a0;
Node0x55d78d496940 [shape=record,label="{std.constant\nloc(\"mnist_mlir.mlir\":26:11)\nindex\n\nvalue: 0 : index}"];
Node0x55d78d496940 -> Node0x55d78d4addf0;
Node0x55d78d496940 -> Node0x55d78d49fb50;
Node0x55d78d496940 -> Node0x55d78d49fb50;
Node0x55d78d496940 -> Node0x55d78d4aa420;
Node0x55d78d496940 -> Node0x55d78d42ee70;
Node0x55d78d496940 -> Node0x55d78d42ee70;
Node0x55d78d496940 -> Node0x55d78d49fc30;
Node0x55d78d497210 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":27:10)\nmemref\<1x10xf32\>\n}"];
Node0x55d78d497210 -> Node0x55d78d4ae7d0;
Node0x55d78d497210 -> Node0x55d78d4ad7d0;
Node0x55d78d497210 -> Node0x55d78d4adc90;
Node0x55d78d497210 -> Node0x55d78d42ec60;
Node0x55d78d497210 -> Node0x55d78d4ada30;
Node0x55d78d497210 -> Node0x55d78d4aa340;
Node0x55d78d4972d0 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":28:10)\nmemref\<1x256xf32\>\n}"];
Node0x55d78d4972d0 -> Node0x55d78d4ae750;
Node0x55d78d4972d0 -> Node0x55d78d4ad8b0;
Node0x55d78d4972d0 -> Node0x55d78d4ad400;
Node0x55d78d497390 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":29:10)\nmemref\<1x16x4x4xf32\>\n}"];
Node0x55d78d497390 -> Node0x55d78d4ae6d0;
Node0x55d78d497390 -> Node0x55d78d4ad400;
Node0x55d78d497390 -> Node0x55d78d4ac1b0;
Node0x55d78d497390 -> Node0x55d78d4abe90;
Node0x55d78d497390 -> Node0x55d78d4ab530;
Node0x55d78d497450 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":30:10)\nmemref\<1x16x14x14xf32\>\n}"];
Node0x55d78d497450 -> Node0x55d78d4ae650;
Node0x55d78d497450 -> Node0x55d78d4abd70;
Node0x55d78d497450 -> Node0x55d78d4aae70;
Node0x55d78d4964b0 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":31:10)\nmemref\<1x16x14x14xf32\>\n}"];
Node0x55d78d4964b0 -> Node0x55d78d4ae5d0;
Node0x55d78d4964b0 -> Node0x55d78d4aabd0;
Node0x55d78d4964b0 -> Node0x55d78d4aa5c0;
Node0x55d78d496570 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":32:10)\nmemref\<1x16x14x14xf32\>\n}"];
Node0x55d78d496570 -> Node0x55d78d4ae550;
Node0x55d78d496570 -> Node0x55d78d4aa420;
Node0x55d78d496570 -> Node0x55d78d4a9080;
Node0x55d78d496570 -> Node0x55d78d4a8e00;
Node0x55d78d496570 -> Node0x55d78d49cdf0;
Node0x55d78d497830 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":33:10)\nmemref\<1x8x18x18xf32\>\n}"];
Node0x55d78d497830 -> Node0x55d78d4ae4d0;
Node0x55d78d497830 -> Node0x55d78d49d6b0;
Node0x55d78d497830 -> Node0x55d78d4a6ad0;
Node0x55d78d497830 -> Node0x55d78d4a6280;
Node0x55d78d4978d0 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":34:10)\nmemref\<1x8x14x14xf32\>\n}"];
Node0x55d78d4978d0 -> Node0x55d78d4ae450;
Node0x55d78d4978d0 -> Node0x55d78d4a69d0;
Node0x55d78d4978d0 -> Node0x55d78d4a2a20;
Node0x55d78d4978d0 -> Node0x55d78d4a2700;
Node0x55d78d4978d0 -> Node0x55d78d4a0dd0;
Node0x55d78d497990 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":35:10)\nmemref\<1x8x28x28xf32\>\n}"];
Node0x55d78d497990 -> Node0x55d78d4ae3d0;
Node0x55d78d497990 -> Node0x55d78d4a25e0;
Node0x55d78d497990 -> Node0x55d78d4a0710;
Node0x55d78d497a50 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":36:10)\nmemref\<1x8x28x28xf32\>\n}"];
Node0x55d78d497a50 -> Node0x55d78d4ae350;
Node0x55d78d497a50 -> Node0x55d78d4a0490;
Node0x55d78d497a50 -> Node0x55d78d49fdd0;
Node0x55d78d497b10 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":37:11)\nmemref\<1x8x28x28xf32\>\n}"];
Node0x55d78d497b10 -> Node0x55d78d4ae2d0;
Node0x55d78d497b10 -> Node0x55d78d49fc30;
Node0x55d78d497b10 -> Node0x55d78d49f4c0;
Node0x55d78d497b10 -> Node0x55d78d49f180;
Node0x55d78d497b10 -> Node0x55d78d49e160;
Node0x55d78d497bd0 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":38:11)\nmemref\<1x1x32x32xf32\>\n}"];
Node0x55d78d497bd0 -> Node0x55d78d4ae250;
Node0x55d78d497bd0 -> Node0x55d78d49eec0;
Node0x55d78d497bd0 -> Node0x55d78d49daa0;
Node0x55d78d497bd0 -> Node0x55d78d49c8a0;
Node0x55d78d497c90 [shape=record,label="{std.alloc\nloc(\"mnist_mlir.mlir\":39:11)\nmemref\<256x10xf32\>\n}"];
Node0x55d78d497c90 -> Node0x55d78d4ae1d0;
Node0x55d78d497c90 -> Node0x55d78d4ad970;
Node0x55d78d497c90 -> Node0x55d78d49a760;
Node0x55d78d49a560 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":40:11)\nmemref\<16x4x4x10xf32\>\n\nname: \"constant_0\"\nshape: [16, 4, 4, 10]\nvalue: [[[[...]]]] : tensor\<16x4x4x10xf32\>}"];
Node0x55d78d49a560 -> Node0x55d78d49a760;
Node0x55d78d49a6b0 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":41:11)\nmemref\<2xi64\>\n\nname: \"constant_1\"\nshape: [2]\nvalue: dense\<[256, 10]\> : tensor\<2xi64\>}"];
Node0x55d78d49a760 [shape=record,label="{krnl.memcpy\nloc(\"mnist_mlir.mlir\":42:5)\n\n}"];
Node0x55d78d49b860 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":43:11)\nmemref\<8x1x5x5xf32\>\n\nname: \"constant_2\"\nshape: [8, 1, 5, 5]\nvalue: [[[[...]]]] : tensor\<8x1x5x5xf32\>}"];
Node0x55d78d49b860 -> Node0x55d78d49f020;
Node0x55d78d49c040 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":44:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d496a00 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":53:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d49f790 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":65:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d49dd40 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":88:11)\nmemref\<8x1x1xf32\>\n\nname: \"constant_3\"\nshape: [8, 1, 1]\nvalue: dense\<[[[-0.161539719]], [[-0.433835655]], [[0.091641359]], [[-0.0168522168]], [[-0.0650264397]], [[-0.131737873]], [[0.0204175506]], [[-0.121110231]]]\> : tensor\<8x1x1xf32\>}"];
Node0x55d78d49dd40 -> Node0x55d78d42ee70;
Node0x55d78d49ffe0 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":89:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4a0070 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":101:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4a0950 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":113:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4a0fe0 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":135:11)\nmemref\<16x8x5x5xf32\>\n\nname: \"constant_4\"\nshape: [16, 8, 5, 5]\nvalue: [[[[...]]]] : tensor\<16x8x5x5xf32\>}"];
Node0x55d78d4a0fe0 -> Node0x55d78d49d810;
Node0x55d78d4a6430 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":136:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4a64c0 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":145:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4a9350 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":157:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d49cce0 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":180:11)\nmemref\<16x1x1xf32\>\n\nname: \"constant_5\"\nshape: [16, 1, 1]\nvalue: dense\<[[[-0.0822488219]], [[-0.108868778]], [[-0.141039595]], [[-0.204869166]], [[-0.17913565]], [[-0.215438381]], [[-0.133805066]], [[-0.195724562]], [[-0.268250644]], [[-0.258212209]], [[-0.0761560649]], [[0.0132841459]], [[-0.00444464432]], [[-0.414740831]], [[-0.17879115]], [[-0.0386558883]]]\> : tensor\<16x1x1xf32\>}"];
Node0x55d78d49cce0 -> Node0x55d78d49fb50;
Node0x55d78d4aa0a0 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":181:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4aa770 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":193:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4ad370 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":205:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d49d200 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":227:11)\nmemref\<2xi64\>\n\nname: \"constant_6\"\nshape: [2]\nvalue: dense\<[1, 256]\> : tensor\<2xi64\>}"];
Node0x55d78d4ad400 [shape=record,label="{krnl.memcpy\nloc(\"mnist_mlir.mlir\":228:5)\n\n}"];
Node0x55d78d4ab110 [shape=record,label="{krnl.global\nloc(\"mnist_mlir.mlir\":229:11)\nmemref\<1x10xf32\>\n\nname: \"constant_7\"\nshape: [1, 10]\nvalue: dense\<[[-0.0448560268, 0.00779166119, 0.0681008175, 0.0299937408, -0.126409635, 0.14021875, -0.0552849025, -0.0493838154, 0.0843220502, -0.0545404144]]\> : tensor\<1x10xf32\>}"];
Node0x55d78d4ab110 -> Node0x55d78d4addf0;
Node0x55d78d4ae140 [shape=record,label="{affine.for\nloc(\"mnist_mlir.mlir\":230:5)\n\n\nlower_bound: affine_map\<() -\> (0)\>\nstep: 1 : index\nupper_bound: affine_map\<() -\> (1)\>}"];
Node0x55d78d4ae1d0 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":249:5)\n\n}"];
Node0x55d78d4ae250 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":250:5)\n\n}"];
Node0x55d78d4ae2d0 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":251:5)\n\n}"];
Node0x55d78d4ae350 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":252:5)\n\n}"];
Node0x55d78d4ae3d0 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":253:5)\n\n}"];
Node0x55d78d4ae450 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":254:5)\n\n}"];
Node0x55d78d4ae4d0 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":255:5)\n\n}"];
Node0x55d78d4ae550 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":256:5)\n\n}"];
Node0x55d78d4ae5d0 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":257:5)\n\n}"];
Node0x55d78d4ae650 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":258:5)\n\n}"];
Node0x55d78d4ae6d0 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":259:5)\n\n}"];
Node0x55d78d4ae750 [shape=record,label="{std.dealloc\nloc(\"mnist_mlir.mlir\":260:5)\n\n}"];
Node0x55d78d4ae7d0 [shape=record,label="{std.return\nloc(\"mnist_mlir.mlir\":261:5)\n\n}"];
}

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,50 +0,0 @@
digraph "main_graph" {
label="main_graph";
Node0x5635d540ce40 [shape=record,label="{std.constant\nloc(\"mnist_onnxir.mlir\":5:12)\nnone\n\nvalue: unit}"];
Node0x5635d540ce40 -> Node0x5635d544bd40;
Node0x5635d540ce40 -> Node0x5635d5447800;
Node0x5635d5447170 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":6:10)\ntensor\<16x4x4x10xf32\>\n\nvalue: [[[[...]]]] : tensor\<16x4x4x10xf32\>}"];
Node0x5635d5447170 -> Node0x5635d5447390;
Node0x5635d54472c0 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":7:10)\ntensor\<2xi64\>\n\nvalue: dense\<[256, 10]\> : tensor\<2xi64\>}"];
Node0x5635d54472c0 -> Node0x5635d5447390;
Node0x5635d5447390 [shape=record,label="{onnx.Reshape\nloc(\"mnist_onnxir.mlir\":8:10)\ntensor\<256x10xf32\>\n}"];
Node0x5635d5447390 -> Node0x5635d544df20;
Node0x5635d54474a0 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":9:10)\ntensor\<8x1x5x5xf32\>\n\nvalue: [[[[...]]]] : tensor\<8x1x5x5xf32\>}"];
Node0x5635d54474a0 -> Node0x5635d5447800;
Node0x5635d5447570 [shape=record,label="{onnx.PadConstantValuePad\nloc(\"mnist_onnxir.mlir\":10:10)\ntensor\<1x1x32x32xf32\>\n\nconstant_value: 0.000000e+00 : f32\nmode: \"constant\"\npads: [0, 0, 2, 2, 0, 0, 2, 2]}"];
Node0x5635d5447570 -> Node0x5635d5447800;
Node0x5635d5447800 [shape=record,label="{onnx.Conv\nloc(\"mnist_onnxir.mlir\":11:10)\ntensor\<1x8x28x28xf32\>\n\nauto_pad: \"NOTSET\"\ndilations: [1, 1]\ngroup: 1 : i64\nkernel_shape: [5, 5]\npads: [0, 0, 0, 0]\nstrides: [1, 1]}"];
Node0x5635d5447800 -> Node0x5635d5447c40;
Node0x5635d5447b70 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":12:10)\ntensor\<8x1x1xf32\>\n\nvalue: dense\<[[[-0.161539719]], [[-0.433835655]], [[0.091641359]], [[-0.0168522168]], [[-0.0650264397]], [[-0.131737873]], [[0.0204175506]], [[-0.121110231]]]\> : tensor\<8x1x1xf32\>}"];
Node0x5635d5447b70 -> Node0x5635d5447c40;
Node0x5635d5447c40 [shape=record,label="{onnx.Add\nloc(\"mnist_onnxir.mlir\":13:10)\ntensor\<1x8x28x28xf32\>\n}"];
Node0x5635d5447c40 -> Node0x5635d5443520;
Node0x5635d5443520 [shape=record,label="{onnx.Relu\nloc(\"mnist_onnxir.mlir\":14:10)\ntensor\<1x8x28x28xf32\>\n}"];
Node0x5635d5443520 -> Node0x5635d5447e40;
Node0x5635d5447e40 [shape=record,label="{onnx.MaxPoolSingleOut\nloc(\"mnist_onnxir.mlir\":15:10)\ntensor\<1x8x14x14xf32\>\n\nauto_pad: \"NOTSET\"\ndilations: [1, 1]\nkernel_shape: [2, 2]\npads: [0, 0, 0, 0]\nstrides: [2, 2]}"];
Node0x5635d5447e40 -> Node0x5635d5447db0;
Node0x5635d544b950 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":16:11)\ntensor\<16x8x5x5xf32\>\n\nvalue: [[[[...]]]] : tensor\<16x8x5x5xf32\>}"];
Node0x5635d544b950 -> Node0x5635d544bd40;
Node0x5635d5447db0 [shape=record,label="{onnx.PadConstantValuePad\nloc(\"mnist_onnxir.mlir\":17:11)\ntensor\<1x8x18x18xf32\>\n\nconstant_value: 0.000000e+00 : f32\nmode: \"constant\"\npads: [0, 0, 2, 2, 0, 0, 2, 2]}"];
Node0x5635d5447db0 -> Node0x5635d544bd40;
Node0x5635d544bd40 [shape=record,label="{onnx.Conv\nloc(\"mnist_onnxir.mlir\":18:11)\ntensor\<1x16x14x14xf32\>\n\nauto_pad: \"NOTSET\"\ndilations: [1, 1]\ngroup: 1 : i64\nkernel_shape: [5, 5]\npads: [0, 0, 0, 0]\nstrides: [1, 1]}"];
Node0x5635d544bd40 -> Node0x5635d544c8c0;
Node0x5635d544c020 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":19:11)\ntensor\<16x1x1xf32\>\n\nvalue: dense\<[[[-0.0822488219]], [[-0.108868778]], [[-0.141039595]], [[-0.204869166]], [[-0.17913565]], [[-0.215438381]], [[-0.133805066]], [[-0.195724562]], [[-0.268250644]], [[-0.258212209]], [[-0.0761560649]], [[0.0132841459]], [[-0.00444464432]], [[-0.414740831]], [[-0.17879115]], [[-0.0386558883]]]\> : tensor\<16x1x1xf32\>}"];
Node0x5635d544c020 -> Node0x5635d544c8c0;
Node0x5635d544c8c0 [shape=record,label="{onnx.Add\nloc(\"mnist_onnxir.mlir\":20:11)\ntensor\<1x16x14x14xf32\>\n}"];
Node0x5635d544c8c0 -> Node0x5635d5444820;
Node0x5635d5444820 [shape=record,label="{onnx.Relu\nloc(\"mnist_onnxir.mlir\":21:11)\ntensor\<1x16x14x14xf32\>\n}"];
Node0x5635d5444820 -> Node0x5635d544cac0;
Node0x5635d544cac0 [shape=record,label="{onnx.MaxPoolSingleOut\nloc(\"mnist_onnxir.mlir\":22:11)\ntensor\<1x16x4x4xf32\>\n\nauto_pad: \"NOTSET\"\ndilations: [1, 1]\nkernel_shape: [3, 3]\npads: [0, 0, 0, 0]\nstrides: [3, 3]}"];
Node0x5635d544cac0 -> Node0x5635d544dc90;
Node0x5635d544dbc0 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":23:11)\ntensor\<2xi64\>\n\nvalue: dense\<[1, 256]\> : tensor\<2xi64\>}"];
Node0x5635d544dbc0 -> Node0x5635d544dc90;
Node0x5635d544dc90 [shape=record,label="{onnx.Reshape\nloc(\"mnist_onnxir.mlir\":24:11)\ntensor\<1x256xf32\>\n}"];
Node0x5635d544dc90 -> Node0x5635d544df20;
Node0x5635d544de50 [shape=record,label="{onnx.Constant\nloc(\"mnist_onnxir.mlir\":25:11)\ntensor\<1x10xf32\>\n\nvalue: dense\<[[-0.0448560268, 0.00779166119, 0.0681008175, 0.0299937408, -0.126409635, 0.14021875, -0.0552849025, -0.0493838154, 0.0843220502, -0.0545404144]]\> : tensor\<1x10xf32\>}"];
Node0x5635d544de50 -> Node0x5635d544df20;
Node0x5635d544df20 [shape=record,label="{onnx.Gemm\nloc(\"mnist_onnxir.mlir\":26:11)\ntensor\<1x10xf32\>\n\nalpha: 1.000000e+00 : f32\nbeta: 1.000000e+00 : f32\ntransA: 0 : i64\ntransB: 0 : i64}"];
Node0x5635d544df20 -> Node0x5635d544e030;
Node0x5635d544e030 [shape=record,label="{std.return\nloc(\"mnist_onnxir.mlir\":27:5)\n\n}"];
}

Binary file not shown.

View File

@ -1,4 +1,4 @@
# Models (models)
# Samples (samples)
## Overview
Here is a collection of algorithms that we experimented with in the course of the project.
@ -8,5 +8,3 @@ This is a simple neural network used for MNIST digit classification. We successf
### Benchmarks (benchmarks)
Here are some benchmarks (3-mm, covariance, correlation, Alexnet) in the ICCAD paper we have attempted to replicate in MLIR without success. Actually, the Alexnet.onnx (Alexnet ONNX model) is too big so it is not here but one can just look it up online. In addition, we also include the first conv2d and maxpool2d operations from the toy model which obviously can be converted into MLIR currently.

View File

@ -5,18 +5,18 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)
set(HLSLD_TEST_DEPENDS
set(SCALEHLS_TEST_DEPENDS
FileCheck count not
hlsld-translate
scalehls-translate
)
add_lit_testsuite(check-hlsld "Running the hlsld regression tests"
add_lit_testsuite(check-scalehls "Running the scalehls regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${HLSLD_TEST_DEPENDS}
DEPENDS ${SCALEHLS_TEST_DEPENDS}
)
set_target_properties(check-hlsld PROPERTIES FOLDER "Tests")
set_target_properties(check-scalehls PROPERTIES FOLDER "Tests")
add_lit_testsuites(HLSLD
add_lit_testsuites(SCALEHLS
${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${HLSLD_TEST_DEPENDS}
DEPENDS ${SCALEHLS_TEST_DEPENDS}
)

View File

@ -1,4 +1,4 @@
// RUN: hlsld-translate -emit-hlscpp %s | FileCheck %s
// RUN: scalehls-translate -emit-hlscpp %s | FileCheck %s
#map0 = affine_map<(d0)[s0] -> (d0 + s0, d0, d0 - s0)>
#map1 = affine_map<(d0) -> (d0 * 3)>

View File

@ -1,4 +1,4 @@
// RUN: hlsld-translate -emit-hlscpp %s | FileCheck %s
// RUN: scalehls-translate -emit-hlscpp %s | FileCheck %s
// CHECK: void test_standard(
// CHECK-NEXT: ap_int<32> [[VAL_1:.*]],

View File

@ -16,7 +16,7 @@ from lit.llvm.subst import FindTool
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
config.name = 'HLSLD'
config.name = 'SCALEHLS'
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
@ -27,7 +27,7 @@ config.suffixes = ['.mlir']
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.hlsld_obj_root, 'test')
config.test_exec_root = os.path.join(config.scalehls_obj_root, 'test')
config.substitutions.append(('%PATH%', config.environment['PATH']))
config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
@ -46,14 +46,14 @@ config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.hlsld_obj_root, 'test')
config.test_exec_root = os.path.join(config.scalehls_obj_root, 'test')
# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
tool_dirs = [config.hlsld_tools_dir, config.mlir_tools_dir, config.llvm_tools_dir]
tool_dirs = [config.scalehls_tools_dir, config.mlir_tools_dir, config.llvm_tools_dir]
tools = [
'hlsld-translate'
'scalehls-translate'
]
llvm_config.add_tool_substitutions(tools, tool_dirs)

View File

@ -31,9 +31,9 @@ config.host_arch = "@HOST_ARCH@"
config.mlir_src_root = "@MLIR_SOURCE_DIR@"
config.mlir_obj_root = "@MLIR_BINARY_DIR@"
config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
config.hlsld_src_root = "@HLSLD_SOURCE_DIR@"
config.hlsld_obj_root = "@HLSLD_BINARY_DIR@"
config.hlsld_tools_dir = "@HLSLD_TOOLS_DIR@"
config.scalehls_src_root = "@SCALEHLS_SOURCE_DIR@"
config.scalehls_obj_root = "@SCALEHLS_BINARY_DIR@"
config.scalehls_tools_dir = "@SCALEHLS_TOOLS_DIR@"
# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
@ -49,4 +49,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)
# Let the main config do the real work.
lit_config.load_config(config, "@HLSLD_SOURCE_DIR@/test/lit.cfg.py")
lit_config.load_config(config, "@SCALEHLS_SOURCE_DIR@/test/lit.cfg.py")

View File

@ -1 +1,2 @@
add_subdirectory(hlsld-translate)
add_subdirectory(scalehls-opt)
add_subdirectory(scalehls-translate)

View File

View File

View File

@ -14,12 +14,12 @@ set(LIBS
MLIRTranslation
MLIRSupport
HLSLDEmitHLSCpp
SCALEHLSEmitHLSCpp
)
add_llvm_executable(hlsld-translate hlsld-translate.cpp)
add_llvm_executable(scalehls-translate scalehls-translate.cpp)
llvm_update_compile_flags(hlsld-translate)
target_link_libraries(hlsld-translate PRIVATE ${LIBS})
llvm_update_compile_flags(scalehls-translate)
target_link_libraries(scalehls-translate PRIVATE ${LIBS})
mlir_check_link_libraries(hlsld-translate)
mlir_check_link_libraries(scalehls-translate)

View File

@ -42,7 +42,7 @@ int main(int argc, char **argv) {
mlir::registerAllDialects();
mlir::registerAllTranslations();
hlsld::registerHLSCppEmitterTranslation();
scalehls::registerHLSCppEmitterTranslation();
llvm::InitLLVM y(argc, argv);