Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MmioPatterns optimisation #1607

Open
wants to merge 10 commits into
base: arith-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,6 @@ public static Bytes16 excision(

public static void updateTemporaryTargetRam(
MmuData mmuData, final long targetLimbOffsetToUpdate, final Bytes16 newLimb) {
final Bytes bytesPreLimb =
Bytes.repeat(
(byte) 0,
(int)
(LLARGE
* targetLimbOffsetToUpdate)); // We won't access the preLimb again, so we don't
// care
// of its value
final Bytes bytesPostLimb =
mmuData.targetRamBytes().slice((int) ((targetLimbOffsetToUpdate + 1) * LLARGE));

mmuData.targetRamBytes(Bytes.concatenate(bytesPreLimb, newLimb, bytesPostLimb));
mmuData.targetRamBytes().set((int) targetLimbOffsetToUpdate, newLimb);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.consensys.linea.zktracer.module.mmu.values.MmuToMmioInstruction;
import net.consensys.linea.zktracer.module.mmu.values.MmuWcpCallRecord;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.MutableBytes;

@AllArgsConstructor
@Getter
Expand All @@ -56,7 +57,7 @@ public class MmuData {
private boolean mmuInstAnyToRamWithPaddingIsPurePadding;
private Bytes exoBytes;
private Bytes sourceRamBytes;
private Bytes targetRamBytes;
private MutableBytes targetRamBytes;
private final boolean exoLimbIsSource;
private final boolean exoLimbIsTarget;
private static final List<Integer> MMU_INST_EXO_IS_SOURCE =
Expand All @@ -83,7 +84,7 @@ public MmuData(final MmuCall mmuCall) {
false,
Bytes.EMPTY,
Bytes.EMPTY,
Bytes.EMPTY,
MutableBytes.EMPTY,
MMU_INST_EXO_IS_SOURCE.contains(mmuCall.instruction()),
MMU_INST_EXO_IS_TARGET.contains(mmuCall.instruction()));

Expand Down Expand Up @@ -112,7 +113,7 @@ public void setSourceRamBytes() {

public void setTargetRamBytes() {
if (mmuCall.targetRamBytes().isPresent()) {
targetRamBytes(mmuCall.targetRamBytes().get());
targetRamBytes(mmuCall.targetRamBytes().get().mutableCopy());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.consensys.linea.zktracer.module.mmu.values.MmuToMmioInstruction;
import net.consensys.linea.zktracer.module.mmu.values.MmuWcpCallRecord;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.MutableBytes;

public class ExoToRamTransplants implements MmuInstruction {
private final Euc euc;
Expand Down Expand Up @@ -89,7 +90,7 @@ public MmuData setMicroInstructions(MmuData mmuData) {
// Setting the target ram bytes
// The target CN is ALWAYS a new, virgin, fictitious context, where is either write the call
// data, or the result of a precompile
mmuData.targetRamBytes(Bytes.EMPTY);
mmuData.targetRamBytes(MutableBytes.EMPTY);

// setting the MMIO instructions
for (int i = 0; i < mmuData.totalNonTrivialInitials(); i++) {
Expand Down
2 changes: 1 addition & 1 deletion linea-constraints
Submodule linea-constraints updated 148 files
Loading