Repository navigation
Phonon: keep the Mimi decoder state on the GPU for CUDA (#25021) - #25021
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/25021
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit 2d35fa1 with merge base fe03d52 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@psiddh has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131675810. |
This PR needs a
|
82b31e6 to
ae1dbae
Compare
Summary: Pull Request resolved: pytorch#25021 mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph. StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs. This diff was written with the help of Claude Code (Claude Opus 5.5). Differential Revision: D131675810
Gasoonjia
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
ae1dbae to
14cf793
Compare
Summary: Pull Request resolved: pytorch#25021 mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph. StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs. This diff was written with the help of Claude Code (Claude Opus 5.5). Reviewed By: Gasoonjia Differential Revision: D131675810
Summary: mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph. StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs. This diff was written with the help of Claude Code (Claude Opus 5.5). Reviewed By: shoumikhin, Gasoonjia Differential Revision: D131675810
14cf793 to
df07551
Compare
Summary: mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph. StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs. This diff was written with the help of Claude Code (Claude Opus 5.5). Reviewed By: shoumikhin, Gasoonjia Differential Revision: D131675810
df07551 to
dafeee6
Compare
Summary: mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph. StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs. This diff was written with the help of Claude Code (Claude Opus 5.5). Reviewed By: shoumikhin, Gasoonjia Differential Revision: D131675810
dafeee6 to
7447555
Compare
Summary: mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph. StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs. This diff was written with the help of Claude Code (Claude Opus 5.5). Reviewed By: shoumikhin, Gasoonjia Differential Revision: D131675810
7447555 to
2d35fa1
Compare
Summary:
mimi_decode takes its streaming state (15 tensors, 2.1 MB, mostly the decoder transformer's keys and values) as inputs and returns it as outputs, so on CUDA every 80 ms frame copied it to the GPU and back, with a synchronization each way. That made mimi_decode take 4 ms in the runtime against 1.3 ms for the compiled graph.
StatefulMimiDecode wraps MimiDecodeStep and keeps the state in mutable buffers of the program (MimiState): forward(latent, reset) -> pcm, where reset = 1 starts an utterance from the zero state. The CUDA export uses it (mimi_state_in_program in export_phonon.py); the other backends keep the state as inputs and outputs. The program records the choice in a new mimi_state_in_program constant and phonon.json, the C++ and Python runners pass (latent, reset) when it is set, and format_version is now 2, so the runners ask to re-export older programs.
This diff was written with the help of Claude Code (Claude Opus 5.5).
Reviewed By: shoumikhin, Gasoonjia
Differential Revision: D131675810