Skip to content

feat: add sequence-parallel t_mod and chunked FFN optimization - #33

Merged
HolyStoneC merged 2 commits into
mainfrom
feature/optimize_tmod_and_ffn
Mar 26, 2026
Merged

HolyStoneC merged 2 commits into
mainfrom
feature/optimize_tmod_and_ffn

Conversation

@pearlpig-iu

Copy link
Copy Markdown
Collaborator

Summary

This PR adds two memory optimizations:

  • FFN chunking to reduce peak memory usage on single GPU
  • SP-parallel t_mod to reduce redundant memory usage across ranks in multi-GPU runs

Details

FFN chunking

FFN computation is split into smaller chunks along the sequence dimension, which lowers peak activation memory without changing the overall computation flow.

SP-parallel t_mod

t_mod is sharded following the sequence-parallel layout, so each rank only keeps its local slice instead of a full copy.

Benefits

  • lower single-GPU peak memory
  • lower per-rank memory usage in SP
  • improved stability for long-sequence / high-resolution cases

Test Report

https://gitlab.sh.sensetime.com/lijunping/qw_kairos/-/commit/03c94111d1fe56c9d64a35e988e92bcef1144089

@pearlpig-iu
pearlpig-iu force-pushed the feature/optimize_tmod_and_ffn branch from 7ff74d7 to a66c93e Compare March 23, 2026 06:10
@HolyStoneC HolyStoneC self-assigned this Mar 26, 2026

@HolyStoneC HolyStoneC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pass

@HolyStoneC
HolyStoneC requested review from HolyStoneC and removed request for yinsp398 March 26, 2026 03:28
@HolyStoneC
HolyStoneC merged commit b30cfdc into main Mar 26, 2026
27 of 28 checks passed
@pearlpig-iu
pearlpig-iu deleted the feature/optimize_tmod_and_ffn branch March 26, 2026 09:41

This branch was previously deployed

1 inactive deployment
Env — 9e6f1ee2 Deployed Mar 25, 2026 by pearlpig-iu via C500_480p_ti2v_4gpu / run-task #20
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.

2 participants