Skip to content

Build with abseil 20250814 (NVCC) - #28586

Merged
tianleiwu merged 1 commit into
microsoft:mainfrom
mc-nv:mchornyi/TRI-704/onnx
Jun 22, 2026
Merged

Build with abseil 20250814 (NVCC)#28586
tianleiwu merged 1 commit into
microsoft:mainfrom
mc-nv:mchornyi/TRI-704/onnx

Conversation

@mc-nv

@mc-nv mc-nv commented May 20, 2026

Copy link
Copy Markdown
Contributor

Description

Narrow, Abseil-only build fix. NVCC's cudafe++ (EDG front-end) fails to parse the
IfRRef<...>::AddPtr<...> qualified-ids used by the lifetime-bound insert_or_assign /
try_emplace overload sets in abseil 20250814 (raw_hash_map.h, btree_container.h) when they
appear inside heavily macro-expanded template parameter lists. Plain g++ accepts the same code.

This adds a top-level IfRRefAddPtr<T, Other> alias and routes the affected use-sites through it so
the member-template lookup happens outside the surrounding dependent template-id. Because it stays an
alias template, substitution remains in the immediate context, so forming a pointer-to-reference is
still a soft (SFINAE) failure rather than a hard error — original behavior is preserved.

Applied as a cmake patch under cmake/patches/abseil/absl_cuda_warnings.patch, so it is picked up by
both the FetchContent and vcpkg Abseil paths.

Scope

This is intentionally an Abseil-only fix. It does not address the CUDA 13.3 CCCL/CUB
(::cuda::proclaims_copyable_arguments) parse error — that is handled by #29042. This PR is not a
complete CUDA 13.3 build fix on its own.

Motivation and Context

Needed to build ONNX Runtime against the abseil version pulled in by recent CUDA toolchain updates.
Plain g++ compiles fine; only NVCC needs this workaround.

@mc-nv

mc-nv commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

cc: @chilo-ms , @tianleiwu

Copilot AI 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.

Pull request overview

This PR updates ONNX Runtime’s build compatibility with newer NVIDIA toolchains by (1) gating/adjusting TensorRT EP code paths that were removed or changed in TensorRT 11, and (2) extending the existing Abseil CUDA/NVCC patch to work around a cudafe++ parsing issue introduced with Abseil 20250814.

Changes:

  • TensorRT EP: Guard removed TensorRT APIs behind NV_TENSORRT_MAJOR < 11 and remove dead execution-context construction paths (TRT 11 makes IExecutionContext abstract).
  • Abseil patch: Add IfRRefAddPtr alias and route a small set of IfRRef<...>::AddPtr<...> uses through it to avoid NVCC EDG frontend parse failures.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc Gates TensorRT APIs removed in TRT 11; tightens execution-context handling to avoid constructing abstract TRT types.
cmake/patches/abseil/absl_cuda_warnings.patch Adds an Abseil internal alias and updates a handful of template-argument sites to compile under NVCC.
Comments suppressed due to low confidence (1)

onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc:4002

  • The MSVC #pragma warning(push) scope here is only popped in the NV_TENSORRT_MAJOR < 11 branch, so TensorRT 11+ builds will keep warning 4996 disabled until some later (unrelated) pop. This is especially problematic because another warning scope is pushed later in the same function. Please ensure the warning scope opened here is popped unconditionally after the INT8 dynamic-range block (regardless of TensorRT major) before any subsequent #pragma warning(push).
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
      // Set INT8 Per Tensor Dynamic range
#if NV_TENSORRT_MAJOR < 11

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc Outdated
@tianleiwu

Copy link
Copy Markdown
Contributor

@mc-nv, please run lintrunner -a to format the files.

@mc-nv

mc-nv commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

This PR interfere with #28611

@mc-nv
mc-nv marked this pull request as draft May 21, 2026 17:21
@chilo-ms

Copy link
Copy Markdown
Contributor

This PR interfere with #28611

Once that PR is merged, you can still add the abseil workaround here.

NVCC's EDG-based frontend (cudafe++) fails to parse the new
`IfRRef<int KQual>::AddPtr<K>` constructs used by the lifetime-bound
`insert_or_assign` overload sets in `raw_hash_map.h` and
`btree_container.h` when they appear inside heavily macro-expanded
template parameter lists. Plain g++ accepts the same code.

Add a top-level `IfRRefAddPtr<T, Other>` alias in `common.h` and route
the six affected use-sites through it so the member-template lookup
happens outside the surrounding dependent template-id.
@mc-nv
mc-nv force-pushed the mchornyi/TRI-704/onnx branch from 34cabc4 to 29d22e4 Compare May 22, 2026 17:44
@mc-nv mc-nv changed the title Build with TensorRT 11 and abseil 20250814 (NVCC) Build with abseil 20250814 (NVCC) May 22, 2026
@mc-nv
mc-nv marked this pull request as ready for review June 12, 2026 17:28

@tianleiwu tianleiwu 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.

Thanks for the focused Abseil workaround. I compared this with #29042 since both touch the same CUDA/NVCC build area. This PR fixes the Abseil IfRRef<...>::AddPtr<...> parser issue, and because it extends the existing absl_cuda_warnings.patch, it should be picked up by both the FetchContent and vcpkg Abseil paths.

If the intended goal is to unblock Linux CUDA 13.3, though, this PR looks incomplete by itself. #29042 carries the same Abseil member-template workaround and also handles the CUDA 13.3 CCCL/CUB parse error around ::cuda::proclaims_copyable_arguments in toolkit headers. My recommendation would be to move forward with #29042 once it is out of draft, or cherry-pick its CCCL workaround here, rather than merging this as the full CUDA 13.3 build fix.

If this remains a narrow Abseil-only fix, please make that scope explicit in the PR title/description and refresh the currently failed/cancelled WebGPU checks before merge.

@mc-nv

mc-nv commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the cross-check against #29042.

This PR is intentionally the narrow Abseil-only fix for the IfRRef<...>::AddPtr<...> cudafe++ parser issue, and I've now made that scope explicit in the title/description — it is not a complete CUDA 13.3 build fix. The CUDA 13.3 CCCL/CUB ::cuda::proclaims_copyable_arguments workaround is intentionally left to #29042; agreed that #29042 (now out of draft) is the right vehicle for the full CUDA 13.3 unblock.

On the WebGPU checks: the latest CI run is fully green, including Build Linux WebGPU x64 Release — there's nothing currently failed/cancelled to refresh.

@tianleiwu
tianleiwu enabled auto-merge (squash) June 22, 2026 16:35
@tianleiwu
tianleiwu merged commit 5b36110 into microsoft:main Jun 22, 2026
90 of 94 checks passed
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.

4 participants