Skip to content

Name the raw_hash base classes explicitly so nvcc 13.4 can compile the hash containers on Windows - #118

Merged
h-vetinari merged 2 commits into
conda-forge:mainfrom
hmaarrfk:nvcc-raw-hash-base
Oct 7, 2026
Merged

h-vetinari merged 2 commits into
conda-forge:mainfrom
hmaarrfk:nvcc-raw-hash-base

Conversation

@hmaarrfk

@hmaarrfk hmaarrfk commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Seems like there are other small patches necessary

claude

Draft. Follow-up to #117, which turned out to be only half of the fix.

What still fails

#117 fixed the friend class X::HashStateBase; declarations. With exactly those two lines applied, CUDA translation units on Windows that include an abseil hash container still fail under nvcc 13.4 + MSVC, now on the containers' base-class alias:

using Base = typename flat_hash_map::raw_hash_map;   // flat_hash_map.h(141) in 20260526.0
%BUILD_PREFIX%\Library\include\absl/container/flat_hash_map.h(141): error C2248: 'absl::lts_20260526::container_internal::raw_hash_map<T>::Hash': cannot access private typedef declared in class 'absl::lts_20260526::container_internal::raw_hash_map<T>'
%BUILD_PREFIX%\Library\include\absl/container/flat_hash_map.h(141): error C2248: 'absl::lts_20260526::container_internal::raw_hash_map<T>::Eq': cannot access private typedef declared in class 'absl::lts_20260526::container_internal::raw_hash_map<T>'

48 C2248 errors in total, none of the earlier C3856.

Evidence (all from conda-forge/onnxruntime-feedstock#183, win_64_cuda_compiler_version13.4python3.12)

abseil headers result log
unpatched libabseil 20260526.0 cxx17_h04e5de1_2 C3856 in hash.h and C2248 in flat_hash_map.h https://github.com/conda-forge/onnxruntime-feedstock/actions/runs/35283211131/job/105409635861
+ the two lines from #117 C2248 only https://github.com/conda-forge/onnxruntime-feedstock/actions/runs/37306309009/job/111750712123
+ this patch as well builds and passes tests https://github.com/conda-forge/onnxruntime-feedstock/actions/runs/37400676794/job/112067246126

Toolchain in all three: cuda-nvcc 13.4.92, vs2022_win-64 19.44.35207, C++20, abseil consumed as an installed package with ABSL_CONSUME_DLL. In those runs the patches are applied to the installed headers by the onnxruntime recipe, since it is pinned to 20260526.

Change

Patch 0005 spells the base type out in flat_hash_map, flat_hash_set, node_hash_map and node_hash_set, and renames their Hash/Eq template parameters to AbslHashT/AbslEqT:

-    class Hash =
+    class AbslHashT =
         typename container_internal::FlatHashMapPolicy<K, V>::DefaultHash,
-    class Eq = typename container_internal::FlatHashMapPolicy<K, V>::DefaultEq,
+    class AbslEqT =
+        typename container_internal::FlatHashMapPolicy<K, V>::DefaultEq,
 ...
-          absl::container_internal::FlatHashMapPolicy<K, V>, Hash, Eq,
+          absl::container_internal::FlatHashMapPolicy<K, V>, AbslHashT, AbslEqT,
           Allocator>::type {
-  using Base = typename flat_hash_map::raw_hash_map;
+  using Base = typename absl::container_internal::InstantiateRawHashMap<
+      absl::container_internal::FlatHashMapPolicy<K, V>, AbslHashT, AbslEqT,
+      Allocator>::type;

The rename is needed because raw_hash_map/raw_hash_set declare private typedefs named Hash, Eq and Alloc, which under MSVC hide template parameters of the same name inside the derived class body; without it the spelled-out base hits the same C2248. For the same reason node_hash_map and node_hash_set also get their Alloc parameter renamed to AbslAllocT (the flat containers call theirs Allocator, which does not collide).

Update: the first push of this PR missed the Alloc rename, which broke abseil's own win_64 and win_arm64 builds with node_hash_map.h(139): error C2248: 'raw_hash_map<T>::Alloc'. onnxruntime never instantiates the node containers, so its CI did not catch it. Fixed in 6e20276. The parameters are not used anywhere else in those class bodies. Header-only, no behaviour or ABI change (template parameter names are not mangled).

Build number bumped to 2.

Open points

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number
  • Re-rendered (not needed: only the patch list and build number changed)

https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6

<details><summary>Claude's draft</summary>

Follow-up to conda-forge#117. With only the two friend-declaration lines from
patch 0004 applied, CUDA translation units on Windows that include an
abseil hash container still fail under nvcc 13.4 + MSVC:

    absl/container/flat_hash_map.h(141): error C2248:
      'raw_hash_map<T>::Hash': cannot access private typedef declared
      in class 'raw_hash_map<T>'

https://github.com/conda-forge/onnxruntime-feedstock/actions/runs/37306309009/job/111750712123

Add patch 0005, which spells out the InstantiateRawHashMap /
InstantiateRawHashSet base type in flat_hash_map, flat_hash_set,
node_hash_map and node_hash_set instead of going through the
injected-class-name, and renames their Hash/Eq template parameters so
the base's private typedefs of the same names no longer hide them.
Header-only; no behaviour or ABI change.

Bump the build number to 2.

onnxruntime-feedstock applies the same two changes to the installed
20260526.0 headers and its win-64 CUDA 13.4 builds pass with them.
This patch was regenerated against the 20260817.0 source, where it
applies after 0004; it was not built locally.

Resume this Claude session:
```
cd /home/mark/git/feedstock/onnxruntime-feedstock
claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054
```
</details>

Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
@conda-forge-admin

conda-forge-admin commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe/meta.yaml) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe/meta.yaml:

  • ℹ️ The recipe is not parsable by parser conda-souschef (grayskull). This parser is not currently used by conda-forge, but may be in the future. We are collecting information to see which recipes are compatible with grayskull.
  • ℹ️ The recipe is not parsable by parser conda-recipe-manager. The recipe can only be automatically migrated to the new v1 format if it is parseable by conda-recipe-manager.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/37558789847. Examine the logs at this URL for more detail.

@h-vetinari

Copy link
Copy Markdown
Member

CI is failing here

<details><summary>Claude's draft</summary>

The first version of patch 0005 broke abseil's own Windows build:

    absl/container/node_hash_map.h(139): error C2248:
      'raw_hash_map<T>::Alloc': cannot access private typedef declared
      in class 'raw_hash_map<T>'

raw_hash_map and raw_hash_set declare three private typedefs, Hash, Eq
and Alloc. The patch renamed the containers' Hash and Eq template
parameters but not Alloc, which node_hash_map and node_hash_set use for
their allocator parameter (flat_hash_map and flat_hash_set call it
Allocator, so they were fine). MSVC looks unqualified names up in
dependent bases, so the spelled-out base type picked up the private
typedef instead of the template parameter. gcc and clang do not, which
is why only win_64 and win_arm64 failed.

Rename Alloc to AbslAllocT in both node containers and say so in the
patch header. Checked that the patch applies after 0004 and that all
four containers still parse and instantiate with g++; MSVC is only
exercised by CI.

Resume this Claude session:
```
cd /home/mark/git/feedstock/onnxruntime-feedstock
claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054
```
</details>

Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
@hmaarrfk

hmaarrfk commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

thanks for the ping, hopefully it is fixed, i still need to review this, i kinda just skimmed it.

@hmaarrfk
hmaarrfk marked this pull request as ready for review October 7, 2026 03:40
@h-vetinari
h-vetinari merged commit 20d71c7 into conda-forge:main Oct 7, 2026
11 checks passed
@hmaarrfk

hmaarrfk commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

@h-vetinari

Copy link
Copy Markdown
Member

I dislike distilling proper commit messages from claude's very verbose "drafts". In future PRs (this goes for all feedstocks I maintain, and I recommend it in general), please provide either:

  • a clean git history with commit messages that have either been written, or at least heavily cleaned up, by a human
  • the intended overall commit message (likewise human-distilled) prominently in the OP, updated to account for all changes, in case the commit history (likely) requires squashing1

Footnotes

  1. e.g. like here due to fixing up the patch a second time ↩

@hmaarrfk

hmaarrfk commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Thank you this is fair critcism, i'll work on that.

I think nobody likes to read somebody else's AI output.

@hmaarrfk

hmaarrfk commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

I can't really promise to do that in "draft" mode, but once I mark things as "not draft" i'll give a once over to the commit history.

hmaarrfk added a commit to hmaarrfk/abseil-cpp-feedstock that referenced this pull request Oct 10, 2026
…ed branch that targets the current global pin of abseil for conda-forge as of Oct 10, 2026.

<details><summary>Claude's draft</summary>

Backport of conda-forge#117 and conda-forge#118 from main (20260817.0) to the 20260526.x
branch, because 20260526 is still the conda-forge global pin and the
protobuf/grpc/re2 stack is built against it. Consumers that compile
CUDA code on Windows against the pinned abseil, such as
onnxruntime-feedstock, do not get the fix from 20260817.0.

- 0004 names HashStateBase directly in the two friend declarations in
  absl/hash (fixes error C3856 under nvcc 13.4 + MSVC).
- 0005 spells out the raw_hash_map / raw_hash_set base type in the four
  hash containers and renames their Hash, Eq and (node containers)
  Alloc template parameters (fixes error C2248).

Both patches are the ones on main, regenerated against the 20260526.0
source so they apply without offsets. Header-only; no behaviour or ABI
change. Build number 2 -> 3.

Verified: both apply after 0001-0003 with git apply and patch; the
patched headers are byte-identical to the ones onnxruntime-feedstock's
win-64 CUDA 13.4 CI passes with, plus the Alloc rename that main's own
Windows CI validated in conda-forge#118; the four containers parse and instantiate
with g++. Not built locally.

Not re-rendered: only the patch list and build number change, and the
existing 20211102.x maintenance branch also leaves conda-forge.yml
pointing at main.

Resume this Claude session:
```
cd /home/mark/git/feedstock/onnxruntime-feedstock
claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054
```
</details>

Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
hmaarrfk added a commit to hmaarrfk/abseil-cpp-feedstock that referenced this pull request Oct 10, 2026
…ed branch that targets the current global pin of abseil for conda-forge as of Oct 10, 2026.

<details><summary>Claude's draft</summary>

Backport of conda-forge#117 and conda-forge#118 from main (20260817.0) to the 20260526.x
branch, because 20260526 is still the conda-forge global pin and the
protobuf/grpc/re2 stack is built against it. Consumers that compile
CUDA code on Windows against the pinned abseil, such as
onnxruntime-feedstock, do not get the fix from 20260817.0.

- 0004 names HashStateBase directly in the two friend declarations in
  absl/hash (fixes error C3856 under nvcc 13.4 + MSVC).
- 0005 spells out the raw_hash_map / raw_hash_set base type in the four
  hash containers and renames their Hash, Eq and (node containers)
  Alloc template parameters (fixes error C2248).

Both patches are the ones on main, regenerated against the 20260526.0
source so they apply without offsets. Header-only; no behaviour or ABI
change. Build number 2 -> 3.

Verified: both apply after 0001-0003 with git apply and patch; the
patched headers are byte-identical to the ones onnxruntime-feedstock's
win-64 CUDA 13.4 CI passes with, plus the Alloc rename that main's own
Windows CI validated in conda-forge#118; the four containers parse and instantiate
with g++. Not built locally.

Not re-rendered: only the patch list and build number change, and the
existing 20211102.x maintenance branch also leaves conda-forge.yml
pointing at main.

Resume this Claude session:
```
cd /home/mark/git/feedstock/onnxruntime-feedstock
claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054
```
</details>

Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
hmaarrfk added a commit to hmaarrfk/onnxruntime-feedstock that referenced this pull request Oct 11, 2026
<details><summary>Claude's draft</summary>

Keep libabseil-0005 in step with the corrected patch proposed in
conda-forge/abseil-cpp-feedstock#118.

raw_hash_map and raw_hash_set have a private Alloc typedef as well as
Hash and Eq. node_hash_map and node_hash_set name their allocator
template parameter Alloc, so under MSVC the spelled-out base type
picked up the private typedef and failed with C2248 as soon as either
container was instantiated; abseil's own Windows build hit that in
conda-forge#118. onnxruntime never instantiates the node containers, which is why
the win-64 CUDA 13.4 builds here passed with the incomplete patch.

Rename Alloc to AbslAllocT in both, and point the patch header at conda-forge#118.
0004 plus this patch still apply cleanly to the libabseil 20260526.0
headers.

Resume this Claude session:
```
cd /home/mark/git/feedstock/onnxruntime-feedstock
claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054
```
</details>

Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
hmaarrfk added a commit to hmaarrfk/onnxruntime-feedstock that referenced this pull request Oct 11, 2026
<details><summary>Claude's draft</summary>

Keep libabseil-0005 in step with the corrected patch proposed in
conda-forge/abseil-cpp-feedstock#118.

raw_hash_map and raw_hash_set have a private Alloc typedef as well as
Hash and Eq. node_hash_map and node_hash_set name their allocator
template parameter Alloc, so under MSVC the spelled-out base type
picked up the private typedef and failed with C2248 as soon as either
container was instantiated; abseil's own Windows build hit that in
conda-forge#118. onnxruntime never instantiates the node containers, which is why
the win-64 CUDA 13.4 builds here passed with the incomplete patch.

Rename Alloc to AbslAllocT in both, and point the patch header at conda-forge#118.
0004 plus this patch still apply cleanly to the libabseil 20260526.0
headers.

Resume this Claude session:
```
cd /home/mark/git/feedstock/onnxruntime-feedstock
claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054
```
</details>

Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
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.

3 participants