Skip to content

[1/5] refactor(attention): define execution contracts and device workspace - #1717

Closed
sufubao wants to merge 1 commit into
mainfrom
refactor/attention-01-contracts
Closed

sufubao wants to merge 1 commit into
mainfrom
refactor/attention-01-contracts

Conversation

@sufubao

@sufubao sufubao commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

公开 AttentionExecutionContext 和 AttentionWorkspace,约束 Context 泛型,并补齐 AttentionBackend 的 check_environment/check_support/create 接入契约。Base 在 provider 初始化前接收 LayerSpec,causal/page_size/dynamic_verify 由 spec 决定;ExecutionRequirements 保持纯数据,模型转换位于 basemodel 适配层。

LayerAttentionBinding.forward(execution, inputs, out=...) 每次通过 AttentionExecution 查找 Context,保留 .context() 给直接消费者,不缓存执行 Context。

LayerSpec 保存静态窗口及 MLA softmax_scale,Params 保存层资源;Varlen out 明确 shape/dtype/device、无重叠 stride 和禁止共享输入存储的约束。workspace 原实现移至公开 API,内部路径仅转发。DeviceCaps.device_name 与实际值一致。

本机 H200:本步21项 contract/device/workspace 检查通过。运行时接入在第5步,平台注册入口不代表 MUSA/ROCm/Ascend 已实测。

由已关闭的 #1700 拆分,本 PR 为第1/5步,依赖顺序 #1717 → #1718 → #1719 → #1720 → #1721。全部保持 Draft;按序合入,前序进入 main 后再 retarget 后续 PR。CI 仅监听 base=main,第2–5步本地检查不等于 GitHub CI。

本轮实验记录:/data6/exp_logs/runs,最终组合 261113-115108,模型 261113-115240;源文件哈希、命令、结果和失败记录均保留。

@sufubao
sufubao force-pushed the refactor/attention-01-contracts branch from e0b2617 to 042280e Compare November 13, 2026 03:55
@sufubao sufubao closed this Nov 13, 2026
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.

1 participant