【训练营】FlashAttention接入 @simon_chou#128
Open
Simon-CHOU wants to merge 33 commits intoInfiniTensor:masterfrom
Open
【训练营】FlashAttention接入 @simon_chou#128Simon-CHOU wants to merge 33 commits intoInfiniTensor:masterfrom
Simon-CHOU wants to merge 33 commits intoInfiniTensor:masterfrom
Conversation
added 30 commits
March 10, 2026 17:47
…t layout and kernel dimensions
- Initialize shared memory padding to 0 to prevent NaN propagation in WMMA - Fix s_Qi buffer reuse bug by correctly casting to float* - Vectorize output store to float4
- Reduce input range to [-1, 1] to prevent expf overflow - Enable Causal Mask in test - Add multi-tile test cases (T=16, 32, 1024)
- Log NaN fix and Performance Regression (Story 7) - Update Tasking Plan status - Update performance report with latest benchmark results
- Implement Tiled Backward Kernel (Block-level accumulation for dK/dV) - Use Shared Memory for dK/dV accumulation (reduce atomics by 32x) - Add Backward Gradient Check to test_flash_layout
- Implement Tiled Backward Kernel to remove global atomicAdd bottleneck - Fix stride issues in GEMM helpers (Bc_pad vs Bc_bw) - Enable Dynamic Shared Memory (>48KB) for Backward Kernel - Verify correctness with Gradient Check (test_flash_layout) - Benchmark: 7814 TPS (0.64x Baseline), 9x improvement over Story 7
…or and strict nvcc flags
Switch to FP32 kernel and double accumulators to fix precision issues. Correct mask value and epsilon logic.
Record root cause for LLaMA-3 performance bottleneck (atomicAdd) and precision alignment fixes.
Add evaluation conclusion for precision alignment and LLaMA-3 performance analysis.
added 3 commits
March 16, 2026 19:59
Add visualization script and embed PNG chart in report to demonstrate precision alignment.
Collaborator
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Feat] FlashAttention Integration (GPT-2/LLaMA-3)
Summary
Integrates FlashAttention kernels into InfiniTrain to optimize memory usage and support long-sequence training. Aligns with project requirements for the 2025 Winter Training Camp.
Key Changes
FlashAttentionForwardKernelandFlashAttentionBackwardKernelwith causal masking and scaling support.ScaledDotProductAttentionautograd function, mirroring PyTorch's interface.--flashflag for GPT-2 and LLaMA-3 to toggle between baseline and FlashAttention.Verification
Performance
Notes
atomicAdd.