Skip to content

pass revision to to cmake template#291

Merged
danieldk merged 1 commit into
mainfrom
pass-revision-to-cmake
Feb 18, 2026
Merged

pass revision to to cmake template#291
danieldk merged 1 commit into
mainfrom
pass-revision-to-cmake

Conversation

@drbh
Copy link
Copy Markdown
Collaborator

@drbh drbh commented Feb 17, 2026

This PR fixes a bug where the ops id was not passed to render_preamble, causing it to fall back to a different identifier in Nix builds. This made the cmake extension name diverge from the expected name.

Additionally, the postInstall cleanup pattern was missing the backend segment, so stale build artifacts were not removed. Together these caused build-and-copy to fail with Permission denied when bundling multiple variants.

error when using the builder on main

nix flake update
nix run .#build-and-copy -L --cores 2 --max-jobs 8
# torch-ext-bundle> cp: cannot create regular file '/nix/store/i0lf882dgvi9ffgc1sq92s0n330w3ynl-torch-ext-bundle/_flash_mla_cuda_ghzc76n4to3fq/_flash_mla_cuda_ghzc76n4to3fq.abi3.so': Permission denied
# error: Cannot build '/nix/store/ijd011d4pz5jy56m2c2q21fmrhnyjml9-torch-ext-bundle.drv'.
#        Reason: builder failed with exit code 1.
#        Output paths:
#          /nix/store/i0lf882dgvi9ffgc1sq92s0n330w3ynl-torch-ext-bundle
#        Last 1 log lines:
#        > cp: cannot create regular file '/nix/store/i0lf882dgvi9ffgc1sq92s0n330w3ynl-torch-ext-bundle/_flash_mla_cuda_ghzc76n4to3fq/_flash_mla_cuda_ghzc76n4to3fq.abi3.so': Permission denied
#        For full logs, run:
#          nix log /nix/store/ijd011d4pz5jy56m2c2q21fmrhnyjml9-torch-ext-bundle.drv
# error: Cannot build '/nix/store/dmwahvzhw1vsy2kqvz39sipv81x3iws0-build-and-copy.drv'.
#        Reason: 1 dependency failed.
#        Output paths:
#          /nix/store/pwsp646ri9y2c61azk9smqm4n8j37fa9-build-and-copy
# ❌ /nix/store/dmwahvzhw1vsy2kqvz39sipv81x3iws0-build-and-copy.drv^out
# error: Build failed due to failed dependency

example of build output when using an older version of the builder that didnt cause the collision but didnt clean up the build artifacts

# set kernel-builder.url = "github:huggingface/kernels/2c436beccd9adf962f1634c45e825e69909768c6";
tree -L 1 build
# build
# ├── _flash_mla_cuda_ffxujicuwi76y
# ├── _flash_mla_cuda_hu5pgjzy2nejw
# ├── _flash_mla_cuda_lsxvehlvaijjo
# ├── _flash_mla_cuda_syrdugbz4gcrc
# ├── torch210-cxx11-cu128-x86_64-linux
# ├── torch210-cxx11-cu130-x86_64-linux
# ├── torch29-cxx11-cu128-x86_64-linux
# └── torch29-cxx11-cu130-x86_64-linux

example build after changes

# set kernel-builder.url = "path:/home/drbh/Projects/kernels";
nix run .#build-and-copy -L --cores 2 --max-jobs 8
tree -L 1 build
# build
# ├── torch210-cxx11-cu128-x86_64-linux
# ├── torch210-cxx11-cu130-x86_64-linux
# ├── torch29-cxx11-cu128-x86_64-linux
# └── torch29-cxx11-cu130-x86_64-linux

note: upon further investigation the collision seems to happen after #281 which seemed to result in the same identifier being used in multiple variants which resulted in a conflict in the join-paths merge. the changes in this PR avoid this bug and result in a reliable build output

Copy link
Copy Markdown
Member

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Great catch! Merging immediately, since we are often building using main.

@danieldk danieldk merged commit 80058c9 into main Feb 18, 2026
38 checks passed
@danieldk danieldk deleted the pass-revision-to-cmake branch February 18, 2026 07:57
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