UCT/CUDA_IPC/ROCM_IPC: Zero the padding of a packed rkey #12509
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 270 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.335
Real PR Conversation Timeline
1 comments
"Review active on #12509"
general
weight: 0.35
tvegas1
What?
The remote key packed by cuda_ipc and rocm_ipc no longer contains uninitialized padding bytes.
Why?
Fixes #12099.
uct_cuda_ipc_rkey_thas 4 bytes of padding betweenpidandd_bptr.uct_cuda_ipc_extended_rkey_t, which is packed in a non-default PID namespace, has 4 more at its end.uct_cuda_ipc_mkey_pack()sets the fields one by one, so these bytes kept whatever the destination buffer held: heap data forucp_rkey_pack(), or the previous contents of a send buffer when the key is packed into a rendezvous RTS.uct_rocm_ipc_key_tends with 4 bytes of padding. The key is allocated withucs_malloc()and copied as a whole when it is packed, so the packed key carries heap data as well.As a result:
Unpacking does not read these bytes, so transfers are not affected.
How?
uct_cuda_ipc_mkey_pack()zeroes the whole packed key before it sets the fields.uct_cuda_ipc_rkey_packed_size()gives the size to both the MD query and the pack, so that the extended key is covered.ucs_calloc(). The memset of its IPC signal became redundant and is removed.test_md.mkey_pack_all_bytespacks the same memory handle into a buffer filled with 0x00 and a buffer filled with 0xff, and expects equal bytes. It runs for every MD that registers memory and needs an rkey.The rocm_ipc case is not caught by comparing the two buffers, because a byte copied from the uninitialized key is equal in both. The test covers it with
VALGRIND_CHECK_MEM_IS_DEFINED(), which takes effect only under valgrind.Testing
Not built or run locally: there was no CUDA or ROCm host at hand, so this relies on CI. The test logic was replayed against a copy of the cuda_ipc structures: without the memset the two buffers differ in 4 bytes (8 for the extended key), and with it they are equal.
🤖 Generated with Claude Code