-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: arith-dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
linea-constraints
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why it was updated, it changed when I checkout the project. I thought it was expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just point to latest master of constraint and it'll be ok. The tracer is currently pointing to a commit that disables the MMIO (needed for the release)
@@ -182,6 +182,23 @@ public static Bytes16 excision( | |||
|
|||
public static void updateTemporaryTargetRam( | |||
MmuData mmuData, final long targetLimbOffsetToUpdate, final Bytes16 newLimb) { | |||
|
|||
int limbStart = (int) (LLARGE * targetLimbOffsetToUpdate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add a simple unit test to validate the method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, @letypequividelespoubelles, I will need some help on creating a unit test as we don't have one before. I don't visualize yet the real use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe @OlivierBBB, as Francois is OOO currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed when a (target) limb is updated in two times by a MMU instructions. It's the case for example for MMU instructions generating *TwoTarget MMIO instructions.
We already have some memory tests that triggers those MMIO inst.
Maybe this is the failing unit tests (not much network at the hospital, can't open the test output), but I guess it's MMIO.ram_excision or MMIO.*_to_ram_two_targets constraints that are failing.
Signed-off-by: Ameziane H <[email protected]>
int sliceSize = Math.max(0, originalRam.length - limbEnd); | ||
|
||
int size = limbStart + newLimb.size() + sliceSize; | ||
byte[] updatedRam = new byte[size]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the updated ram size should be the same as the original one ram
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this method you're modifying is doing : you just want to modify a 16 bytes limb the midldle of your memory so :
- you wipe everything before the limb (you could keep it, but as you don't need it anymore, tiu can put 0s instead)
- you modify your 16 bytes limb
- you keep unchanged everything that's after the unmodified limb
Not sure of what you're doing, I'm on mobile with low network
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the updated ram size should be the same as the original one ram
In my current implementation, it is the case, but any way, we need to follow this logic. The total size is the sum of the parts' sizes that we're putting together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure of what you're doing, I'm on mobile with low network
I'm doing the same work, but this implementation is faster as you can see in the flamegraphs
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
I don't understand why linea-constraints are modified, I haven't modify those files myself, maybe an encoding issue as I'm working on Mac. |
Following an issue we faced recently on sepolia on linea_generateConflatedTracesToFileV2, where tracing the batch of blocks take more than 30 seconds we noticed that MmioPatterns.updateTemporaryTargetRam method takes more than 2.5 seconds to execute (see profiling below).
This PR improves this method by using Java native calls (System.arraycopy) to copy byte arrays instead of using Tuweni library.
Before this PR
With this PR
Currently the test takes around 25 seconds instead of 30 seconds