Skip to content

[BUG] Ambiguous union_member::get overloads with GCC 16 break ORC/Parquet writer builds #24233

Description

@karthikeyann

Describe the bug

With GCC 16 as the host compiler, the constrained overloads of union_member::get in cpp/src/io/statistics/typed_statistics_chunk.cuh become ambiguous, and libcudf fails to build.

The overload set (starting at typed_statistics_chunk.cuh:35) is:

template <typename T, typename U>
__device__ static type<T, U> get(U& val)
  requires(std::is_integral_v<T> and std::is_unsigned_v<T>)   // line 56

template <typename T, typename U>
__device__ static type<T, U> get(U& val)
  requires(std::is_integral_v<T> and std::is_signed_v<T>)     // line 63

template <typename T, typename U>
__device__ static type<T, U> get(U& val)
  requires(std::is_same_v<T, __int128_t>)                     // line 70

Under GCC 16 the line 56 and line 63 overloads both become viable for the same T, so the call is ambiguous:

typed_statistics_chunk.cuh(268): error: more than one instance of overloaded function
  "cudf::io::union_member::get" matches the argument list:
    function template "cudf::io::union_member::type<T, U> cudf::io::union_member::get<T,U>(U &)" (declared at line 56)
    function template "cudf::io::union_member::type<T, U> cudf::io::union_member::get<T,U>(U &)" (declared at line 63)
    argument types are: (cudf::io::statistics_val)
      union_member::get<E>(stat.min_value) = chunk.minimum_value;
      ^
typed_statistics_chunk.cuh(84): note #3473-D: substituting
  "<__int128_t, cudf::io::statistics_val>" for function template
  "cudf::io::union_member::get<T,U>(U &)" failed constraints

It reproduces on the fixed-point statistics path, with T=numeric::decimal32 and T=numeric::decimal64:

instantiation of "cudf::io::statistics_chunk cudf::io::get_untyped_chunk(
  const cudf::io::typed_statistics_chunk<T, include_aggregate> &)
  [with T=numeric::decimal32, include_aggregate=true]"
  at line 123 of cpp/src/io/statistics/column_statistics.cuh
instantiation of "void cudf::io::calculate_group_statistics_functor<...>::operator()<T>(...)
  [with block_size=256, IO=cudf::io::detail::io_file_format::ORC, ..., T=numeric::decimal32]"
  at line 318 of cpp/src/io/statistics/column_statistics.cuh

Affected lines in typed_statistics_chunk.cuh are 139-142, 180-181 and 263-269.

Steps/Code to reproduce bug

Build libcudf with GCC 16 as host compiler and CUDA 13.4:

nvcc -ccbin=/opt/rh/gcc-toolset-16/root/usr/bin/g++ -std=c++20 ...

These two objects fail to build (both are required for libcudf.so):

src/io/orc/writer_impl.cu.o
src/io/parquet/writer_impl.cu.o

Expected behavior

The requires constraints remain mutually exclusive, and union_member::get resolves unambiguously for the decimal types.

Isolation: this is the host compiler, not nvcc

The diagnostic is emitted by the device frontend, so it reads like an nvcc problem, but it is driven by the host compiler's <type_traits>. I recompiled the identical failing TU changing only -ccbin, with CUDA 13.4 held constant:

Host compiler CUDA more than one instance errors
gcc-toolset-16 (16.2.1) 13.4 14
gcc-toolset-14 (14.2.1) 13.4 0

So GCC 16's libstdc++ changes the relevant type-trait results such that the two constraints are no longer mutually exclusive for these types.

I did not attempt a fix, since disambiguating this dispatch correctly depends on the intended semantics for the fixed-point/decimal statistics path, and guessing risks silently wrong statistics.

Environment details

  • cuDF: commit 456580fcdd726380dcb3de6b9686e7d47d6dd0a2 (release/26.10)
  • Compiler: GCC 16.2.1 20260807 (Red Hat 16.2.1-1, gcc-toolset-16)
  • CUDA: 13.4 (nvcc V13.4.92)
  • CCCL: 3.5.0
  • OS: CentOS Stream 9
  • Standard: -std=gnu++20
  • Consumer: Velox (VELOX_ENABLE_CUDF=ON), which builds libcudf from source via CPM

Note: GCC 16 requires CUDA >= 13, since CUDA 12.x nvcc hard-rejects GCC > 14.

Additional context

Found while evaluating GCC 16 support for Velox's cuDF backend. This is currently the blocking issue for that configuration: with it unresolved, libcudf.so cannot be produced and the cuDF test suite cannot run.

A separate, unrelated GCC 16 issue in cuDF (missing #include <variant> in cudf/ast/expressions.hpp) is filed separately. Two further GCC 16 issues live in other repos: rtcx (missing <variant> in include/rtcx/embed.hpp) and cuco (includes the deprecated <cuda/stream_ref>, which CCCL 3.5 warns on and -Werror promotes to an error).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions