Skip to content

transport/ib: set the IB traffic class only on GRH paths - #133

Open
0z5a wants to merge 1 commit into
NVIDIA:develfrom
0z5a:fix-ib-tclass-without-grh
Open

0z5a wants to merge 1 commit into
NVIDIA:develfrom
0z5a:fix-ib-tclass-without-grh

Conversation

@0z5a

@0z5a 0z5a commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #45.

Problem

On an InfiniBand port, IBGDA (ibgda_rc_init2rtr) and IBDevX (ep_connect) write NVSHMEM_IB_TRAFFIC_CLASS into the QP primary address path unconditionally, including LID-routed paths that carry no GRH (grh = 0). The traffic class is a GRH field. With any nonzero value, INIT->RTR is rejected and initialization aborts:

  • IBGDA: IBGDA QP modify INIT->RTR failed: type RC ... link_layer InfiniBand ... traffic_class 106, then ibgda_rc_init2rtr failed on RC #0
  • IBDevX: IBDEVX QP modify INIT->RTR failed ... link_layer InfiniBand ... traffic_class 106 ret 121 errno 121

IBRC is not affected: it sets ah_attr.grh.traffic_class through verbs, which ignores the GRH fields when is_global is 0.

Fix

Set primary_address_path.tclass only inside the branch that enables the GRH, next to the other GRH fields, in both transports. This matches the IBRC behaviour. The Ethernet/RoCE branches are not touched.

The SIGSEGV that follows the failed connection on devel is a separate error-path problem: under IBGDA it is in the proxy thread's progress_transports, and under IBDevX it is in nvshmemt_ibdevx_finalize, both reached from nvshmemi_setup_connections cleanup. This PR does not change that path.

Tested

Two GH200 nodes, one ConnectX-7 NDR port each (InfiniBand link layer, LID-routed, no GRH required), aarch64, CUDA 13.2, 2 PEs (1 per node), shmem_put_signal_ping_pong_latency (8 B–4 KB):

Transport IB_TRAFFIC_CLASS IB_FORCE_GRH devel 2dca770 This PR
IBGDA 106 0 INIT->RTR fails, then SIGSEGV pass (24.5 µs)
IBDevX 106 0 INIT->RTR fails, then SIGSEGV pass (16.2 µs)
IBRC 106 0 pass (16.4 µs) pass (16.4 µs)
IBGDA 0 0 pass (24.7 µs) pass (25.1 µs)
IBDevX 0 0 pass (15.5 µs) pass (15.8 µs)
IBRC 0 0 pass (15.8 µs) pass (16.2 µs)
IBGDA 106 1 pass (25.3 µs) pass (25.6 µs)
IBDevX 106 1 pass (15.9 µs) pass (15.8 µs)
IBRC 106 1 pass (16.3 µs) pass (16.1 µs)

The value in parentheses is the 8 B shmem_put_signal_ping_pong_latency round trip (200 iterations). It only shows that the connection carries traffic; there is no performance claim. shmem_put_latency with IB_TRAFFIC_CLASS=106 also passes on all three transports with this PR. With IB_FORCE_GRH=1 the traffic class is still programmed, now inside the GRH branch.

Not tested

  • RoCE: this PR does not touch the Ethernet paths, and I have no RoCE NIC to confirm that.
  • Subnets or fabrics that require a GRH (grh_required), other than forcing it with NVSHMEM_IB_FORCE_GRH=1.

Related: #25 changes where the IBGDA traffic class comes from on RoCE. It edits the same functions but not the InfiniBand branch changed here; if it lands first, the moved line should use its traffic-class value as well.

The commit carries a DCO sign-off.

On an InfiniBand port, ibgda and ibdevx write NVSHMEM_IB_TRAFFIC_CLASS
into the QP primary address path even when the path is LID-routed and
carries no GRH. Firmware rejects a nonzero tclass without a GRH, so
INIT->RTR fails (errno 121) and the job aborts during connection setup
as soon as the variable is set, which is what NVIDIA#45 reports. IBRC is not
affected because verbs ignores grh.traffic_class when is_global is 0.

Program tclass only where the GRH is enabled, next to the other GRH
fields, which matches the IBRC behaviour. RoCE paths are unchanged.

Fixes NVIDIA#45.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
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.

[Issue]: IB env will fail if export NVSHMEM_IB_TRAFFIC_CLASS

1 participant