Skip to content

修复 fused SwiGLU clamp 自定义算子绑定与 dtype 转换 - #719

Merged
feixi139 merged 3 commits into
PFCCLab:mainfrom
feixi139:fix-fused-swiglu-clamp-binding-dtype
Aug 27, 2026
Merged

修复 fused SwiGLU clamp 自定义算子绑定与 dtype 转换#719
feixi139 merged 3 commits into
PFCCLab:mainfrom
feixi139:fix-fused-swiglu-clamp-binding-dtype

Conversation

@feixi139

Copy link
Copy Markdown
Collaborator

背景

paddle._C_ops._run_custom_op 的手工参数契约只覆盖到 arg4,导致带 5 个以上参数的 fused 算子绑定失败;同时 paddle.Tensor.viewshape_or_dtype 会把 Python 整数误判为 dtype。

修改内容

  • _run_custom_op 参数槽位和默认值扩展到 arg9
  • fuse_weighted_swiglu_fp8_quant_clamp 补充 clamp 语义,并新增 fused_swiglu_weighted_clamp_bwd Torch 参考实现。
  • 保护纯 Python 标量,避免 dtype 归一化破坏 view([1, 4096, -1]) 等形状参数。

验证

  • python -m py_compile tester/api_config/parameter_binding.py tester/paddle_to_torch/arguments.py tester/paddle_to_torch/rules.py:通过。
  • git diff --check:通过。
  • tools/regression/regression_runner.shpaddle_only 438/438 通过;accuracy 427 通过、6 跳过、2 超时、3 torch_error,回归 gate 因非 bitwise 问题未通过。3 个错误均为环境缺少 transformer_engine,2 个超时为超大 paddle.assign/dropout 案例,未命中本次修改路径。
  • pre-commit run --files ...:首次初始化拉取 pre-commit-hooks 时网络超时,未完成。

@feixi139
feixi139 force-pushed the fix-fused-swiglu-clamp-binding-dtype branch 3 times, most recently from ffa3b3c to 034f7be Compare August 27, 2026 09:19
@feixi139
feixi139 force-pushed the fix-fused-swiglu-clamp-binding-dtype branch from 034f7be to f28f399 Compare August 27, 2026 09:21
@feixi139
feixi139 merged commit cb9c5a0 into PFCCLab:main Aug 27, 2026
1 check passed
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