Skip to content

add torch_npu swa#263

Open
old-steel wants to merge 2 commits into
XPU-Forces:masterfrom
old-steel:swa_npu
Open

add torch_npu swa#263
old-steel wants to merge 2 commits into
XPU-Forces:masterfrom
old-steel:swa_npu

Conversation

@old-steel

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the TorchNpuSWAFunction to support sliding window attention on NPU backends using torch_npu.npu_fusion_attention. The review identifies several critical issues, including misspelled keyword arguments and a mismatch in the number of return values in the backward method, both of which would cause runtime errors. Additionally, the feedback suggests avoiding hardcoded mask dimensions to support longer sequences, eliminating performance bottlenecks caused by host-device synchronization, and reducing code duplication by importing utility functions from the core module.

Comment thread mojo_opset/backends/torch_npu/functions/attention.py
Comment thread mojo_opset/backends/torch_npu/functions/attention.py
Comment thread mojo_opset/backends/torch_npu/functions/attention.py Outdated
Comment thread mojo_opset/backends/torch_npu/functions/attention.py Outdated
Comment thread mojo_opset/backends/torch_npu/functions/attention.py
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