Repository navigation
Add Hy4-preview training TFLOPs calculation - #6063
hengtaoguo wants to merge 1 commit into
Conversation
|
🤖 Hi @hengtaoguo, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements the TFLOPs calculation logic for the Hy4-preview model architecture within the MaxText framework. It ensures that MFU reporting correctly accounts for the specific computational overheads of Hy4, including its gated MLA projections, periodic DSA indexer, and identity hyper-connections. The changes provide a robust way to estimate training performance for this model type. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
🤖 Hi @hengtaoguo, I'm running an automatic MaxText review of this pull request. You can track my progress in the logs. To request another review later, add the |
There was a problem hiding this comment.
📋 Review Summary
Verdict: Spec fully met; logic is sound and tests correctly validate both the dense and sparse flop formulas. No significant issues found.
Inferred spec & validation
- Sources: PR description, code before/after.
- Problem:
hy4-previewlacks a dedicated per-model TFLOPs calculation format for accurate MFU reporting.
| Spec item | Implementation | Validating test |
|---|---|---|
| R1 (stated): Calculate HY4 specific TFLOPs including MLA, DSA indexer and iHC. | ✅ | flop_calculation_test.py::test_hy4_preview_flops ✅ |
R2 (stated): Register HY4 in get_dense_moe_layers helper. |
✅ | flop_calculation_test.py::test_hy4_preview_flops ✅ |
C1 (stated): Indexer FLOPs count forward-only and are bypassed when seq_len <= indexer_topk. |
✅ preserved | flop_calculation_test.py::test_hy4_preview_flops ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Drops the internal workload and trace links (and the `Workload` / `XProf` columns) from the benchmark tables in `docs/guides/optimization/fsdp_prefetch.md`. All benchmark numbers are unchanged. FUTURE_COPYBARA_INTEGRATE_REVIEW=#6063 from AI-Hypercomputer:hengtaoguo-hy4 db4cc96 PiperOrigin-RevId: 1011680505
Description
Adds
calculate_hy4_tflops_training_per_deviceso MFU reporting forhy4-previewfollows the same per-model format as DeepSeek-V4/Gemma4.get_dense_moe_layersreturns 1 dense + 77 MoE layers.gate_proj(D → H·D_v).seq_len > indexer_topkand dense causal otherwise.Tests
test_hy4_preview_flopschecks the dense/MoE layer split and the weight/attention TFLOPs at seq 4096, and the indexer-bypass path atseq_len = indexer_topk.flop_calculation_test.py: 53/53 pass. pyink clean.Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.skip-ci-testsso only CPU/lint/docs checks run during review; a bot removes it after 2 approvals on a 1-commit PR to run TPU/GPU suites, or remove it yourself / ask a maintainer on fork PRs to run them sooner.)