Skip to content
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0390a96
[Change] default_heterogeneous and Neura Script
MeowMJ Jul 10, 2025
15bfb0f
[UPDATE] default_heterogeneous
MeowMJ Jul 10, 2025
3b2080e
[UPDATE] default_heterogeneous
MeowMJ Jul 10, 2025
5176aa0
[UPDATE] DFG.cpp
MeowMJ Jul 10, 2025
8a7071d
Tan helps with the new bug. Merge branch 'master' of https://github.c…
MeowMJ Jul 17, 2025
cbad764
[UPDATE] NeuraDemo.py, relu+histogram.c
MeowMJ Jul 22, 2025
889654f
[UPDATE] NeuraDemo and output
MeowMJ Jul 24, 2025
84416b8
[UODATE] NeuraDemo.py
MeowMJ Aug 1, 2025
e7fd994
[UPDATE]python script
MeowMJ Aug 14, 2025
137ad86
[UPDATE] all
MeowMJ Aug 28, 2025
b4e4d8c
[DELETE] unnessarsy
MeowMJ Oct 4, 2025
6c54efc
[UPDATE] expandable python demo
MeowMJ Oct 27, 2025
0b15e22
[slove one conflict]
MeowMJ Oct 27, 2025
797f153
[ADD] workflow for tools/expandable
MeowMJ Nov 2, 2025
1598845
[UPDATE] workflow for tools/expandable
MeowMJ Nov 2, 2025
571ef5c
[UPDATE] expandable mapping
MeowMJ Nov 5, 2025
9fbf220
[UPDATE] workflow for tools/expandable
MeowMJ Nov 5, 2025
0fbf202
[UPDATE] workflow for tools/expandable
MeowMJ Nov 5, 2025
432cc6a
[UPDATE] add python env in workflow
MeowMJ Nov 5, 2025
120f845
[UPDATE] add python env in workflow
MeowMJ Nov 5, 2025
daf3029
[UPDATE] add python env in workflow
MeowMJ Nov 5, 2025
6a75fb5
[UPDATE] add python env in workflow
MeowMJ Nov 5, 2025
7dab033
[UPDATE] add python env in workflow
MeowMJ Nov 5, 2025
93e807b
[REMOVE] not relavant thing
MeowMJ Nov 5, 2025
6605a75
[ADD] needed space in CGRA.cpp
MeowMJ Nov 7, 2025
7893b65
[UPDATE] scheduler.py and visualization.py
MeowMJ Nov 7, 2025
80505c9
Delete tools/expandable/tmp directory
MeowMJ Nov 7, 2025
c8cf535
[UPDATE] python script
MeowMJ Nov 17, 2025
6ab3823
[SOLVE] merge conflict
MeowMJ Nov 18, 2025
a1cc3cf
Merge branch 'master' of https://github.com/MeowMJ/CGRA-Mapper
MeowMJ Nov 18, 2025
2c78e86
[DELETE] json and update visualization.py
MeowMJ Nov 19, 2025
a50499b
[FIX] error in scheduler.py
MeowMJ Nov 19, 2025
6a63273
[FIX] missing module
MeowMJ Nov 19, 2025
7f6d2ad
[UPDATE] demo.sh
MeowMJ Nov 20, 2025
db9ad8c
[UPDATE] fig condig
MeowMJ Nov 20, 2025
c7fe250
[UPDATE] schedule hete
MeowMJ Nov 21, 2025
b3cbb1b
[TRY] fix git action bug
MeowMJ Nov 26, 2025
9b67f2f
[TRY] fix git action bug
MeowMJ Nov 26, 2025
96c2427
[TRY] fix git action bug
MeowMJ Nov 26, 2025
5227b4f
[TRY] fix git action bug
MeowMJ Nov 26, 2025
27292da
[TRY] fix git action bug
MeowMJ Nov 26, 2025
d34c480
[TRY] fix git action bug
MeowMJ Nov 26, 2025
4da85fb
[TRY] fix git action bug
MeowMJ Nov 26, 2025
5ccaebb
[TRY] fix git action bug
MeowMJ Nov 26, 2025
128f2e4
[UPDATE] Fig drawing
MeowMJ Dec 9, 2025
9a0b855
[DEBUG] mismatched coloum
MeowMJ Dec 9, 2025
e7b96af
[UPDATE] Fig drawing
MeowMJ Dec 9, 2025
2d6fecf
[DEBUG] mismatched coloum
MeowMJ Dec 9, 2025
04657c0
[UPDATE] final version of python demo
MeowMJ Dec 9, 2025
a167a56
[UPDATE] comment the print sentence
MeowMJ Dec 10, 2025
8de59c8
[UPDATE] document name
MeowMJ Dec 10, 2025
c31bd19
[UPDATE] shorten CI/CD time
MeowMJ Dec 10, 2025
e96323f
[UPDATE] shorten CI/CD time
MeowMJ Dec 10, 2025
157f917
[UPDATE] file structure
MeowMJ Dec 11, 2025
23cd249
[UPDATE] baseline remove hete
MeowMJ Dec 11, 2025
0c858db
[UPDATE] readme
MeowMJ Dec 11, 2025
6a5c05e
[UPDATE] demo testme true
MeowMJ Dec 11, 2025
cb5665b
[UPDATE] english comment
MeowMJ Dec 11, 2025
785c335
[UPDATE] english comment
MeowMJ Dec 11, 2025
86d11a7
[UPDATE] TEST CI/CD
MeowMJ Dec 11, 2025
83d3ff7
Merge branch 'master' of https://github.com/tancheng/CGRA-Mapper
MeowMJ Dec 13, 2025
9572c2e
[MERGE] conflict
MeowMJ Dec 13, 2025
976ce4a
[UPDATE] fusionStrategy
MeowMJ Dec 13, 2025
efe04cb
[UPDATE] visualizer
MeowMJ Dec 14, 2025
ea98d16
[REMOVE] visualizer_copy
MeowMJ Dec 14, 2025
4e1570a
[UPDATE] add label in figs
MeowMJ Dec 14, 2025
8ba2ee0
[UPDATE] relu+histogram
MeowMJ Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ jobs:
sudo apt-get -y install llvm-12 llvm-12-dev llvm-12-tools clang-12
sudo apt-get -y install build-essential

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.7.16'

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install eventlet pandas matplotlib

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Expand Down Expand Up @@ -105,3 +115,8 @@ jobs:
sh compile.sh
sh run.sh
sh verify.sh

- name: Test expandable automatic script
working-directory: ${{github.workspace}}/tools/expandable
run: |
./demo.sh --test y
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ build*/
*.ll
*.dot
*.bc
.vscode/
.venv/
9 changes: 7 additions & 2 deletions src/DFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ DFG::DFG(Function& t_F, list<Loop*>* t_loops, bool t_targetFunction,
bool needsCycleCalculation = false;
for (auto strategy : *t_fusionStrategy) {
if (strategy == "default_heterogeneous") {
combineMulAdd("CoT");
combinePhiAdd("BrT");
combine("phi", "add", "Ctrl");
combine("phi", "fadd", "Ctrl");
combine("fcmp", "select", "Ctrl");
combine("icmp", "select", "Ctrl");
combine("icmp", "br", "Ctrl");
combine("fcmp", "br", "Ctrl");
tuneForPattern();
needsCycleCalculation = true;
}
else if (strategy == "nonlinear") {
Expand Down
9 changes: 8 additions & 1 deletion src/Mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,13 @@ void Mapper::showUtilization(CGRA* t_cgra, DFG* t_dfg, int t_II,
total_active_tiles += 1;
}
float avg_tile_overall_utilization = 0.0;
float max_tile_overall_utilization = 0.0;
float avg_tile_fu_utilization = 0.0;
float avg_tile_xbar_utilization = 0.0;
for (int tile = 0; tile < t_cgra->getFUCount(); ++tile) {
if (max_tile_overall_utilization < tile_overall_utilization[tile]) {
max_tile_overall_utilization = tile_overall_utilization[tile];
}
avg_tile_overall_utilization += tile_overall_utilization[tile];
avg_tile_fu_utilization += tile_fu_utilization[tile];
avg_tile_xbar_utilization += tile_xbar_utilization[tile];
Expand All @@ -674,8 +678,10 @@ void Mapper::showUtilization(CGRA* t_cgra, DFG* t_dfg, int t_II,
avg_tile_overall_utilization /= total_active_tiles;
avg_tile_fu_utilization /= total_active_tiles;
avg_tile_xbar_utilization /= total_active_tiles;
//max_tile_overall_utilization /= total_active_tiles;

cout << "tile avg fu utilization: " << avg_tile_fu_utilization*100 << "%; avg xbar utilization: " << avg_tile_xbar_utilization*100 << "%; avg overall utilization: " << avg_tile_overall_utilization*100 << "%" << endl;
cout << "tile avg fu utilization: " << avg_tile_fu_utilization*100 << "%; avg xbar utilization: " << avg_tile_xbar_utilization*100 << "%; avg overall utilization: " << avg_tile_overall_utilization*t_II*100 << "%" << endl;
cout << "max overall utilization: " << max_tile_overall_utilization*t_II*100 << "%" << endl;

// Collects the histogram of tiles' utilization.
// Histogram for the number of tiles that have utilization of 0%.
Expand Down Expand Up @@ -1006,6 +1012,7 @@ void Mapper::showSchedule(CGRA* t_cgra, DFG* t_dfg, int t_II,
cout<<"[Mapping II: "<<t_II<<"]"<<endl;

if (t_parameterizableCGRA) {
// TODO: make it clean
jsonTilesLinks["tiles"] = jsonTiles;
jsonTilesLinks["links"] = jsonLinks;
json jsonMap(jsonTilesLinks);
Expand Down
18 changes: 9 additions & 9 deletions src/mapperPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace {
// Exclusive: Multi-cyce operations occupy tiles exclusively. Other operations can be mapped onto this tile only if the multi-cycle operation finishs its computation.
// Distributed: Multi-cycle operations are splitted into multiple single-cycle operations and each of which can be mapped onto a tile.
// Inclusive: Multi-cycle operations' execution can overlap with other operations on the same tile.
// Note that
// Note that
assert(multiCycleStrategy.compare("exclusive") == 0 or
multiCycleStrategy.compare("distributed") == 0 or
multiCycleStrategy.compare("inclusive") == 0);
Expand Down Expand Up @@ -339,8 +339,8 @@ namespace {
else {
mapper->showSchedule(cgra, dfg, II, isStaticElasticCGRA, parameterizableCGRA);
// cout << "==================================\n";
cout << "[show opcode count]\n";
dfg->showOpcodeDistribution();
// cout << "[show opcode count]\n";
// dfg->showOpcodeDistribution();
cout << "[Mapping Success]\n";
cout << "==================================\n";
if (enableExpandableMapping) {
Expand Down Expand Up @@ -409,11 +409,11 @@ namespace {
*/
bool canMap(CGRA* t_cgra, DFG* t_dfg) {
std::set<std::string> missing_fus;

for (auto it = t_dfg->nodes.begin(); it != t_dfg->nodes.end(); ++it) {
DFGNode* node = *it;
bool nodeSupported = false;

for (int i = 0; i < t_cgra->getRows() && !nodeSupported; ++i) {
for (int j = 0; j < t_cgra->getColumns(); ++j) {
CGRANode* fu = t_cgra->nodes[i][j];
Expand All @@ -423,12 +423,12 @@ namespace {
}
}
}

if (!nodeSupported) {
missing_fus.insert(node->getOpcodeName());
}
}

if (!missing_fus.empty()) {
std::cout << "[canMap] Missing functional units: ";
for (const auto& op : missing_fus) {
Expand All @@ -437,10 +437,10 @@ namespace {
std::cout << std::endl;
return false;
}

return true;
}

};
}

Expand Down
5 changes: 3 additions & 2 deletions test/compile.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
clang-12 -emit-llvm -fno-unroll-loops -O3 -o kernel.bc -c kernel.cpp
#llvm-dis fir.bc -o fir.ll
clang-12 -emit-llvm -fno-unroll-loops -O0 -o kernel.bc -c kernel.cpp
llvm-dis-12 kernel.bc -o O0kernel.ll
#clang-12 -emit-llvm -fno-unroll-loops -mllvm -force-vector-width=4 -O3 -o kernel.bc -c ./_matmul/src/matmul.c
3 changes: 1 addition & 2 deletions test/dot.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
dot -Tpng _Z6kernelPfS_S_.dot -o kernel.png

dot -Tpng _Z6kernelPfS_S_.dot -o kernel.png
Empty file modified test/inter_edge/compile.sh
100644 → 100755
Empty file.
Empty file modified test/inter_edge/dot.sh
100644 → 100755
Empty file.
Empty file modified test/inter_edge/rebuild.sh
100644 → 100755
Empty file.
Empty file modified test/inter_edge/run.sh
100644 → 100755
Empty file.
Empty file modified test/inter_edge/verify.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion test/kernels/conv/conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int kernel(int ni, int nj, int nk,
for (x = 0; x < total; x++) {
i = x / NJ;
j = x % NJ;
out += A[i][j] * B[i][j];
out += A [i][j] * B[i][j];
}

/*
Expand Down
22 changes: 11 additions & 11 deletions test/kernels/latnrm/latnrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ void kernel(float input, float *output, float coefficient[16],
top = input;
q_coef = coefficient[0];
// #pragma clang loop unroll_count(4)
for (i = 0; i < ORDER; i++) {
k_coef = coefficient[2*i];
left = top;
right = internal_state[i];
internal_state[i] = bottom;
top = q_coef * left - k_coef * right;
bottom = q_coef * right + k_coef * left;
q_coef = coefficient[2*i+1];
}
internal_state[i++] = bottom;
internal_state[i] = top;
// for (i = 0; i < ORDER; i++) {
// k_coef = coefficient[2*i];
// left = top;
// right = internal_state[i];
// internal_state[i] = bottom;
// top = q_coef * left - k_coef * right;
// bottom = q_coef * right + k_coef * left;
// q_coef = coefficient[2*i+1];
// }
// internal_state[i++] = bottom;
// internal_state[i] = top;

sum = internal_state[1] * q_coef;

Expand Down
6 changes: 3 additions & 3 deletions test/kernels/mvt/mvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void kernel(int n,
{
int i, j;

#pragma scop
#pragma clang loop unroll_count(1)
// #pragma scop
// #pragma clang loop unroll_count(1)
for (j = 0; j < N; j++) {
// #pragma clang loop unroll_count(1) vectorize(disable)
//#pragma clang loop unroll_count(1) vectorize_width(4)
Expand All @@ -88,7 +88,7 @@ void kernel(int n,
x2[i] = x2[i] + A[j][i] * y_2[j];
}
}
#pragma endscop
// #pragma endscop
}


Expand Down
4 changes: 4 additions & 0 deletions test/kernels/relu+histogram/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
clang-12 -emit-llvm -O3 -fno-unroll-loops -o kernel.bc -c relu.c
llvm-dis-12 kernel.bc -o kernel.ll
opt-12 --loop-unroll --unroll-count=4 kernel.bc -o kernel_unroll.bc
llvm-dis-12 kernel_unroll.bc -o kernel_unroll.ll
19 changes: 19 additions & 0 deletions test/kernels/relu+histogram/param.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"kernel" : "kernel",
"targetFunction" : false,
"targetNested" : false,
"targetLoopsID" : [1],
"doCGRAMapping" : false,
"row" : 4,
"column" : 4,
"diagonalVectorization" : true,
"fusionStrategy" : [],
"isTrimmedDemo" : true,
"heuristicMapping" : false,
"bypassConstraint" : 4,
"isStaticElasticCGRA" : false,
"precisionAware" : false,
"ctrlMemConstraint" : 200,
"regConstraint" : 8
}

Loading