-
Notifications
You must be signed in to change notification settings - Fork 14
Merge regions overhaul #201
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
Conversation
|
@KubaSz I added you as a reviewer given that you looked at the previous snapshot stuff, but feel free to ignore if you don't have scope to keep checking this stuff 😄 |
|
I don't have much time to review this, but from a quick glance I can offer two quick comments:
|
|
Ok nice, cheers and have a good Xmas! |
csegarragonz
left a comment
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.
LGTM. Just pointed out two very minor issues, feel free to ignore them.
I have deliberately marked all occurings I have found to aid in the re-factor if you end up going for it.
| }; | ||
|
|
||
| template<typename T> | ||
| inline bool calculateDiffValue(const uint8_t* original, |
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.
It's not immediate to tell the difference between calculateDiffValue and applyDiffValue, could we add a comment explaining what each one does, or how they differ?
Also, just to double check, can the uint8_t pointers here can't be converted to std::spans?
| // Crash handler | ||
| faabric::util::setUpCrashHandler(); | ||
|
|
||
| PROF_BEGIN |
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.
Same point made in the Faasm PR re. comitting profiling macros. I would personally remove them, but feel free to ignore.
| std::shared_ptr<faabric::util::SnapshotData> SnapshotRegistry::getSnapshot( | ||
| const std::string& key) | ||
| { | ||
| PROF_START(GetSnapshot) |
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.
Same point re. profiling (feel free to ignore).
| { | ||
| static ClearRefsWrapper wrap; | ||
|
|
||
| PROF_START(ResetDirty) |
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.
Same here re. profiling (feel free to ignore).
| { | ||
| // Note we only need a shared lock here as we are not modifying data and the | ||
| // OS will handle synchronisation of the mapping itself | ||
| PROF_START(MapSnapshot) |
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.
Same point re. profiling
|
|
||
| std::vector<SnapshotDiff> MemoryView::getDirtyRegions() | ||
| { | ||
| PROF_START(GetDirtyRegions) |
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.
Profiling
| int sharedMemPages = 8; | ||
| size_t sharedMemSize = sharedMemPages * HOST_PAGE_SIZE; | ||
| MemoryRegion sharedMem = allocateSharedMemory(sharedMemSize); | ||
| MemoryRegion sharedMem = allocatePrivateMemory(sharedMemSize); |
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 to double check, the variable is called sharedMem and is defined by calling allocatePrivateMemory which feels odd.
| { | ||
| size_t memSize = 10 * HOST_PAGE_SIZE; | ||
| MemoryRegion sharedMem = allocateSharedMemory(memSize); | ||
| MemoryRegion sharedMem = allocatePrivateMemory(memSize); |
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.
Same point re. variable wording.
| // Set up two shared mem regions | ||
| MemoryRegion sharedMemA = allocateSharedMemory(snapSize); | ||
| MemoryRegion sharedMemB = allocateSharedMemory(snapSize); | ||
| MemoryRegion sharedMemA = allocatePrivateMemory(snapSize); |
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.
Same point re. variable naming throughout this test.
| expectedData = faabric::util::valueToBytes<int>(diffValue); | ||
| } | ||
|
|
||
| SECTION("Long") |
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.
Nice nesting of tests here 👍
|
I'll merge this in the interest of moving things along and fixing downstream, then I'll put the refactoring into #210 |
This PR addresses the following problems:
RawandInttypes (needed more types includingBool,Long,FloatandDouble).When it comes to transferring merge regions across hosts, we have to consider three scenarios where snapshot data is being transferred:
In the first two, we are not currently including merge regions, which means, if the main thread on the main host sets up some merge regions, they are not respected by remote hosts.
Changes:
Ignoremerge regions to blacklist regions of memory (e.g. guard pages), then automatically fill the rest of the snapshot memory withOverwriteregions.