-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support for Apple Silicon (2nd try) #4110
Support for Apple Silicon (2nd try) #4110
Conversation
@@ -0,0 +1,16 @@ | |||
set(SRCS pthread/thread.cpp |
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.
Should pthread/thread.cpp be included for WIN32?
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.
Probably not... Though I copied this code from the boost-cmake repository. I think a cleaner way of doing this is to change the cmake code to compile thread and context in ExternalProject_add
(copying the files into the repository seems dangerous and painful)
One thing to be careful about here is that the run loop profiler had a bad interaction with our existing coroutine implementation that had to be resolved by temporarily disabling the profiler when context switching: foundationdb/fdbrpc/libcoroutine/Coro.c Line 315 in ea4c510
It seems possible that you could have a similar problem with a new library. |
@sfc-gh-ajbeamon do you know why it's only disabling profiling for the ucontext implementation? I would imagine that other implementations would have this problem. It makes sense that trying to capture a backtrace in the middle of changing stacks wouldn't work |
I don't remember off the top of my head, possibly checking old commit logs might have something. It could also just be that the ucontext implementation was the relevant one to our usage. |
@fdb-build run ctest please |
if(APPLE) | ||
# Boost coroutine currently doesn't support Apple Silicon, so we have to fall | ||
# back to the slower ucontext implementation | ||
add_compile_definitions(BOOST_USE_UCONTEXT) |
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.
One thing I am not quite clear is that, previously we just use this code to download and deploy a local boost library:
find_package(Boost 1.72)
if(Boost_FOUND)
add_library(boost_target INTERFACE)
target_link_libraries(boost_target INTERFACE Boost::boost)
else()
include(ExternalProject)
ExternalProject_add(boostProject
URL "https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2"
URL_HASH SHA256=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_IN_SOURCE ON
INSTALL_COMMAND ""
UPDATE_COMMAND ""
BUILD_BYPRODUCTS <SOURCE_DIR>/boost/config.hpp)
ExternalProject_Get_property(boostProject SOURCE_DIR)
set(BOOST_INCLUDE_DIR ${SOURCE_DIR})
message(STATUS "Boost include dir ${BOOST_INCLUDE_DIR}")
add_library(boost_target INTERFACE)
add_dependencies(boost_target boostProject)
target_include_directories(boost_target SYSTEM INTERFACE ${BOOST_INCLUDE_DIR})
endif()
Can we switch to this strategy rather than just injecting boost code into our code?
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.
The problem here is that boost coroutine2 depends on boost context - which is a library that needs to be compiled (so far we have only used header-only libraries). I agree that building this through ExternalProject_Add
is preferable, but this will need some more effort (I might still do this - but I am working on this in my free time so this is more a "I'll do it when I feel like it" kind of situation ;) )
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.
to make this even worse, it doesn't seem that boost compiles on my machine if I use the boost build system... Overall it might be easier to just wait for other stuff to support Apple Silicon (before I continue down the path of patching all of our dependencies...)
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 gotcha... I agree BJam is indeed hard to use -- I always use Debian prebuilt binaries.
The boost.coroutine thing might also unblock the #2235 musl work. |
Yes, I think we should merge this - even if it doesn't run on M1 macs. It seems that the only things missing are:
|
Tried using the C bindings from Rust produced by this branch and I'm getting a SIGBUS crash. I'm curious if anyone else was able to use them. Here's the dump:
|
I have the same SIGBUS crash when trying to run my golang application with go bindings |
This PR is resolves #4111
Changes in this PR:
General guideline:
Please verify that all things listed below were considered and check them. If an item doesn't apply to this type of PR (for example a documentation change doesn't need to be performance tested), you should make a
strikethrough(markdown syntax:~~strikethrough~~
). More infos on the guidlines can be found here.Style
git clang-format
).Performance
std::vector
vsVectorRef
).SlowTask
traces.Testing
ASSERT
,ASSERT_WE_THINK
, andTEST
macros are added in appropriate places.