feat(nvidia): 为 v0.2.9c 增加可复用的 GGUF Route B 支持 - #589
Open
xindongliu594 wants to merge 7 commits into
Open
xindongliu594 wants to merge 7 commits into
xindongliu594 wants to merge 7 commits into
Conversation
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.
Summary
Q8_0、Q4_K、Q5_K和Q6_K。csrc/layers/quantization/gguf.*中实现公共 GGUF 量化配置、布局检查和执行逻辑。csrc/layers/linear/*、csrc/layers/mlp/*和 Qwen 模型代码,使 GGUF 能力可被其他模型复用。scripts/gguf_mapping.py、scripts/gguf_to_infinilm.py、scripts/gguf_transforms.py与test/scripts/test_gguf_routeb.py。GGUF_ROUTE_B_QWEN38.md,记录架构、转换方式、支持范围和当前限制。Motivation
InfiniLM 当前不能直接加载并执行 Qwen3.5 27B 等模型的 GGUF 量化权重。若在各模型代码中分别实现解量化和矩阵计算,会产生大量重复逻辑,也不利于继续适配其他 GGUF 模型。
本 PR 将 GGUF 支持拆分为可复用层次:
linear_gguf与 BlockFP8 线性算子;相关依赖:
N/A — 当前没有对应的 InfiniLM issue,因此不填写
Closes #...。Type of Change
feat— new feature / new modelfix— bug fixperf— performance improvement (no behavioral change)refactor— code restructuring without behavior changetest— adding or fixing tests onlydocs— documentation onlybuild/ci— build system or CI configurationchore— tooling, formatting, or other non-code changesTest Results of Involved Models on Supported Platforms (Please attach screenshots)
测试环境:
InfiniLM-v0.2.9c4822f86ec3440e6d已通过:
scripts/format.py --ref upstream/InfiniLM-v0.2.9c --check;git diff --check、Pythoncompileall;test/scripts/test_gguf_routeb.py -v:5/5;examples/test_infer.py:Qwen3.5 27B GGUF 单请求测试,exit 0;examples/bench.py:64 input / 8 output 离线性能入口,exit 0;linear_gguf、BlockFP8、MHA varlen 与整模型联调测试。未勾选项:
test/bench/test_benchmark.pysanity 测试;scripts/test_perf.pyservice 测试;测试截图
Benchmark / Performance Impact
GGUF prefill 解量化优化
同一 RTX 5090、相同模型/配置/warmup,三次测量取中位数:
可选 FlashAttention 联调结果
FlashAttention 是框架已有的可选后端,本 PR 不改变默认分派。相对 paged-attention 预热基线:
因此当前仍保留 paged-attention 默认路径;不宣称全阶段提速或达到 llama.cpp 水平。
Notes for Reviewers
linear_gguf/ BlockFP8 API;请先审查关联的 InfiniCore PR。CI / ChatOps
CI 尚未触发。PR 创建后将从 Actions → CI 选择本分支手动运行;若外部 fork 无权限,则请求 maintainer 评论
/retest或/test。Checklist
Title, Branch, and Commits
feat(nvidia): …,fix(cuda/gemm): …).<type>/xxx-yyyy-zzzzwhere<type>matches the PR title's Conventional Commits type and words are joined with hyphens (seeCONTRIBUTING.md§Branches).CONTRIBUTING.md§Pull Requests).InfiniLM-v0.2.9c而非main;分支直接基于该 base,且没有 merge commits。fixup!/squash!/wipcommits remain.Scope and Design
CONTRIBUTING.md§Code/General).printf/std::cout/print(...)left behind, orTODOwithout an owner and issue link.General Code Hygiene (applies to all languages)
CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).the `seqlens_k` tensor) (CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General; §Python).C++ Specific (if C++ files changed)
CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).new/delete; RAII / smart pointers / existing allocators are used.scripts/format.py.csrc/models/llama_legacy/.Python Specific (if Python files changed)
CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).scripts/format.py.python/infinilm/auto_config.py.Testing
examples/test_infer.py).examples/bench.py).test/bench/test_benchmark.py);当前先提交以启动 review/CI,不将该项标记为完成。python/infinilm/server/inference_server.py+scripts/test_perf.py);当前先提交以启动 review/CI,不将该项标记为完成。Build, CI, and Tooling
/retest。Documentation
GGUF_ROUTE_B_QWEN38.md已记录架构、转换、运行参数、支持范围和限制。Security and Safety