Skip to content

[GPU] Add cuCascade to contrib - #120803

Merged
scanhex12 merged 4 commits into
masterfrom
gpu-build-island
Sep 19, 2026
Merged

scanhex12 merged 4 commits into
masterfrom
gpu-build-island

Conversation

@scanhex12

@scanhex12 scanhex12 commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add cuCascade to contrib. Related #119502


Workflow [PR]
Sync PR [sync-upstream/pr/120803]

…bing

Splits the build-system half of #119502 out of it, so that the pull request
there is the aggregation code and its tests alone.

What is here:

- `cmake/cuda.cmake`: the include half of `ch_gpu::cudart`, which every consumer
  of `ch_contrib::rmm` needs; `gpu_island_executable`, for the build-time tools
  on the island; and the shared `libstdc++` the island's host code is compiled
  against.
- `cmake/linux/default_libs.cmake`: where that `libstdc++` is appended, and why
  the order matters for the Itanium ABI runtime.
- `cmake/ccache.cmake`: a compiler launcher for `.cu` as well.
- `contrib/cudf-cmake`, `contrib/nvcomp-cmake`, `contrib/CMakeLists.txt`: cuDF
  and nvcomp as `ch_contrib::` targets.
- `contrib/cucascade`, and the `cuCollections` bump it needs.
- `base/glibc-compatibility`: the `__isoc23_strto*` aliases and
  `__libc_single_threaded`, which the island needs because it compiles against
  the host's headers and links against the sysroot's glibc.
- `programs/main.cpp`, `programs/keeper/keeper_main.cpp`: the `dlopen` override
  lifted in a GPU build, because the CUDA runtime reaches a device no other way.
- `.gitignore`: nvcomp is unpacked into `contrib/nvcomp` rather than vendored.

`contrib/cucascade` was a gitlink with no `.gitmodules` entry, so
`git submodule update --init` could not fetch it. Added it here.

`ENABLE_GPU` stays `OFF`, so nothing in a default build changes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [da89a1b]

Summary: ❌

job_name test_name status info comment
Build profile diff ERROR

AI Review

Summary

This PR splits out the build-system half of the planned GPU engine by wiring in cuDF, cuCollections, cuCascade, KvikIO, nvcomp, and the CUDA island helper/toolchain changes. The default ENABLE_GPU=0 CI is green, but the ENABLE_GPU=1 path still has two blocker-level linkage/packaging bugs in the current code, so I would not merge it as-is.

PR Metadata
  • Changelog category looks correct for a build-only change.
  • Changelog entry is required for this category, but the current text is too narrow for what the PR actually changes and it leaks a raw Related URL into the published changelog.
  • Exact replacement: Add the build-system scaffolding and third-party dependencies needed for the experimental GPU engine, including cuDF, cuCollections, cuCascade, KvikIO, and nvcomp.
Findings

❌ Blockers

  • [cmake/linux/default_libs.cmake:64] Appending ${GPU_LIBSTDCXX_LIBRARY} to global DEFAULT_LIBS changes every Linux executable in an ENABLE_GPU=1 tree, not just targets that actually carry GPU-island code. That makes packaged binaries such as clickhouse and clickhouse-extract-from-config depend on the builder's shared libstdc++.so.6 even though the packaging config still ships only the executables, so the new GPU build stops being self-contained and becomes tied to the build host's runtime. Suggested fix: attach libstdc++ only on the real final targets that link GPU-island objects, or explicitly bundle/declare the matching runtime in packaging.
  • [contrib/cudf-cmake/CMakeLists.txt:965] _cudf is created as a plain add_library(...) target, so in this tree it is a static archive. The PRIVATE target_link_options call therefore does not reach the eventual executable or shared library that consumes _cudf, and the fatbin.ld script that keeps .nvFatBinSegment / .nv_fatbin together is lost before the real link. Suggested fix: export the script through INTERFACE_LINK_OPTIONS on _cudf, or attach it on the actual final target that links ch_contrib::cudf.
Tests
  • ⚠️ All current CI is green, but nothing in the report actually configures or builds with -DENABLE_GPU=1, so there is still no automated proof that the new CUDA island configures and links in the mode this PR adds. The smallest useful evidence would be one focused GPU-enabled configure/build job that exercises cmake/cuda.cmake, contrib/nvcomp-cmake, and the _cudf final link.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
  1. Stop injecting ${GPU_LIBSTDCXX_LIBRARY} into global default libraries; scope or package it with the actual GPU consumer.
  2. Make fatbin.ld reach the real final link that consumes ch_contrib::cudf.
  3. Add focused ENABLE_GPU=1 build coverage so this path is validated somewhere other than code review.

LLVM Coverage Report

⚠️ No coverage measurement for commit da89a1b: no coverage data for the changed C/C++ source files (they may be new or not instrumented).

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. labels Sep 18, 2026
@thevar1able thevar1able self-assigned this Sep 18, 2026
`programs/main.cpp` and `programs/keeper/keeper_main.cpp` read `USE_GPU`, which
`src/Common/config.h.in` defines - and that file is in
#119502, not here. Without it the
macro is undefined, and `-Wundef -Werror` fails the bare use, which is what the
Fast test and `Build (arm_tidy)` reported on `programs/main.cpp:262` and
`programs/keeper/keeper_main.cpp:103`.

Both files now go with that definition instead. Nothing left here reads
`USE_GPU`; everything is behind `ENABLE_GPU`, which cmake defines itself.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
scanhex12 added a commit that referenced this pull request Sep 18, 2026
The CUDA runtime reaches a device only through `dlopen`, so a build with the GPU
engine cannot keep the stub that tells the process there are no shared libraries
to load. Both translation units defining it are here.

These two guards read `USE_GPU`, which `src/Common/config.h.in` defines, so they
belong with that definition rather than with the build island in
#120803 - the island alone has no
`USE_GPU` and `-Wundef -Werror` rejects the bare use.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Only comments change here; every line of cmake and C is untouched.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
# It must stay last: both runtimes define `__gxx_personality_v0`, the linker binds the first on the
# command line, and libstdc++'s does not recognize a libc++ exception - earlier, and the server dies
# on the first `throw` anywhere.
if (ENABLE_GPU)

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.

Adding ${GPU_LIBSTDCXX_LIBRARY} to global DEFAULT_LIBS makes every Linux executable in an ENABLE_GPU=1 tree depend on the builder's shared libstdc++.so.6, not just binaries that actually link GPU-island code. That breaks the current packaging contract here: packages/clickhouse-common-static.yaml still ships only /usr/bin/clickhouse and /usr/bin/clickhouse-extract-from-config, with no matching libstdc++ runtime bundled or declared.

The glibc-compatibility shim also cannot really paper this over, because the shared libstdc++.so.6 carries its own versioned GLIBC_* requirements. So a GPU-enabled package becomes tied to the distro/GCC runtime it was built on.

Please attach libstdc++ only to the specific final targets that actually consume the GPU island, or explicitly bundle/package the matching runtime.

.nv_fatbin : { *(.nv_fatbin) }
}
")
target_link_options (_cudf PRIVATE "$<HOST_LINK:${CMAKE_CURRENT_BINARY_DIR}/fatbin.ld>")

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.

fatbin.ld needs to reach the final link that consumes ch_contrib::cudf, but _cudf is a plain add_library(...) target and ClickHouse never sets BUILD_SHARED_LIBS, so this is a static archive in the default build. In that configuration PRIVATE link options stop at the archive and are not propagated to the eventual executable/library, which means the consumer never sees the script that keeps .nvFatBinSegment and .nv_fatbin together.

This line works upstream because cuDF sets BUILD_SHARED_LIBS to ON; here that assumption no longer holds. Please export the script via INTERFACE_LINK_OPTIONS on _cudf, or attach it on the real consumer target once the GPU binary is linked.

`Build (arm_tidy)` was failing on a duplicate `#include <IO/VarInt.h>` in
`src/Core/tests/gtest_settings.cpp`, a file this branch does not touch. Master
carried that duplicate for a few hours - every PR built in that window failed
the same way, and so did master itself - and has since reverted it. Re-running
the job replays the same merge commit, so it needs a fresh one.

No conflicts. `cmake/ccache.cmake` drops out of the diff: master has that change
already.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@scanhex12
scanhex12 added this pull request to the merge queue Sep 19, 2026
Merged via the queue into master with commit da43782 Sep 19, 2026
175 of 177 checks passed
@scanhex12
scanhex12 deleted the gpu-build-island branch September 19, 2026 10:45
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. pr-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants