perf(npu): generate fast Cython paths for same-dtype no-alpha binary ops#222
perf(npu): generate fast Cython paths for same-dtype no-alpha binary ops#222lvyufeng wants to merge 5 commits into
Conversation
Candle AI Review (Update)Changes Since Last Review
Previously Flagged IssuesNo issues were flagged in the previous review. New Findings
Risk: HighThe missing Incremental review at commit 6c1b55d (2026-03-25 09:04 UTC) |
|
$(cat <<'DELIM' CRITICAL #1 (cdef pointer capture): Verified this is a non-issue. In Cython CRITICAL #2 (zero-workspace execution): Verified this is a non-issue. Both WARNING (atan2 scalar guard): WARNING (name mutation): This is a pre-existing pattern used throughout INFO (test_fast_div correctness): Fixed. Restored INFO (generator CI lint): Acknowledged as operational risk. The generator is development-time only and the checked-in output is the source of truth. Adding a CI lint step is a reasonable follow-up but out of scope for this perf PR. |
30a18ee to
4a6848c
Compare
Add development-time codegen for thin no-alpha binary wrappers and wire atan2, pow(tensor,tensor), remainder, fmod, logaddexp, logaddexp2 through Cython fast paths bypassing Python ACLNN wrappers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Cython dispatch Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40ecf83 to
ecacd5d
Compare
Add _use_soc_fallback guard in _functional_ops.pyx remainder wrapper so 310B SoC correctly falls back to the composite path instead of calling the unavailable RemainderTensorTensor kernel directly. Also restore late-rebind blocks for remainder/fmod in _functional.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Guard the Cython fast atan2/remainder wrappers with _use_soc_fallback so 310B and other unsupported SoCs continue to use the existing Python fallback/composite implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Benchmarks
Measured on 910B3, no-sync (100-chained):
Test plan
🤖 Generated with Claude Code