Skip to content

test(efa): add EFA packaging checks to the nightly -efa image jobs - #12868

Closed
jh-nv wants to merge 2 commits into
mainfrom
jihao/efa-image-packaging-test
Closed

jh-nv wants to merge 2 commits into
mainfrom
jihao/efa-image-packaging-test

Conversation

@jh-nv

@jh-nv jh-nv commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Nightly and post-merge both build six -efa runtime image variants (vllm/sglang/trtllm × amd64/arm64), and nothing verifies the EFA packaging of any of them. The existing vllm-efa-test / trtllm-efa-test post-merge jobs run '(pre_merge or post_merge) and <framework> and gpu_0' — character-for-character the same markers as their non-EFA counterparts, touching nothing EFA-specific. Nightly has no EFA test jobs at all.

Every EFA regression we have hit was a packaging regression that no functional test could see until it reached a p5/GB200 cluster, and each degrades to a silent UCX fallback rather than a hard failure:

  • an image shipping a NIXL plugin directory with no LIBFABRIC plugin
  • NIXL linked against the generic from-source libfabric instead of the EFA SDK's, so HMEM/CUDA dmabuf descriptors do not match at runtime
  • arm64 putting plugins somewhere other than where NIXL_PLUGIN_DIR points

Changes

  • tests/container/test_efa_image.py (new, marker efa_image) — six checks: EFA SDK installed · EFA_VERSION recorded · efa provider compiled into libfabric (fi_info -l) · NIXL_PLUGIN_DIR holds libplugin_LIBFABRIC.so · that plugin's ldd resolves libfabric under /opt/amazon/efa · libnixl.so sits beside the plugins and every LD_PRELOAD entry resolves. No GPU, no EFA device, no cluster; a few seconds per image.
  • pyproject.toml — register the efa_image marker.
  • .github/workflows/nightly-ci.yml — add vllm-efa-test, sglang-efa-test, trtllm-efa-test, each running only efa_image and gpu_0 against its nightly -efa image on amd64 and arm64.

Cadence: nightly, not per-commit. EFA changes are sparse, so paying for these on every push to main costs more CI than the risk warrants. post-merge-ci.yml is deliberately left untouched by this PR.

Paths are read from the environment rather than hardcoded, because they genuinely differ: vllm-runtime:1.3.1-efa uses NIXL_PLUGIN_DIR=/opt/nvidia/nvda_nixl/lib64/plugins on amd64 but /opt/dynamo/nixl/plugins on arm64. A hardcoded lib64 assertion would have failed on arm64 — which is the very bug class this test exists to catch. NIXL_LIB_DIR is also not exported by every runtime stage (trtllm_runtime.Dockerfile sets only NIXL_PLUGIN_DIR and LD_PRELOAD), so the libnixl check falls back to the plugin directory's parent rather than going vacuous.

Validation

Executed in CI-built EFA images. Before the switch to nightly, this branch's post-merge variant was dispatched on pull-request/12868 (run 31238756257); vllm-runtime-efa built and both CPU Test jobs passed:

Job Summary
amd64 1110 passed, 9 skipped — 0 failed, 0 errors
arm64 1110 passed, 10 skipped — 0 failed, 0 errors

All six tests appear by name in both logs with zero FAILED/ERROR lines. Only the wiring changed afterwards; the test file's assertions are unchanged.

Executed in released images on the AWS dev clusters (mounted at /workspace/tests/container, run with the image's own Python, in pods holding no GPU and no EFA device — the same condition as the CI runner):

Image Result
vllm-runtime:1.3.1-efa — amd64 6 passed
vllm-runtime:1.3.1-efa — arm64 6 passed
sglang-runtime:1.3.1-efa — amd64 6 passed
sglang-runtime:1.3.1 (non-EFA, negative control) 5 failed, 1 skipped
vllm-runtime:1.3.1 (non-EFA, negative control) 4 failed — including the libfabric-linkage check

Repo-level: pytest --collect-only under --strict-markers collects 6, and -m 'efa_image and gpu_0' selects all 6; tests/report_pytest_markers.py reports Missing sets: 0 across 4660 tests; isort / black / flake8 / ruff / codespell / check-yaml / check-toml pass; both workflow files parse.

Known gaps

  • nvcr.io/nvidia/ai-dynamo/trtllm-runtime is not publicly pullable, so the TRT-LLM EFA image was not exercised directly. By inspection, aws.Dockerfile's trtllm branch sets NIXL_PLUGIN_DIR=/opt/nvidia/nvda_nixl/lib64/plugins and LD_PRELOAD=/opt/nvidia/nvda_nixl/lib64/libnixl.so, which both checks handle — worth watching the first nightly trtllm-efa-test.
  • These checks cover packaging, not function: no RDMA, no memory registration, no KV transfer. Functional EFA validation on real p5/GB200 clusters is the follow-up.
  • The pytest-marker-report pre-commit hook was skipped at commit time: its hook venv runs on this machine's Python 3.9, which cannot import tests/utils/collection_env_guard.py (str | None). The same script was run under Python 3.12 — Missing sets: 0.

An internal Linear ticket also tracks this work.

🤖 Generated with Claude Code

Post-merge builds six -efa runtime image variants (vllm/sglang/trtllm x
amd64/arm64) and validates the EFA-ness of none of them: vllm-efa-test and
trtllm-efa-test run the same CPU-only framework markers as their non-EFA
counterparts, and sglang-efa-build has no test job at all.

Every EFA regression so far has been a packaging regression that no functional
test could see until it reached a p5/GB200 cluster, and each one degrades to a
silent UCX fallback rather than a hard failure:

- an image shipping a NIXL plugin directory with no LIBFABRIC plugin
- NIXL linked against the generic from-source libfabric instead of the EFA
  SDK's, so HMEM/CUDA dmabuf descriptors do not match at runtime
- arm64 putting plugins somewhere other than where NIXL_PLUGIN_DIR points

Add tests/container/test_efa_image.py (marker efa_image): EFA SDK installed,
EFA_VERSION recorded, efa provider compiled into libfabric, NIXL_PLUGIN_DIR
holds libplugin_LIBFABRIC.so, that plugin's ldd resolves libfabric under
/opt/amazon/efa, and libnixl.so sits beside the plugins with every LD_PRELOAD
entry resolvable. No GPU, no EFA device and no cluster required, so it runs in
the existing image test jobs on both arches.

Paths come from the environment rather than hardcoded: 1.3.1-efa uses
NIXL_PLUGIN_DIR=/opt/nvidia/nvda_nixl/lib64/plugins on amd64 but
/opt/dynamo/nixl/plugins on arm64, and NIXL_LIB_DIR is not exported by every
runtime stage.

Widen the vllm and trtllm EFA jobs to '(<framework> or efa_image)' and add the
missing sglang-efa-test job.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Jie Hao <[email protected]>
@jh-nv
jh-nv requested review from a team as code owners August 8, 2026 04:06
@github-actions github-actions Bot added the test label Aug 8, 2026
@jh-nv

jh-nv commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 50f220c

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR adds pytest checks for EFA runtime-image packaging and enables them in vLLM, TRT-LLM, and SGLang EFA post-merge CI jobs.

Changes

EFA image validation and CI

Layer / File(s) Summary
EFA image packaging checks
pyproject.toml, tests/container/test_efa_image.py
The efa_image marker and tests validate EFA SDK files, version metadata, provider support, NIXL plugin linkage, and runtime library paths.
EFA CI job wiring
.github/workflows/post-merge-ci.yml
vLLM and TRT-LLM jobs include efa_image tests. A CPU-only SGLang EFA test job runs the same marker coverage.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed, but it omits the required Related Issues section and does not identify where reviewers should start. Add the required Related Issues section with an issue link or no-issue confirmation, and specify the files or sections where review should start.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the EFA packaging checks, but it incorrectly says they target nightly jobs instead of the changed post-merge jobs.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/container/test_efa_image.py`:
- Around line 33-39: Add pytest.mark.timeout(180) to the module-level pytestmark
list in test_efa_image.py, alongside the existing markers, so each test has a
180-second runtime limit.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2a1d6d6c-99cb-41b5-824f-bcd29bbe7073

📥 Commits

Reviewing files that changed from the base of the PR and between c80a6b1 and 50f220c.

📒 Files selected for processing (3)
  • .github/workflows/post-merge-ci.yml
  • pyproject.toml
  • tests/container/test_efa_image.py

Comment on lines +33 to +39
pytestmark = [
pytest.mark.efa_image,
pytest.mark.pre_merge,
pytest.mark.post_merge,
pytest.mark.unit,
pytest.mark.gpu_0,
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- tests/container/test_efa_image.py outline ---'
ast-grep outline tests/container/test_efa_image.py || true

printf '%s\n' '--- tests/container/test_efa_image.py ---'
cat -n tests/container/test_efa_image.py

printf '%s\n' '--- timeout and marker configuration ---'
rg -n -C 3 'timeout|efa_image|pre_merge|post_merge|unit|gpu_0' \
  .ai/pytest-guidelines.md pyproject.toml tests/conftest.py tests/container \
  2>/dev/null || true

Repository: ai-dynamo/dynamo

Length of output: 27568


🏁 Script executed:

#!/bin/bash
set -eu
sed -n '1,220p' tests/container/test_efa_image.py
printf '\n--- timeout references ---\n'
rg -n -C 4 'pytest\.mark\.timeout|timeout\(' tests/container .ai/pytest-guidelines.md pyproject.toml tests/conftest.py 2>/dev/null || true

Repository: ai-dynamo/dynamo

Length of output: 10447


🏁 Script executed:

#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path

path = Path("tests/container/test_efa_image.py")
lines = path.read_text().splitlines()
for number, line in enumerate(lines, 1):
    print(f"{number:4}: {line}")
PY

printf '\n--- relevant repository rules ---\n'
for path in .ai/pytest-guidelines.md pyproject.toml tests/conftest.py; do
  if [ -f "$path" ]; then
    printf '\n[%s]\n' "$path"
    rg -n -C 5 'timeout|efa_image|pre_merge|post_merge|unit|gpu_0' "$path" || true
  fi
done

Repository: ai-dynamo/dynamo

Length of output: 23376


Add a module-level pytest timeout marker.

The module runs fi_info and ldd through subprocess.run(..., timeout=60). Add pytest.mark.timeout(180) to bound each test's total runtime.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/container/test_efa_image.py` around lines 33 - 39, Add
pytest.mark.timeout(180) to the module-level pytestmark list in
test_efa_image.py, alongside the existing markers, so each test has a 180-second
runtime limit.

Sources: Coding guidelines, Path instructions, Learnings

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Open in Devin Review

Comment on lines +33 to +39
pytestmark = [
pytest.mark.efa_image,
pytest.mark.pre_merge,
pytest.mark.post_merge,
pytest.mark.unit,
pytest.mark.gpu_0,
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 New EFA image checks will also run in ordinary non-EFA test images and fail

The new EFA packaging checks are labelled only as "pre-merge, no-GPU" without any framework label (pytestmark at tests/container/test_efa_image.py:33-39), so the general pre-merge test job that runs everything not tied to a framework will pick them up inside a plain image that has no EFA software installed.
Impact: Every pull request's pre-merge run (and the nightly run) will report failures for these checks even though nothing is wrong.

Marker selection math: the framework-exclusion job matches these tests

The pre-merge "dynamo-runtime" pipeline runs the whole repo suite with -m 'pre_merge and not parallel and not (vllm or sglang or trtllm) and (gpu_0)' (.github/workflows/pr.yaml:991, and the same selector in .github/workflows/nightly-ci.yml:946) inside the plain dynamo runtime image built by .github/workflows/dynamo-pipeline.yml.

tests/container/test_efa_image.py carries pre_merge, gpu_0, unit and no parallel and no framework marker, so it satisfies that selector exactly. In a non-EFA image /opt/amazon/efa does not exist and EFA_VERSION / NIXL_PLUGIN_DIR are unset — the PR description's own negative-control runs show "5 failed, 1 skipped" / "4 failed" for exactly this situation.

The pytest action runs a repo-wide collection (.github/actions/pytest/action.yml:284), so file location does not shield the tests.

Options: gate the module on the EFA image (e.g. pytest.mark.skipif on absence of /opt/amazon/efa, or an explicit opt-in env var set by the -efa jobs), or exclude efa_image from the framework-agnostic selectors in pr.yaml/nightly-ci.yml.

Prompt for agents
The new tests in tests/container/test_efa_image.py are marked pre_merge + gpu_0 + unit with no framework marker. The pre-merge 'dynamo-runtime' pipeline (.github/workflows/pr.yaml:990-992, mirrored in .github/workflows/nightly-ci.yml:945-946) selects 'pre_merge and not parallel and not (vllm or sglang or trtllm) and (gpu_0)' and runs a repo-wide pytest collection inside the plain (non-EFA) dynamo runtime image. These EFA packaging assertions therefore get collected there and will fail hard, since /opt/amazon/efa, EFA_VERSION and NIXL_PLUGIN_DIR do not exist in a non-EFA image (the PR's own negative-control runs demonstrate this). Decide on a gating mechanism: either make the module skip when the image is not an EFA image (e.g. a module-level skipif on the EFA SDK root / an opt-in env var set only in the *-efa jobs), or add 'and not efa_image' to the framework-agnostic marker selectors in pr.yaml and nightly-ci.yml. Note that a skipif on the SDK root weakens the negative-control value, so an explicit env opt-in set by the -efa CI jobs may be preferable.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +53 to +59
def _run(cmd: list[str]) -> str:
"""Run a command and return stdout+stderr, failing the test on OSError."""
try:
proc = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
except OSError as exc:
pytest.fail(f"could not execute {' '.join(cmd)}: {exc}")
return proc.stdout + proc.stderr

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 New tests that shell out to external commands lack the required per-test timeout marker

The new checks run external programs (subprocess.run at tests/container/test_efa_image.py:56) without the timeout marker the repository requires for any test containing subprocess waits, so a stuck invocation is not bounded at the test level.
Impact: A hung external command can leave CI waiting far longer than intended instead of failing the test promptly.

Rule reference

.ai/pytest-guidelines.md ("Timeouts") states: "Always flag any test that runs over 30 seconds or contains time.sleep(), polling loops, network calls, or subprocess waits but lacks a @pytest.mark.timeout(...) marker. This is a required change, not a style suggestion." test_efa_provider_compiled_in and test_libfabric_plugin_links_efa_sdk both call _run, which performs a subprocess wait. Adding pytest.mark.timeout(...) to the module-level pytestmark list satisfies the rule.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread pyproject.toml
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"wheel_smoke: marks tests that validate wheels copied from runtime images",
"efa_image: marks tests that validate EFA packaging inside an -efa runtime image (no GPU or EFA device required)",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 New test marker is registered in only one of the two required places

The new marker is declared only in the project configuration (pyproject.toml:288) and not additionally in the test suite's configuration hook, which the repository's test guidelines require for every marker.
Impact: Under an unusual configuration load order strict-marker checking can reject the marker and fail collection.

Rule reference

.ai/pytest-guidelines.md ("Markers"): "--strict-markers and --strict-config are enforced. Using an undefined marker fails collection. Register all markers in both pyproject.toml and tests/conftest.py:pytest_configure." tests/conftest.py:228-237 dual-registers markers via config.addinivalue_line("markers", ...); efa_image was not added there.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread .github/workflows/post-merge-ci.yml Outdated
run_cpu_only_tests: true
# efa_image adds the EFA packaging checks (tests/container/test_efa_image.py),
# which are what makes this job differ from the non-EFA sglang-test.
cpu_only_test_markers: '(pre_merge or post_merge) and (sglang or efa_image) and gpu_0'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new SGLang EFA job selects efa_image, but the rendered SGLang CUDA runtime/EFA image does not export NIXL_PLUGIN_DIR/NIXL_LIB_DIR in its final stage, so the new NIXL packaging assertions fail in this job. Fix: enable efa_image for SGLang only after the SGLang EFA runtime image provides the expected NIXL lib/plugin layout.

🤖 AI Fix

In .github/workflows/post-merge-ci.yml, change sglang-efa-test cpu_only_test_markers from '(pre_merge or post_merge) and (sglang or efa_image) and gpu_0' to '(pre_merge or post_merge) and sglang and gpu_0' until container/templates/sglang_runtime.Dockerfile or container/templates/aws.Dockerfile exports a valid NIXL_LIB_DIR, NIXL_PLUGIN_DIR, libnixl.so, and libplugin_LIBFABRIC.so layout for framework == "sglang" EFA runtime images.

@datadog-official

This comment has been minimized.

EFA changes are sparse, so verifying the -efa images on every commit to main
spends far more CI than the risk warrants. Run the checks once a night instead,
in the pipeline that already builds all three -efa images.

- revert post-merge-ci.yml: leave vllm-efa-test and trtllm-efa-test exactly as
  they were, and drop the sglang-efa-test job added there
- add vllm/sglang/trtllm -efa-test jobs to nightly-ci.yml, each running only
  'efa_image and gpu_0' against its nightly -efa image on amd64 and arm64
- retag the tests nightly instead of pre_merge/post_merge

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Jie Hao <[email protected]>
@jh-nv jh-nv changed the title test(efa): add EFA packaging checks to the -efa runtime test jobs test(efa): add EFA packaging checks to the nightly -efa image jobs Aug 10, 2026
@jh-nv

jh-nv commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2248f69

@jh-nv

jh-nv commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of the end-to-end test in #12915.

The static checks here would not have caught d4bfe441ae, the regression they were written for. test_libfabric_plugin_links_efa_sdk verifies ldd resolution, and that turns out to be near-tautological on any EFA image: the SGLang image's LIBFABRIC plugin comes from a PyPI wheel that was certainly never built against /opt/amazon/efa, yet ldd still resolves it there, because the EFA installer runs ldconfig and makes that SONAME the system-wide answer for every consumer.

What remains is the layout assertions, and those are brittle by nature. SGLang demonstrated it twice: NIXL lives at a mesonpy wheel path rather than /opt/nvidia/nvda_nixl, and that changed between the 1.3.1 release and current main. The image built from main fails 2 of 6 checks (no NIXL_PLUGIN_DIR at all), so sglang-efa-test would have been red every night.

#12915 asserts the outcome instead — KV bytes moved, libfabric memory registration happened, no UCX fallback — which is invariant to where the files live. The diagnostic value is carried over there as logging rather than assertions.

Thanks to the reviewers; every one of the findings held up under checking.

Filed separately: EFA release staging is not gated on any test result, and build-time libfabric provenance (-Dlibfabric_path is still /usr/local/libfabric on main).

@jh-nv jh-nv closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant