Skip to content

Comments

Add MakeClientFromApi to C++ PJRT bridge#2490

Merged
avik-pal merged 1 commit intoEnzymeAD:mainfrom
Dale-Black:metal-pjrt-cpp
Feb 20, 2026
Merged

Add MakeClientFromApi to C++ PJRT bridge#2490
avik-pal merged 1 commit intoEnzymeAD:mainfrom
Dale-Black:metal-pjrt-cpp

Conversation

@Dale-Black
Copy link
Contributor

Summary

Adds a new C++ function MakeClientFromApi that allows Julia-allocated PJRT_Api structs to be registered with XLA's PJRT infrastructure without needing dlopen on 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): New MakeClientFromApi(api, device_type, client_name, error) function that:
    1. Calls pjrt::SetPjrtApi() to register the API struct
    2. Calls InitializePjrtPlugin() to initialize the plugin
    3. Calls RegisterProfiler() and returns the client via GetCApiClient()
  • deps/ReactantExtra/BUILD (+1 line): Exports _MakeClientFromApi symbol

Context

The Metal PJRT backend (PR #2489) implements PJRT callbacks as Julia @cfunction pointers packed into a PJRT_Api struct. Unlike GPU/TPU plugins which are loaded via dlopen on a .so/.dylib, the Metal backend lives in Julia and needs a way to register its PJRT_Api struct directly with XLA. This function provides that bridge.

Test plan

🤖 Generated with Claude Code

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>
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.10%. Comparing base (b39a1fc) to head (5489117).
⚠️ Report is 700 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (b39a1fc) and HEAD (5489117). Click for more details.

HEAD has 92 uploads less than BASE
Flag BASE (b39a1fc) HEAD (5489117)
99 7
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@avik-pal avik-pal merged commit 24b091e into EnzymeAD:main Feb 20, 2026
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants