fix weightAlways attribute in spatial

This commit is contained in:
NiccoloN
2026-04-23 10:04:47 +02:00
parent 412ca957f6
commit 89b3501aa8
5 changed files with 59 additions and 11 deletions

View File

@@ -94,10 +94,8 @@ void PimBufferizationPass::runOnOperation() {
void PimBufferizationPass::annotateWeightsMemrefs(ModuleOp moduleOp, func::FuncOp funcOp) const {
funcOp.walk([&](PimCoreOp coreOp) {
auto annotateWeight = [&](unsigned weightIndex) {
if (weightIndex >= coreOp.getWeights().size())
return;
Value weight = coreOp.getWeights()[weightIndex];
walkPimMvmVmmWeightUses(coreOp, [&](OpOperand& weightUse) {
Value weight = weightUse.get();
auto getGlobalOp = weight.getDefiningOp<memref::GetGlobalOp>();
if (!getGlobalOp)
return;
@@ -105,10 +103,7 @@ void PimBufferizationPass::annotateWeightsMemrefs(ModuleOp moduleOp, func::FuncO
assert("Weights must be constants" && globalMemrefOp.getConstant());
markWeightAlways(getGlobalOp);
markWeightAlways(globalMemrefOp);
};
coreOp.walk([&](PimMVMOp mvmOp) { annotateWeight(mvmOp.getWeightIndex()); });
coreOp.walk([&](PimVMMOp vmmOp) { annotateWeight(vmmOp.getWeightIndex()); });
});
});
}