bindings/rust: bind the optional-args custom parameter (#2155)
## What? Binds the optional-args custom parameter into the Rust C API layer and `nixl-sys`. - C API: `nixl_capi_opt_args_set_custom_param` / `_get_custom_param`, with matching `stubs.cpp` forwarders - nixl-sys: `OptArgs::set_custom_param` / `get_custom_param` - a memory view test that sets `worker_id=0` and prepares a view with it ## Why? `prepMemView` is the reason. `nixlAgent::prepMemView` copies `extra_params->customParam` into the backend args in both overloads (`nixl_agent.cpp:1921`, `:1994`), and the UCX backend parses `worker_id=<n>` out of it to choose which shared worker the view binds to (`ucx_backend.cpp:1036-1060`). The device API test sets it the same way: ```cpp extra_params.customParam = "worker_id=" + std::to_string(worker_id); // test/gtest/device_api/single_write_test.cu:455 ``` Without a binding a Rust caller cannot select the worker, so the memory views added in #2060 are reachable but not fully controllable. It is the only field of `nixl_opt_args_t` that `prepMemView` reads, and it was the one field the bindings did not expose. ## How? The setter is byte-oriented (`const void *`, `size_t`), mirroring `nixl_capi_opt_args_set_notif_msg` rather than the `const char *` of `set_ip_addr`. The blob is not always text: the gpunetio backend stores a raw `cudaStream_t` in it (`gpunetio_backend.cpp:1141`), which a C-string API would truncate at the first zero byte. ## Testing 106 tests pass with `cargo test -- --test-threads=1` — 97 in `tests.rs`, 5 in `mem_view.rs`, 4 in `test_sync_manager.rs` — on UCX 1.21 with a CUDA device. The new test runs by default; it needs a GPU but no device-capable RDMA lane. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for setting and retrieving custom binary parameters through optional arguments. * Custom parameters preserve arbitrary byte content, including embedded zero bytes. * Added support for using custom parameters when preparing local GPU memory views. * **Bug Fixes** * Improved handling of returned binary data, including empty values and notification messages. * **Tests** * Added coverage for parameter round-tripping and CUDA-based memory view preparation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Shahaf Kiselnik <smeir@nvidia.com>
S
ShahafMeir committed
885c49d838a19a5047e21daf1582ff028b84bd6f
Parent: a00aa92
Committed by GitHub <noreply@github.com>
on 8/25/2026, 10:42:36 AM