-
Notifications
You must be signed in to change notification settings - Fork 31
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
Improve Objective-C interfacing #104
Comments
Great write-up, thanks.
Although I'd very much like a native FFI, aren't we going to be running into the same memory-management problems then, and wouldn't we avoid those by using metalcpp? Or can you parse that info from the headers?
You mean, as an alternative back-end for Metal.jl? Which wrapping solution would you propose to use for that? CxxWrap.jl is pretty laborious, and Cxx.jl isn't functional.
Although the focus is currently on compute, as you probably noticed by the bits of Metal I didn't care to wrap in libcmt or the MTL wrappers, I see no problem in adding more broad functionality to Metal.jl. The scope should be to offer Julia support for whatever the Metal libraries have to offer, or at least the bits that somebody cared to wrap and test. For me, that's only the compute parts, but feel free to work on other areas. |
Thanks for reading! I will add a PR that concretely tries to clarify in code some of the confusing points of my writeup. |
With #117 merged, this should now be much easier to contribute to. In that PR, I've just copied whatever memory management we were doing, so those points remain. The Clang generator is also still very relevant, although we could probably get most of the benefits already by just having it generate enum definitions instead of the whole Objective-C call signatures (which are both difficult to generate, and might still evolve in ObjectiveC.jl). @habemus-papadum Since you have a better understanding of the exact memory management semantics in ObjectiveC, feel free to propose changes on that front! I don't have plans for any other large-scale refactors right now, so hopefully we can stabilize the interface a bit. |
Sounds good -- I was going to write up (& work on) a proposal for a clang-based MacOS Framework to Julia package generator. It would discuss memory management, testing strategy, syntax, api availability, edge cases, etc -- I think it is better suited to start that conversation in Objective-C.jl. If you agree, I think we close this issue as complete, and revisit in Metal.jl after a generator exists. |
Fine for me. |
libcmt
seems both useful but also difficult to maintain as Apple makes changes to theMetal.framework
. It might make sense to come up with alibcmt
plan.I would suggest:
mtNewCommandBufferWithDescriptor
->mtCommandBufferWithDescriptor
to better indicate what should be MRR and what is autoreleased-fno-objc-arc
xctrace record
libcmt
with a pure Julia implementationsel_getName
,objc_msgSend
, etc) in the way metalcpp doesProbably before spending too much time on revamping
libcmt
it could be useful to agree a scope forMetal.jl
. I would be interested in support being complete enough to write a game engine in Julia e.g.The text was updated successfully, but these errors were encountered: