add smooth K for sagev1#1806
Open
luoyu-intel wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a “smooth K” path for SAGEv1 by optionally subtracting a per-(row, head_dim) mean bias from K before INT8 dynamic quantization, and introduces a Torch SDPA patch + lm-eval launcher so models can be evaluated with ARK attention without editing model code.
Changes:
- Add mean-bias computation (
compute_seq_mean_bias) and bias-aware dynamic quantization for SAGEv1’s K path (env-controlled). - Add a Torch SDPA global patch (
patch_torch_sdpa_with_ark) and a helper launcher to runlm-evalwith the patch enabled. - Add/adjust ARK UT scaffolding and CMake wiring for SDPA/SAGE-related tests and benchmarks.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| auto_round_extension/ark/tools/lm_eval_with_ark_sdpa.py | Helper launcher that patches Torch SDPA then runs lm_eval. |
| auto_round_extension/ark/README.md | Documents using the SDPA patch + lm-eval helper. |
| auto_round_extension/ark/auto_round_kernel/wrapper/test/test_sdpa.hpp | Adds SAGEv1 SDPA-focused UT/benchmark code. |
| auto_round_extension/ark/auto_round_kernel/wrapper/test/test_quant.hpp | Adds UT/bench coverage for mean-bias + dynamic quantization. |
| auto_round_extension/ark/auto_round_kernel/wrapper/test/test_main.cpp | Switches UT entrypoint to construct selected test suites. |
| auto_round_extension/ark/auto_round_kernel/wrapper/test/test_gemm.hpp | Removes static test auto-run behavior. |
| auto_round_extension/ark/auto_round_kernel/wrapper/include/xpu_wrapper.hpp | Implements mean-bias and bias-aware K quantization in SAGEv1. |
| auto_round_extension/ark/auto_round_kernel/wrapper/include/utils.hpp | Adds env toggles for mean-bias and optional bias distribution logging. |
| auto_round_extension/ark/auto_round_kernel/torch_sdpa_patch.py | Implements global patching of torch.nn.functional.scaled_dot_product_attention. |
| auto_round_extension/ark/auto_round_kernel/CMakeLists.txt | Updates UT build sources/includes/options for SYCL/TLA SDPA. |
| auto_round_extension/ark/auto_round_kernel/ark.cpp | Extends sage_dynamic_quant pybind API to accept an optional bias buffer. |
| auto_round_extension/ark/auto_round_kernel/init.py | Exposes patch/unpatch helpers; updates sage_dynamic_quant calls for new signature. |
| auto_round_extension/ark/.gitignore | Ignores local build artifacts and CSV outputs in the ARK subdir. |
for more information, see https://pre-commit.ci
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.
Description