-
Notifications
You must be signed in to change notification settings - Fork 15
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
C-API bindings for IFRT #164
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
i added some utilities for Julia-like conversion in C++ and better communication between Julia and C.
for example, imagine a function that returns a extern "C" span<Device*> the_function(...) {
return convert(Type<span<Device*>>(), some_func_that_returns_a_absl_Span(...))
} conceptually works, in practice a need to add some particular implementations so it works (i'm sure it can be done more generically but i don't have the time nor the energy to learn the terribly complicated C++) |
93f73a3
to
c00ac05
Compare
@ftynse given this is a priority for the distributed working group, do you mind adding this to PRONTOLab/GB-25#1? |
Sure, we are also still figuring out the project management stack |
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.
build fails, so it's not yet ready to merge but it can be reviewed while we fix it
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.
As mentioned already on Slack, the changes to ReactantExtra should be done in a separate PR, to be merged before this one, to allow a build on Yggdrasil
src/IFRT/IFRT.jl
Outdated
""" | ||
backend(x) | ||
|
||
Returns the `Backend` trait of the given IFRT object. | ||
""" | ||
function backend end |
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.
┌ Error: 1 docstring not included in the manual:
│
│ Reactant.IFRT.backend
│
│ These are docstrings in the checked modules (configured with the modules keyword)
│ that are not included in canonical @docs or @autodocs blocks.
└ @ Documenter ~/.julia/packages/Documenter/Bs999/src/utilities/utilities.jl:44
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.
mmm weird? there's nothing fancy around this. do you have an idea of what can be happening?
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.
You simply need to add this docstring to the documentation
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.
ah, misunderstood the problem
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.
Bump
More errors in BB:
|
mmm |
Sounds like #164 (comment) still needs to be resolved though. |
mmm that explains why it works in my macbook but not on yggy
sure. If it's not giving linking problems, I can set it as just i'm still having this issue though when building it with clang
|
I don't see that symbol in the BinaryBuilder build: sandbox:${WORKSPACE} # c++filt -_ __ZNSt13exception_ptr31__from_native_exception_pointerEPv
std::exception_ptr::__from_native_exception_pointer(void*)
sandbox:${WORKSPACE} # nm libReactantExtra.dylib | grep __ZNSt13exception_ptr31__from_native_exception_pointerEPv
sandbox:${WORKSPACE} # nm libReactantExtra.dylib | grep exception | /opt/${MACHTYPE}/bin/${MACHTYPE}-c++filt -_
000000000687eec8 t llvm::ARMAttributeParser::ABI_FP_exceptions(llvm::ARMBuildAttrs::AttrType)
000000000687eee4 t llvm::ARMAttributeParser::ABI_FP_user_exceptions(llvm::ARMBuildAttrs::AttrType)
U std::exception::what() const
U std::exception_ptr::exception_ptr(std::exception_ptr const&)
U std::exception_ptr::~exception_ptr()
U std::exception_ptr::operator=(std::exception_ptr const&)
U std::__1::__assoc_sub_state::set_exception(std::exception_ptr)
U std::exception::~exception()
U std::current_exception()
U std::rethrow_exception(std::exception_ptr)
0000000001d6cf58 t std::exception_ptr std::make_exception_ptr<std::__1::future_error>(std::__1::future_error)
0000000001d073cc t std::exception_ptr std::make_exception_ptr<std::__1::future_error>(std::__1::future_error)
U typeinfo for std::exception
000000000845cee0 s llvm::ARMAttributeParser::ABI_FP_exceptions(llvm::ARMBuildAttrs::AttrType)::strings
000000000845cef0 s llvm::ARMAttributeParser::ABI_FP_user_exceptions(llvm::ARMBuildAttrs::AttrType)::strings
U ___cxa_allocate_exception
U ___cxa_free_exception
U _task_get_exception_ports
U _task_set_exception_ports Maybe it's a problem with your toolchain? |
probably, just found out that it links to this would explain the "mixing between libstdc++ and libc++": there's no such mix, it's just that in my local build, it expects libc++ to provide that symbol and can't link it because it doesn't find it. i was building with Homebrew's LLVM 19, but trying again with LLVM 16. |
That's normal, macOS hides system libraries and header files from the filesystem: https://en.wikipedia.org/wiki/System_Integrity_Protection |
Also: #164 (review)
☝️ |
i'm leaving this PR just for the changes in ReactantExtra and gonna move the Julia part of the bindings to a new PR
it seems like so. using |
|
||
template<> | ||
void* capture_shared(std::shared_ptr<void> ptr) { | ||
captured_shared_ptr[ptr.get()] = ptr; |
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.
we should use the new wrapper type as we talked about earlier (the global can work, but will cause concurrency issues that won't happen with the wrapper)
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.
sure, using the new wrapper type solves concurrency issues but AFAIK the logic in Reactant.jl works on single thread as of today right?
since this seems to work as of now, i wanted to get this merged first and then switch to the new holder types on the next PR.
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.
no, Reactant.jl logic isn't limited to a single thread (and user code can allocate in multiple threads)
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.
okay, then let me prototype sth
…s,layouts + hlomodules
* rcref wrapper + fixed some compile errors * fixed compile errors
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
This time for real.
RCReference
capture mapRCReference
capture mapSharding::devices
devices
argument toifrt_sharding_with_device_assignment
OpaqueSharding
ConcreteSharding
ConcreteEvenSharding
ShardingParamsSharding
DeserializeShardingOptions
GetDefaultLayout
Attributes
descriptions
(ifrt_topology_device_descriptions
)on_done_with_host_buffer
argument toifrt_client_make_array_from_host_buffer
RemapArrays
,Attributes
,GetAllDevices
,GetDefaultDeviceAssignment
methodGetCompiledMemoryStats
GetCostAnalysis
ifrt_loadedexecutable_parameter_shardings
ifrt_loadedexecutable_output_shardings
ifrt_loadedexecutable_parameter_layouts
ifrt_loadedexecutable_output_layouts
GetOutputMemoryKinds
GetCostAnalysis
Execute
CompileOptions
constructorDeserializeExecutableOptions
andCompileOptions
are really deprecatedPjRtClient::CompileOptions
RCReference
capture map