Skip to content

tiankuan-lanzhichuan - #114

Open
JerryJonny wants to merge 1 commit into
flagos-ai:mainfrom
HDU-Tiankuan:feature/npu-layernorm
Open

tiankuan-lanzhichuan#114
JerryJonny wants to merge 1 commit into
flagos-ai:mainfrom
HDU-Tiankuan:feature/npu-layernorm

Conversation

@JerryJonny

Copy link
Copy Markdown

Description

Add NPU vendor implementations for LayerNorm forward and backward in the TE-FL plugin backend.

The implementation follows the existing TransformerEngineNPU LayerNormLinear computation semantics and adapts them to the unified TE-FL LayerNorm interface. This allows LayerNorm to use the vendor.npu backend instead of falling back to the PyTorch reference implementation on Ascend NPU.

The implementation has been validated with unit tests and a 100-step training A/B comparison against the reference LayerNorm path. The training run completed without skipped or NaN iterations, and no observable training performance regression was found.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Add layernorm_fwd implementation to the NPU vendor backend.
  • Add layernorm_bwd implementation to the NPU vendor backend.
  • Register layernorm_fwd and layernorm_bwd as vendor.npu implementations in the TE-FL plugin registry.
  • Support TE-FL LayerNorm interface features including zero_centered_gamma, output dtype handling, pre-allocated output tensors, and output quantization.
  • Add NPU LayerNorm forward/backward tests covering supported data types and interface behavior.
  • Validate the NPU LayerNorm path against the existing reference implementation and full training workflow.

Checklist

@JerryJonny JerryJonny changed the title Add NPU LayerNorm forward and backward backend tiankuan-lanzhichuan Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant