causal-conv1d: sync kernels with upstream v1.6.2.post1 (deterministic backward)#939
Closed
kashif wants to merge 2 commits into
Closed
causal-conv1d: sync kernels with upstream v1.6.2.post1 (deterministic backward)#939kashif wants to merge 2 commits into
kashif wants to merge 2 commits into
Conversation
… bwd) Update the CUDA/C++ sources to upstream causal-conv1d v1.6.2.post1, which adds an opt-in deterministic backward path (CAUSAL_CONV1D_DETERMINISTIC env var / torch.use_deterministic_algorithms) backed by dweight/dbias workspaces. Keep the kernels-build binding adaptations on top of the upstream sources: include <torch/all.h> and let torch-ext/torch_binding.cpp own op registration (the upstream PYBIND11_MODULE blocks stay commented out). Builds and runs against torch 2.12/cu13 on sm_86; causal_conv1d_fn matches a reference conv1d+SiLU exactly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add utils/causal_conv1d.py which imports the pip-installed causal_conv1d when present and degrades every symbol to None otherwise, then point the mamba / mamba2 modules at it instead of repeating per-file try/except import guards. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Hi @kashif, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/huggingface/kernels-community/blob/main/CONTRIBUTING.md for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs the
causal-conv1dCUDA kernels with upstreamv1.6.2.post1. The main thing this brings is an opt-in deterministic backward — setCAUSAL_CONV1D_DETERMINISTIC=1(ortorch.use_deterministic_algorithms(True)) and the bwd accumulates through workspaces instead of atomics, so gradients are reproducible. I kept the kernels-build binding tweaks on top of the upstream sources (<torch/all.h>, op registration stays intorch_binding.cpp).Also tidies up
mamba-ssm: the four modules that optionally usecausal_conv1dnow import it from one smallutils/causal_conv1d.pyhelper instead of each repeating the sametry/except. The helper stays pip-only (use the installedcausal_conv1d, elseNone) to match how every other kernel here works — composing from the Hub stays the caller's job. A lazyget_kernelfallback can be added later, once the updated causal-conv1d is published with a version tag to pin to.Built and ran against torch 2.12 / cu13 on an sm_86 card — compiles fine and
causal_conv1d_fnmatches a reference conv1d+SiLU exactly.The bigger mamba-ssm update (full selective-scan port, Mamba-3 / quack / tilelang) is left for a follow-up.
🤖 Generated with Claude Code