[None][chore] Add explicit error for intermediate size misalignment with fp8 block size#12101
Conversation
…ith fp8 block size Signed-off-by: leslie-fang25 <leslief@nvidia.com>
|
/bot run --disable-fail-fast |
📝 WalkthroughWalkthroughA new class attribute Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tensorrt_llm/_torch/modules/fused_moe/quantization.py (1)
992-992: Consider using explicitraiseinstead ofassertfor production validation.Using
assertfor validation can be problematic because assertions are disabled when Python runs with optimization flags (-Oor-OO). For a check that must always execute to prevent data corruption or incorrect behavior, an explicit conditional withraise ValueErroris safer.Also, this check is only in the VANILLA path. If
FUSED_GATE_UP_PROJmode can also encounter misaligned partitions, a similar check may be warranted there (or moved earlier in the flow).♻️ Suggested refactor to use explicit raise
dst_w3_weight_scale, dst_w1_weight_scale = dst_w3_w1_weight_scale[ local_slot_id].chunk(2, dim=0) - assert module.intermediate_size_per_partition % self.fp8_block_size == 0, "For DeepSeekFP8BlockScalesFusedMoEMethod, intermediate_size_per_partition should be divisible by fp8_block_size." + if module.intermediate_size_per_partition % self.fp8_block_size != 0: + raise ValueError( + f"For DeepSeekFP8BlockScalesFusedMoEMethod, intermediate_size_per_partition " + f"({module.intermediate_size_per_partition}) must be divisible by " + f"fp8_block_size ({self.fp8_block_size})." + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tensorrt_llm/_torch/modules/fused_moe/quantization.py` at line 992, Replace the runtime-only assertion with an explicit validation: in quantization.py where the code currently does assert module.intermediate_size_per_partition % self.fp8_block_size == 0 (inside DeepSeekFP8BlockScalesFusedMoEMethod or its surrounding method), change it to an if-check that raises ValueError with a clear message when the condition fails; also add the same explicit validation for the FUSED_GATE_UP_PROJ path (or move the check to a shared validation routine run before branching) so misaligned intermediate_size_per_partition is always caught in production.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tensorrt_llm/_torch/modules/fused_moe/quantization.py`:
- Line 992: Replace the runtime-only assertion with an explicit validation: in
quantization.py where the code currently does assert
module.intermediate_size_per_partition % self.fp8_block_size == 0 (inside
DeepSeekFP8BlockScalesFusedMoEMethod or its surrounding method), change it to an
if-check that raises ValueError with a clear message when the condition fails;
also add the same explicit validation for the FUSED_GATE_UP_PROJ path (or move
the check to a shared validation routine run before branching) so misaligned
intermediate_size_per_partition is always caught in production.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a3da34a9-95b1-4ab3-bf09-540f8c752b45
📒 Files selected for processing (1)
tensorrt_llm/_torch/modules/fused_moe/quantization.py
|
PR_Github #38552 [ run ] triggered by Bot. Commit: |
|
PR_Github #38552 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #38642 [ run ] triggered by Bot. Commit: |
|
PR_Github #38642 [ run ] completed with state |
Summary by CodeRabbit
Release Notes
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.