Skip to content

comm: multicast-free (IPC) workspace for TRT-LLM AR fusion under Confidential Computing - #3993

Merged
Anerudhan merged 1 commit into
flashinfer-ai:mainfrom
elvischenv:cc-trtllm-ar-fixed-rebased
Jul 24, 2026
Merged

comm: multicast-free (IPC) workspace for TRT-LLM AR fusion under Confidential Computing#3993
Anerudhan merged 1 commit into
flashinfer-ai:mainfrom
elvischenv:cc-trtllm-ar-fixed-rebased

Conversation

@elvischenv

@elvischenv elvischenv commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

Under NVIDIA Confidential Computing (CC), the symmetric-memory allocator's cuMulticast setup fails (the bounce-buffer path can't complete the fabric/multicast rendezvous), so the TRT-LLM AllReduce-fusion workspace can't be created the usual way.

What this changes

create_allreduce_fusion_workspace / TRTLLMAllReduceFusionWorkspace now allocate a multicast-free IPC workspace instead of symmetric device memory whenever CC is detected — auto-detected via is_confidential_compute() (overridable with FLASHINFER_CONFIDENTIAL_COMPUTE).

  • The trtllm one-shot Lamport and two-shot sync fusion kernels are both multicast-free (0 multimem in trtllm_allreduce_fusion.cuh), and the IPC workspace is sized identically to the symmetric one, so both strategies run on it — only the allocator differs.
  • The shorter (ipc_handles, workspace_tensor, metadata) return tuple is handled, and mem_handles is set to [] so the "handles attached?" guard in allreduce_fusion and destroy() iterate a no-op.
  • The mnnvl backend requires NVLink multicast (unavailable under CC), so create_allreduce_fusion_workspace raises there rather than failing deep inside workspace creation.

Tests

tests/comm/test_allreduce_unified_api.py:

  • test_allreduce_trtllm_multicast_free — forces CC via FLASHINFER_CONFIDENTIAL_COMPUTE=1, exercising both kernels (use_oneshot True/False), both AR patterns, and fp16/bf16.
  • test_mnnvl_raises_under_cc — asserts the mnnvl+CC guard.

Verified 17/17 on 2×B200.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 235973fb-d81f-434b-843e-5febef05eb27

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces support for NVIDIA Confidential Computing (CC) in FlashInfer. Key changes include auto-detection of CC via NVML, a CC-safe autotuner timing path using the GPU %globaltimer register (since cudaEventElapsedTime is unreliable under CC), and multicast-free TRT-LLM AllReduce fusion workspace allocation (disabling symmetric device memory and NVLink multicast-based mnnvl backend under CC). The review feedback points out a potential ZeroDivisionError in test_mnnvl_raises_under_cc if CUDA is not available or device_count() is 0, and suggests adding a guard to skip the test in such environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tests/comm/test_allreduce_unified_api.py
…idential Computing(CC)

create_allreduce_fusion_workspace / TRTLLMAllReduceFusionWorkspace allocate a
multicast-free IPC workspace instead of symmetric device memory whenever NVIDIA
Confidential Computing is detected (is_confidential_compute(), overridable via
FLASHINFER_CONFIDENTIAL_COMPUTE) -- the symmetric-memory setup does a
cuMulticast probe that fails under CC.

The trtllm one-shot Lamport and two-shot sync fusion kernels are both
multicast-free (0 multimem in trtllm_allreduce_fusion.cuh) and the IPC
workspace is sized identically to symm, so both strategies run on it -- only
the workspace allocator differs.

The mnnvl backend requires NVLink multicast, which is unavailable under CC, so
create_allreduce_fusion_workspace raises there rather than failing deep inside
workspace creation.

Adds tests/comm test_allreduce_trtllm_multicast_free (forcing CC via
FLASHINFER_CONFIDENTIAL_COMPUTE=1, both kernels via use_oneshot True/False,
both AR patterns, fp16/bf16) and test_mnnvl_raises_under_cc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@elvischenv
elvischenv force-pushed the cc-trtllm-ar-fixed-rebased branch from 724f6a8 to a4a17a2 Compare July 16, 2026 23:41
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@elvischenv
elvischenv marked this pull request as ready for review July 16, 2026 23:44
@leejnau

leejnau commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

/bot run tests/comm

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

GitLab MR !986 has been created, and the CI pipeline #58370904 is currently running. I'll report back once the pipeline job completes.

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

[FAILED] Pipeline #58370904: 13/20 passed

@leejnau leejnau added the run-ci label Jul 17, 2026
@nvpohanh

Copy link
Copy Markdown
Contributor

@leejnau could you help us to put this PR into P0 priority list? This is for CC. Thanks!

@nvpohanh

Copy link
Copy Markdown
Contributor

@elvischenv please rebase and fix ci failure. thanks!

@Anerudhan Anerudhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The change lgtm

@Anerudhan
Anerudhan merged commit cea7f46 into flashinfer-ai:main Jul 24, 2026
55 of 59 checks passed
@elvischenv
elvischenv deleted the cc-trtllm-ar-fixed-rebased branch July 29, 2026 06:21
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.

6 participants