Skip to content

Commit ac4f724

Browse files
author
yifan.chen
committed
fix: rope's weights sometime need to hold in lmem
- if rope's weight don't need to reload, add hold_in_lmem tag Change-Id: I43099e0d32fb58fd7985ae42b214dbd49d2b141f
1 parent a4e4b97 commit ac4f724

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

lib/Dialect/Tpu/Transforms/LayerGroup/BasicTimeStep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void BasicTimeStep::gen_hold_coeff() {
353353
if (src_op.getAllowSplitAttr() != nullptr) {
354354
allow_split = true;
355355
}
356-
if (allow_split == false) {
356+
if (allow_split == false || tensor_info.hold_in_lmem) {
357357
this->hold_coeff_[v] = ts;
358358
}
359359
}

lib/Dialect/Tpu/Transforms/LayerGroup/LayerGroupUtil.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,7 @@ bool get_backward_slice_info(LgInfo &lg_info, slice_info_t &in_si,
16181618
idx = 0;
16191619
slice = 1;
16201620
if (!rope_need_reload) {
1621+
hold_in_lmem = true;
16211622
in_si.n.emplace_back(slice_pair_t(idx, slice));
16221623
break;
16231624
}
@@ -1752,6 +1753,7 @@ bool get_backward_slice_info(LgInfo &lg_info, slice_info_t &in_si,
17521753
idx = 0;
17531754
slice = 1;
17541755
if (!rope_need_reload) {
1756+
hold_in_lmem = true;
17551757
in_si.h.emplace_back(slice_pair_t(idx, slice));
17561758
break;
17571759
}

0 commit comments

Comments
 (0)