Conversation
The libfabric backend's progress thread must apply the CUDA context inside the main loop rather than outside it. This fixes GPU memory operations failing when: 1. Progress thread starts in constructor BEFORE registerMem() is called 2. pthrCudaCtx_ is NULL until first GPU memory registration 3. Unlike UCX backend, libfabric doesn't restart thread on context change The fix calls vramApplyCtx() at the start of each iteration when cuda_addr_wa_ is set. This is safe to call repeatedly as vramApplyCtx() checks cuda_addr_wa_ first. Performance overhead is ~2us per iteration, acceptable for KV cache transfer latency. Without this fix, GPU Direct RDMA operations can fail with CUDA errors or access invalid GPU memory when the context changes mid-operation. Tested on AWS p5.48xlarge with TRT-LLM and vLLM disaggregated inference.
dmvevents
requested review from
akkart-aws,
amitrad-aws,
fengjica and
yexiangd
as code owners
January 16, 2026 02:27
|
👋 Hi dmvevents! Thank you for contributing to ai-dynamo/nixl. Your PR reviewers will review your contribution then trigger the CI to test your changes. 🚀 |
brminich
reviewed
Jan 19, 2026
| // CRITICAL: Must be inside loop because: | ||
| // 1. Progress thread starts in constructor BEFORE registerMem() is called | ||
| // 2. pthrCudaCtx_ is NULL until first GPU memory registration | ||
| // 3. UCX backend restarts thread on context change; libfabric doesn't |
Contributor
There was a problem hiding this comment.
cuda dependency is removed from UCX backend and is handled inside UCX now, probably this comment is not relevant anymore
Contributor
|
/ok to test ae2e91c |
Contributor
|
/build |
Author
Closing Per Maintainer Clarification@amitrad-aws - Thank you for clarifying the progress thread design. You're correct that Closing this PR. If we encounter CUDA context issues in production, we'll:
Thank you for your time reviewing this. |
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
Fixes GPU memory operation failures in the libfabric backend by applying the CUDA context inside the progress thread loop instead of outside it.
Problem
The libfabric backend's progress thread currently doesn't properly handle CUDA context changes during operation. This causes failures when:
registerMem()is calledpthrCudaCtx_is NULL until first GPU memory registrationSolution
Call
vramApplyCtx()at the start of each progress loop iteration whencuda_addr_wa_is set.This is safe because:
vramApplyCtx()checkscuda_addr_wa_internally before doing anythingTesting
Test Plan