-
Notifications
You must be signed in to change notification settings - Fork 526
[Windows] [mmap_data_loader.cpp] mmap equivalent for Windows #8916
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
There is no sys/mman.h or posix-compatible mmap() implementation on Windows. The extension data loaders use it to map in data files, so adding an implementation. Test-run, & .\cmake-out\extension\data_loader\test\Debug\extension_data_loader_test.exe --gtest_brief=1 --gtest_filter=MmapDataLoader* Running main() from ...\executorch\third-party\googletest\googletest\src\gtest_main.cc [==========] 8 tests from 1 test suite ran. (50 ms total) [ PASSED ] 8 tests.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/8916
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 4e6b973 with merge base 24671a9 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@@ -63,14 +62,16 @@ MmapDataLoader::~MmapDataLoader() { | |||
std::free(const_cast<char*>(file_name_)); | |||
// fd_ can be -1 if this instance was moved from, but closing a negative fd is | |||
// safe (though it will return an error). | |||
::close(fd_); | |||
if (fd_ != -1) { | |||
::close(fd_); |
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.
I'm surprised this (and open, etc.) works, since it was the problem in #8913. I haven't built this file on Windows myself yet, but maybe a similar fix is necessary?
hm:
|
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.
@SamGondelman figured out what was causing the linker error you're seeing.
Btw, if you want to repro it yourself, you can do so on a linux machine (e.g. Devserver). You can follow https://pytorch.org/executorch/main/getting-started-setup.html on how to set up the repo. Then
First, build/install ExecuTorch libraries
(rm -rf cmake-out && \
pp cmake . \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
-DEXECUTORCH_BUILD_VULKAN=ON \
-Bcmake-out && \
cmake --build cmake-out -j64 --target install)
The above command should work.
Next, try to build the Llama runner binary. This is where it will fail because the binary will try to link the data loader
(rm -rf cmake-out/examples/models/llama && \
pp cmake examples/models/llama \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-Bcmake-out/examples/models/llama && \
cmake --build cmake-out/examples/models/llama -j16)
The pp
in my commands are to set up fwdproxy
.
LGTM. The one test failure does not appear to be related... |
* [Windows Build] Implement MMAP for mmap_data_loader.cpp There is no sys/mman.h or posix-compatible mmap() implementation on Windows. The extension data loaders use it to map in data files, so adding an implementation. Test-run, & .\cmake-out\extension\data_loader\test\Debug\extension_data_loader_test.exe --gtest_brief=1 --gtest_filter=MmapDataLoader* Running main() from ...\executorch\third-party\googletest\googletest\src\gtest_main.cc [==========] 8 tests from 1 test suite ran. (50 ms total) [ PASSED ] 8 tests. * apply code suggestions * fix src -> srcs typo * try to fix build * fix src/headers brackets --------- Co-authored-by: Jeff Whiteside <[email protected]>
Summary
#5164 with the code suggestions applied.
Test plan
I am not familiar with how to test this area of the code. On non-Windows systems, it should be functionally the same.
#5164 suggests a command to run some relevant tests?