Skip to content

Fix rtcx embed target-level dependencies under the Makefiles generator - #23106

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
galipremsagar:fix-rtcx-embed-makefiles-deps
Jul 6, 2026
Merged

Fix rtcx embed target-level dependencies under the Makefiles generator#23106
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
galipremsagar:fix-rtcx-embed-makefiles-deps

Conversation

@galipremsagar

Copy link
Copy Markdown
Contributor

Description

Since #22680, a from-scratch ./build.sh with the Unix Makefiles generator fails with:

gmake[2]: *** No rule to make target 'CMakeFiles/cudf_fragments_transform_kernel_20.dir/src/transform/jit/kernel.fatbin', needed by 'rtcx_embed/cudf_fragments.hpp'.  Stop.

The rtcx_embed() custom command depends on the fragment object libraries only via $<TARGET_OBJECTS:...> generator expressions. With the Makefiles generator this produces file-level prerequisites with no build rule and no target-level ordering — cudf_fragments.dir/all only depended on cudf_fragments__jit_embed_run, not on the 21 cudf_fragments_transform_kernel_N object libraries — so a parallel make races ahead of the fatbin compilations and dies. Ninja resolves the same dependency through its global build graph, which is why CI never hit this.

The fix records the object-library target names in a new EMBED_TARGET_DEP_NAMES property alongside the existing $<TARGET_OBJECTS:...> genexes, and passes those names to the custom command DEPENDS. Naming a real target there makes CMake emit a proper target-level dependency, so the Makefiles generator builds all fragment fatbins before running the embed step.

Verified locally with CMake 4.3.4 + Unix Makefiles: after this change Makefile2 contains target-level deps from cudf_fragments.dir/all on every cudf_fragments_transform_kernel_N.dir/all, and a clean-state -j32 build of cudf_fragments (and a full ./build.sh) succeeds where it previously failed.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

The rtcx embed custom command depended on fragment object libraries only
via $<TARGET_OBJECTS:...> generator expressions. With the Unix Makefiles
generator this produces file-level dependencies without any target-level
ordering, so a parallel build races and fails with:

  No rule to make target 'CMakeFiles/cudf_fragments_transform_kernel_20.dir/src/transform/jit/kernel.fatbin',
  needed by 'rtcx_embed/cudf_fragments.hpp'.

Ninja resolves this through its global build graph, which is why CI is
unaffected. Record the object-library target names alongside the object
genexes and pass them to the custom command DEPENDS, which makes CMake
emit proper target-level dependencies.
@galipremsagar
galipremsagar requested a review from a team as a code owner July 4, 2026 21:46
@copy-pr-bot

copy-pr-bot Bot commented Jul 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue labels Jul 4, 2026
@galipremsagar galipremsagar added bug Something isn't working non-breaking Non-breaking change labels Jul 4, 2026
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved build dependency tracking for generated embedded artifacts, helping ensure they rebuild in the correct order and reducing the chance of stale outputs.

Walkthrough

This change extends CMake embed dependency tracking in cpp/librtcx/embed.cmake. When rtcx_embed_blob() matches a $<TARGET_OBJECTS:...> file reference, it now also records the target name into a new EMBED_TARGET_DEP_NAMES property. rtcx_embed() reads this property and appends it to the custom command's DEPENDS clause.

Changes

Embed Build Dependency Tracking

Layer / File(s) Summary
Target dependency name tracking
cpp/librtcx/embed.cmake
Adds EMBED_TARGET_DEP_NAMES property recording in rtcx_embed_blob() and wires it into rtcx_embed()'s custom command DEPENDS clause for proper build-graph ordering.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Related Issues: None specified

Related PRs: None specified

Suggested labels: cmake, build

Suggested reviewers: None specified

Poem:
A rabbit hopped through CMake's maze,
Found targets hiding in the object phase,
Now names are tracked, dependencies clear,
The build graph sharper, the outputs sincere,
Hop, hop, hooray for the DEPENDS embrace!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the Makefiles generator dependency fix in rtcx embed.
Description check ✅ Passed The description matches the changeset and explains the build failure and fix in detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cpp/librtcx/embed.cmake (1)

167-181: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: dedupe accumulated target dep names/objects.

If multiple blob entries reference the same object-library target within one embed target, EMBED_TARGET_DEPS/EMBED_TARGET_DEP_NAMES will accumulate duplicate entries. Harmless functionally, but list(REMOVE_DUPLICATES ...) before use in rtcx_embed() would keep generated DEPENDS lists tidy.

♻️ Optional dedup suggestion
   get_property(
     EMBED_TARGET_DEP_NAMES
     TARGET ${TARGET}__embed_props
     PROPERTY EMBED_TARGET_DEP_NAMES
   )
+  if(EMBED_TARGET_DEP_NAMES)
+    list(REMOVE_DUPLICATES EMBED_TARGET_DEP_NAMES)
+  endif()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/librtcx/embed.cmake` around lines 167 - 181, Deduplicate the accumulated
object-library target dependencies in rtcx_embed() so repeated
$<TARGET_OBJECTS:...> entries from the same target do not add duplicate values
to EMBED_TARGET_DEPS and EMBED_TARGET_DEP_NAMES. Add list(REMOVE_DUPLICATES ...)
before these properties are consumed, using the existing EMBED_TARGET_DEPS,
EMBED_TARGET_DEP_NAMES, and rtcx_embed() symbols to keep the generated DEPENDS
lists tidy without changing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cpp/librtcx/embed.cmake`:
- Around line 167-181: Deduplicate the accumulated object-library target
dependencies in rtcx_embed() so repeated $<TARGET_OBJECTS:...> entries from the
same target do not add duplicate values to EMBED_TARGET_DEPS and
EMBED_TARGET_DEP_NAMES. Add list(REMOVE_DUPLICATES ...) before these properties
are consumed, using the existing EMBED_TARGET_DEPS, EMBED_TARGET_DEP_NAMES, and
rtcx_embed() symbols to keep the generated DEPENDS lists tidy without changing
behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3a8e35ae-fc9a-4397-93b6-9f00de06adc8

📥 Commits

Reviewing files that changed from the base of the PR and between 3652e80 and c7bc602.

📒 Files selected for processing (1)
  • cpp/librtcx/embed.cmake

@galipremsagar

Copy link
Copy Markdown
Contributor Author

/okay to test c7bc602

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

This is fine with me if you observe it fixes the problem, but maybe wait to merge until another CMake expert can review.

@galipremsagar

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit b570d83 into NVIDIA:main Jul 6, 2026
138 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CMake CMake build issue libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants