Skip to content

test: direct unit suite for export postprocess TP/PP splitting (74 tests)#1907

Closed
arham766 wants to merge 2 commits into
NVIDIA:mainfrom
arham766:tests/test-export-postprocess
Closed

test: direct unit suite for export postprocess TP/PP splitting (74 tests)#1907
arham766 wants to merge 2 commits into
NVIDIA:mainfrom
arham766:tests/test-export-postprocess

Conversation

@arham766

@arham766 arham766 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: new tests

Part of the unit-coverage initiative in #1902 (one PR per module; this one is self-contained). Covers: TP column/row splits with zero-padding math, expert w3/w1 interleave, PP rank assignment [0,2,1,3] and embedding/lm_head placement, pad_embedding_lm_head incl. the 1/7 int4 AWQ scale pad, update_lm_head_quantization divisibility gating with real mtq-quantized lm_heads, check_weight_shape_valid, postprocess_tensors dtype/contiguity rules. Distributed merge paths excluded honestly (need multi-rank shm).

Usage

N/A — tests only.

Testing

Suite is hermetic (CPU-only, no network, deterministic, <3s) and passes locally; the full collectable tests/unit tree passes with it (1999 passed). The suite was adversarially reviewed and verified to kill seeded mutations of the target module (details in #1902).

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: ✅
  • Did you update Changelog?: N/A
  • Did you get Claude approval on this PR?: N/A (external contributor)

Additional Information

Issue: #1902

Summary by CodeRabbit

  • Tests
    • Added broad unit test coverage for export postprocessing, including tensor utility semantics, dtype view conversions, config cloning, tensor-parallel and pipeline-parallel config splitting, and full end-to-end postprocess integration.
    • Added fixtures for quantized lm-head and model config scenarios, validating embedding/lm-head padding, lm-head quantization enable/disable logic, weight shape validation, and tensor postprocessing (dtype casting, view cloning, and contiguity).

Hermetic CPU-only unit tests; adversarially reviewed and verified to
kill seeded mutations of the target module. Part of the coverage
initiative in NVIDIA#1902.

Signed-off-by: arham766 <arhamislam766@yahoo.com>
@arham766 arham766 requested a review from a team as a code owner July 5, 2026 20:10
@copy-pr-bot

copy-pr-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1927b63a-dfb5-443f-bc79-bf3979c6a663

📥 Commits

Reviewing files that changed from the base of the PR and between 21aa9d1 and d49c403.

📒 Files selected for processing (1)
  • tests/unit/torch/export/test_postprocess.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/unit/torch/export/test_postprocess.py

📝 Walkthrough

Walkthrough

Adds a new unit test file for the export postprocess module, covering tensor utility helpers, config cloning, tensor-parallel and pipeline-parallel splitting, full postprocess integration, embedding/lm-head padding, lm-head quantization updates, weight shape validation, and tensor postprocessing.

Changes

Postprocess Test Suite

Layer / File(s) Summary
Test fixtures and helper builders
tests/unit/torch/export/test_postprocess.py
Adds module imports, helper builders for column/row linear configs, minimal ModelConfig construction, and an INT4 quantized lm-head fixture.
Tensor utility and config cloning tests
tests/unit/torch/export/test_postprocess.py
Validates _same_tensor semantics, fp8/uint8 view conversion roundtrip, and _shallow_copy_with_field_instantiation cloning behavior.
TP/PP model config splitting tests
tests/unit/torch/export/test_postprocess.py
Covers tensor-parallel splitting of column/row/embedding/expert configs and pipeline-parallel layer partitioning, including error/edge cases.
Full postprocess_model_config integration tests
tests/unit/torch/export/test_postprocess.py
Validates identity and combined TP/PP rank assignment with per-rank tensor partitioning.
Embedding/lm-head padding and quantization update tests
tests/unit/torch/export/test_postprocess.py
Verifies pad_embedding_lm_head padding behavior and update_lm_head_quantization enable/disable and block-size logic.
Weight shape validation and tensor postprocessing tests
tests/unit/torch/export/test_postprocess.py
Verifies check_weight_shape_valid recursive validation and postprocess_tensors dtype casting/contiguity/force-flag behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Suggested reviewers: shengliangxu

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the new export postprocess unit test suite and its TP/PP splitting focus.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns ✅ Passed PASS: The diff vs origin/main only touches a test file, and it contains none of the banned APIs or # nosec comments.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: arham766 <arhamislam766@yahoo.com>
@arham766

arham766 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into #1927 per maintainer feedback in #1902 — the suite was trimmed to only the lines codecov reports uncovered, with parametrization clusters deduplicated. Closing in favor of that PR.

@arham766 arham766 closed this Jul 6, 2026
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.

1 participant