Skip to content

Commit

Permalink
Merge pull request #65 from 0xPolygonHermez/feature/memoryOptimization
Browse files Browse the repository at this point in the history
Reusing memory C++ prover
  • Loading branch information
jbaylina authored Mar 14, 2024
2 parents b2bafc8 + c1cb28f commit 6ffd28c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/pil_info/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ module.exports = function map(res, pil) {
res.mapOffsets.cm2_n = res.mapOffsets.cm1_n + N * res.mapSectionsN.cm1_n;
res.mapOffsets.cm3_n = res.mapOffsets.cm2_n + N * res.mapSectionsN.cm2_n;
res.mapOffsets.cm4_n = res.mapOffsets.cm3_n + N * res.mapSectionsN.cm3_n;
res.mapOffsets.tmpExp_n = res.mapOffsets.cm4_n + N * res.mapSectionsN.cm4_n;
res.mapOffsets.cm1_2ns = res.mapOffsets.tmpExp_n + N * res.mapSectionsN.tmpExp_n;
res.mapOffsets.cm2_2ns = res.mapOffsets.cm1_2ns + Next * res.mapSectionsN.cm1_2ns;
res.mapOffsets.cm1_2ns = res.mapOffsets.cm4_n + N * res.mapSectionsN.cm4_n;
res.mapOffsets.tmpExp_n = res.mapOffsets.cm1_2ns + Next * res.mapSectionsN.cm1_2ns;
res.mapOffsets.cm2_2ns = res.mapOffsets.tmpExp_n + N * res.mapSectionsN.tmpExp_n;
res.mapOffsets.cm3_2ns = res.mapOffsets.cm2_2ns + Next * res.mapSectionsN.cm2_2ns;
res.mapOffsets.cm4_2ns = res.mapOffsets.cm3_2ns + Next * res.mapSectionsN.cm3_2ns;
res.mapOffsets.q_2ns = res.mapOffsets.cm4_2ns + Next * res.mapSectionsN.cm4_2ns;
Expand Down
13 changes: 0 additions & 13 deletions src/stark/chelpers/stark_chelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ module.exports.buildCHelpers = async function buildCHelpers(starkInfo, cHelpersF

let totalSubsetOperationsUsed = [];

//Define mapOffsetCol
let nrowsbatch = 4 + (1 << (starkInfo.starkStruct.nBitsExt - starkInfo.starkStruct.nBits));
starkInfo.mapOffsetsCol = {};
starkInfo.mapOffsetsCol.cm1_n = nrowsbatch * starkInfo.nConstants;
starkInfo.mapOffsetsCol.cm2_n = starkInfo.mapOffsetsCol.cm1_n + nrowsbatch * starkInfo.mapSectionsN.cm1_n;
starkInfo.mapOffsetsCol.cm3_n = starkInfo.mapOffsetsCol.cm2_n + nrowsbatch * starkInfo.mapSectionsN.cm2_n;
starkInfo.mapOffsetsCol.tmpExp_n = starkInfo.mapOffsetsCol.cm3_n + nrowsbatch * starkInfo.mapSectionsN.cm3_n;

starkInfo.mapOffsetsCol.cm1_2ns = nrowsbatch * starkInfo.nConstants;
starkInfo.mapOffsetsCol.cm2_2ns = starkInfo.mapOffsetsCol.cm1_2ns + nrowsbatch * starkInfo.mapSectionsN.cm1_2ns;
starkInfo.mapOffsetsCol.cm3_2ns = starkInfo.mapOffsetsCol.cm2_2ns + nrowsbatch * starkInfo.mapSectionsN.cm2_2ns;
starkInfo.mapOffsetsCol.cm4_2ns = starkInfo.mapOffsetsCol.cm3_2ns + nrowsbatch * starkInfo.mapSectionsN.cm3_2ns;

for(let i = 1; i < nStages - 1; ++i) {
let stage = i + 1;
let code = starkInfo[`step${stage}prev`].code;
Expand Down

0 comments on commit 6ffd28c

Please sign in to comment.