Skip to content

Conversation

@Yu-Zhewen
Copy link
Contributor

@Yu-Zhewen Yu-Zhewen commented Jan 2, 2026

The GCC CI workflow was failing to build stablehlo due to a C++ template instantiation issue with GCC 9.

StablehloAggressiveFolder.cpp uses modern C++ patterns combining if constexpr with SFINAE-based type traits:

if constexpr (fold_unary::DirectFolderExists<Impl, APInt>::value) {
    return FoldIfImplemented<APInt>(operand); 
}

GCC 9 incorrectly evaluates these type traits eagerly before the if constexpr condition is resolved, causing "incomplete type" errors:

/__w/iree/iree/third_party/stablehlo/stablehlo/transforms/optimization/StablehloAggressiveFolder.cpp:501:48: error: no matching function for call to 'FoldIfImplemented<llvm::APInt>(llvm::APInt&)'

/__w/iree/iree/third_party/stablehlo/stablehlo/transforms/optimization/StablehloAggressiveFolder.cpp:464:78: error: incomplete type 'fold_unary::DirectFolderExists<Impl, llvm::APInt>' used in nested name specifier

Upgrade to GCC 11 resolves this problem.

Before: https://github.com/iree-org/iree/actions/runs/20654878139/job/59305852621

After: https://github.com/iree-org/iree/actions/runs/20660113060/job/59320617905?pr=23008

Signed-off-by: Yu-Zhewen <[email protected]>
@Yu-Zhewen Yu-Zhewen changed the title [Draft][CI] Upgrade to GCC 11 to fix stablehlo template instantiation error [CI] Upgrade to GCC 11 to fix stablehlo template instantiation error Jan 2, 2026
@Yu-Zhewen Yu-Zhewen marked this pull request as ready for review January 2, 2026 18:31
@Yu-Zhewen Yu-Zhewen requested review from jtuyls and kuhar January 2, 2026 18:31
Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

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

Version bump sgtm, gcc11 came out almost 5 years ago.

Is there any documentation we maintain about supported tool chains that also needs updating?

@Yu-Zhewen
Copy link
Contributor Author

I found two places referencing GCC versions:

  1. docs/website/docs/developers/debugging/releases.md mentions gcc 9.3.1 for manylinux, but I believe releases are actually using clang-17 now (see this recent run). This doc appears to be outdated.

  2. cpubuilder_ubuntu_jammy.Dockerfile, the Docker image used by this GCC CI installs gcc-9. We could update it to gcc-11, or simply remove it since Ubuntu Jammy provides gcc-11 by default.

I can address these in separate PRs.

@kuhar
Copy link
Member

kuhar commented Jan 5, 2026

I think all of these should be updated together to keep a consistent state on gcc

Signed-off-by: Yu-Zhewen <[email protected]>
@Yu-Zhewen
Copy link
Contributor Author

I've updated the documentation in this PR and created iree-org/base-docker-images#39 for the Docker image change (separate repo). Once that PR is merged, I'll update the container SHA here to reference the new image.

Yu-Zhewen added a commit to iree-org/base-docker-images that referenced this pull request Jan 5, 2026
Signed-off-by: Yu-Zhewen <[email protected]>
@Yu-Zhewen Yu-Zhewen merged commit 9c5e311 into iree-org:main Jan 5, 2026
47 of 50 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.

2 participants