Open nickkaltner opened 14 hours ago
I also get the crash on my end, but it's silent as well. I suspect memory issues or something like that. @jonatanklosko any thoughts on how to debug this?
I tried running the code in iex
-- looks like it segfaults. I haven't found the root cause out yet, but here is the stacktrace:
(lldb)
* thread #40, stop reason = EXC_BAD_ACCESS (code=1, address=0xc0341497400)
* frame #0: 0x00000001977d3230 libsystem_platform.dylib`_platform_memmove + 144
frame #1: 0x000000011c81cbf0 libmlx.dylib`float* std::__1::__constexpr_memmove[abi:ue170006]<float, float const, 0>(float*, float const*, std::__1::__element_count) + 80
frame #2: 0x000000011c81cb68 libmlx.dylib`std::__1::pair<float const*, float*> std::__1::__copy_trivial_impl[abi:ue170006]<float const, float>(float const*, float const*, float*) + 72
frame #3: 0x000000011c81cacc libmlx.dylib`std::__1::pair<float const*, float*> std::__1::__copy_trivial::operator()[abi:ue170006]<float const, float, 0>(float const*, float const*, float*) const + 44
frame #4: 0x000000011c81ca44 libmlx.dylib`std::__1::pair<float const*, float*> std::__1::__unwrap_and_dispatch[abi:ue170006]<std::__1::__overload<std::__1::__copy_loop<std::__1::_ClassicAlgPolicy>, std::__1::__copy_trivial>, float const*, float const*, float*, 0>(float const*, float const*, float*) + 88
frame #5: 0x000000011c81c9d0 libmlx.dylib`std::__1::pair<float const*, float*> std::__1::__dispatch_copy_or_move[abi:ue170006]<std::__1::_ClassicAlgPolicy, std::__1::__copy_loop<std::__1::_ClassicAlgPolicy>, std::__1::__copy_trivial, float const*, float const*, float*>(float const*, float const*, float*) + 40
frame #6: 0x000000011c81c98c libmlx.dylib`std::__1::pair<float const*, float*> std::__1::__copy[abi:ue170006]<std::__1::_ClassicAlgPolicy, float const*, float const*, float*>(float const*, float const*, float*) + 40
frame #7: 0x000000011c81ae20 libmlx.dylib`float* std::__1::copy[abi:ue170006]<float const*, float*>(float const*, float const*, float*) + 40
frame #8: 0x000000011d077724 libmlx.dylib`void mlx::core::gather<float, unsigned int>(mlx::core::array const&, std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>> const&, mlx::core::array&, std::__1::vector<int, std::__1::allocator<int>> const&, std::__1::vector<int, std::__1::allocator<int>> const&) + 1604
frame #9: 0x000000011d05ca3c libmlx.dylib`void mlx::core::dispatch_gather<unsigned int>(mlx::core::array const&, std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>> const&, mlx::core::array&, std::__1::vector<int, std::__1::allocator<int>> const&, std::__1::vector<int, std::__1::allocator<int>> const&) + 408
frame #10: 0x000000011d05c0b8 libmlx.dylib`mlx::core::Gather::eval(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>> const&, mlx::core::array&) + 556
frame #11: 0x000000011d1cb9e0 libmlx.dylib`mlx::core::Gather::eval_cpu(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>> const&, mlx::core::array&) + 40
frame #12: 0x000000011c8deef8 libmlx.dylib`mlx::core::UnaryPrimitive::eval_cpu(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>> const&, std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>&) + 76
frame #13: 0x000000011c9eac6c libmlx.dylib`mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4::operator()() + 272
frame #14: 0x000000011c9eab50 libmlx.dylib`decltype(std::declval<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4&>()()) std::__1::__invoke[abi:ue170006]<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4&>(mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4&) + 24
frame #15: 0x000000011c9eab08 libmlx.dylib`void std::__1::__invoke_void_return_wrapper<void, true>::__call[abi:ue170006]<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4&>(mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4&) + 24
frame #16: 0x000000011c9eaae4 libmlx.dylib`std::__1::__function::__alloc_func<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4, std::__1::allocator<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4>, void ()>::operator()[abi:ue170006]() + 28
frame #17: 0x000000011c9e9914 libmlx.dylib`std::__1::__function::__func<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4, std::__1::allocator<mlx::core::eval_impl(std::__1::vector<mlx::core::array, std::__1::allocator<mlx::core::array>>, bool)::$_4>, void ()>::operator()() + 28
frame #18: 0x000000011c9c5f80 libmlx.dylib`std::__1::__function::__value_func<void ()>::operator()[abi:ue170006]() const + 68
frame #19: 0x000000011c9c5738 libmlx.dylib`std::__1::function<void ()>::operator()() const + 24
frame #20: 0x000000011c9c4a10 libmlx.dylib`mlx::core::scheduler::StreamThread::thread_fn() + 288
frame #21: 0x000000011c9c69d8 libmlx.dylib`decltype(*std::declval<mlx::core::scheduler::StreamThread*>().*std::declval<void (mlx::core::scheduler::StreamThread::*)()>()()) std::__1::__invoke[abi:ue170006]<void (mlx::core::scheduler::StreamThread::*)(), mlx::core::scheduler::StreamThread*, void>(void (mlx::core::scheduler::StreamThread::*&&)(), mlx::core::scheduler::StreamThread*&&) + 116
frame #22: 0x000000011c9c6918 libmlx.dylib`void std::__1::__thread_execute[abi:ue170006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (mlx::core::scheduler::StreamThread::*)(), mlx::core::scheduler::StreamThread*, 2ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (mlx::core::scheduler::StreamThread::*)(), mlx::core::scheduler::StreamThread*>&, std::__1::__tuple_indices<2ul>) + 48
frame #23: 0x000000011c9c6214 libmlx.dylib`void* std::__1::__thread_proxy[abi:ue170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (mlx::core::scheduler::StreamThread::*)(), mlx::core::scheduler::StreamThread*>>(void*) + 84
frame #24: 0x00000001977a2f94 libsystem_pthread.dylib`_pthread_start + 136
I'm on an m1 macbook pro - here is a gist of what i did;
https://gist.github.com/nickkaltner/38d0801b11c12407ac50e3517685e623.
The first and second cells work, the third crash the runtime.
Is there a debug option I should be using?
thanks!