Add MakeClientFromApi to C++ PJRT bridge#2490
Merged
avik-pal merged 1 commit intoEnzymeAD:mainfrom Feb 20, 2026
Merged
Conversation
Allows Julia-allocated PJRT_Api structs (filled with @cfunction pointers) to be registered directly with XLA without requiring dlopen of a shared library. This is the entry point for the Metal PJRT backend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
avik-pal
approved these changes
Feb 20, 2026
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #2490 +/- ##
===========================================
- Coverage 68.16% 38.10% -30.06%
===========================================
Files 109 196 +87
Lines 11779 29872 +18093
===========================================
+ Hits 8029 11384 +3355
- Misses 3750 18488 +14738 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new C++ function
MakeClientFromApithat allows Julia-allocatedPJRT_Apistructs to be registered with XLA's PJRT infrastructure without needingdlopenon a shared library.This is the C++/Bazel portion of the Metal PJRT backend work, split out per @avik-pal's request from #2489 so a new JLL can be built independently.
Changes
deps/ReactantExtra/API.cpp(+21 lines): NewMakeClientFromApi(api, device_type, client_name, error)function that:pjrt::SetPjrtApi()to register the API structInitializePjrtPlugin()to initialize the pluginRegisterProfiler()and returns the client viaGetCApiClient()deps/ReactantExtra/BUILD(+1 line): Exports_MakeClientFromApisymbolContext
The Metal PJRT backend (PR #2489) implements PJRT callbacks as Julia
@cfunctionpointers packed into aPJRT_Apistruct. Unlike GPU/TPU plugins which are loaded viadlopenon a.so/.dylib, the Metal backend lives in Julia and needs a way to register itsPJRT_Apistruct directly with XLA. This function provides that bridge.Test plan
nm libReactantExtra.so | grep MakeClientFromApishows the symbol🤖 Generated with Claude Code