Repository navigation
Make FP8 weights compatible with older MCore version - #2342
Conversation
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Adds backward compatibility for older Megatron-Core versions by introducing a keep_columnwise parameter (default False) to cast_master_weights_to_fp8 and related helper functions.
Key Changes:
- When
keep_columnwise=False(default): Removes transpose/columnwise cache data, matching pre-PR #2266 behavior for older MCore versions that don't havepost_all_gather_processing - When
keep_columnwise=True: Preserves transpose/columnwise data, requiring users to manually callpost_all_gather_processingafter weight all-gather (new behavior from PR #2266) - All three scaling methods updated: delayed scaling (
_reset_caches), current scaling (_reset_caches), and blockwise scaling (update_usage) - Tests updated to validate both modes of operation
This prevents breaking changes for existing MCore users while allowing opt-in to the new CUDA Graph-compatible behavior.
Confidence Score: 4/5
- This PR is safe to merge with low risk, restoring backward compatibility while maintaining new functionality
- The implementation is straightforward and well-tested. The default behavior reverts to the pre-PR #2266 state, preventing breaking changes. Tests cover both modes. Score is 4 instead of 5 due to the nature of being a breaking change mitigation, requiring careful documentation and user awareness
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| transformer_engine/pytorch/tensor/utils.py | 4/5 | Added keep_columnwise parameter to restore backward compatibility with older MCore versions by defaulting to clearing transpose/columnwise data |
Sequence Diagram
sequenceDiagram
participant User as User/MCore
participant API as cast_master_weights_to_fp8
participant Helper as Helper Functions
participant Weights as Model Weights
Note over User,Weights: Old MCore Version Flow (keep_columnwise=False, default)
User->>API: cast_master_weights_to_fp8(weights, masters, offsets, group, keep_columnwise=False)
API->>Helper: _cast_master_weights_to_fp8_*_scaling(..., keep_columnwise=False)
Helper->>Weights: _reset_caches() or update_usage(columnwise_usage=False)
Note over Weights: Transpose/columnwise data removed
Helper-->>API: FP8 weights updated
API-->>User: Returns (no post-processing needed)
Note over User,Weights: New MCore Version Flow (keep_columnwise=True)
User->>API: cast_master_weights_to_fp8(weights, masters, offsets, group, keep_columnwise=True)
API->>Helper: _cast_master_weights_to_fp8_*_scaling(..., keep_columnwise=True)
Note over Helper,Weights: Skip cache reset/columnwise removal
Helper-->>API: FP8 weights updated (cache intact)
API-->>User: Returns
User->>User: post_all_gather_processing(weights)
Note over User: User manually creates transpose/columnwise data
1 file reviewed, no comments
Signed-off-by: kunlunl <kunlunl@nvidia.com>
9608eba to
17598ae
Compare
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR restores backward compatibility with older MCore versions that cannot call post_all_gather_processing. The main change adds a keep_columnwise flag (default False) to cast_master_weights_to_fp8 that controls whether transpose/columnwise data is retained after casting.
Key changes:
- When
keep_columnwise=False(default), the function resets transpose caches and clears columnwise data, restoring pre-PR-2266 behavior - When
keep_columnwise=True, transpose/columnwise data is preserved, but users must manually callpost_all_gather_processingafter weight all-gather - Test coverage expanded to validate both modes across all quantization types (fp8, fp8_cs, fp8_block)
The implementation correctly handles the three quantization paths (delayed scaling, current scaling, blockwise) by conditionally calling _reset_caches() or update_usage(columnwise_usage=False) based on the flag.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk - it's a well-designed backward compatibility fix
- The implementation is clean, well-tested, and follows a conservative approach. The default behavior restores compatibility with older systems, while the opt-in flag preserves new functionality. Comprehensive test coverage validates both modes across all quantization types.
- No files require special attention - all changes are straightforward and well-implemented
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| transformer_engine/pytorch/tensor/utils.py | 5/5 | Adds keep_columnwise parameter (default False) to control whether transpose/columnwise data is retained; when False, resets caches to restore pre-PR-2266 behavior for backward compatibility with older MCore |
| tests/pytorch/distributed/run_cast_master_weights_to_fp8.py | 5/5 | Updates test harness to support keep_columnwise flag throughout optimizer implementations; conditionally calls post_all_gather_processing only when flag is True |
| tests/pytorch/distributed/test_cast_master_weights_to_fp8.py | 5/5 | Adds keep_columnwise parameter to test matrix, running all tests with both True and False to ensure backward compatibility and new functionality both work correctly |
Sequence Diagram
sequenceDiagram
participant User as Older MCore/User
participant Optimizer as ZeRO/FSDP Optimizer
participant CMWF as cast_master_weights_to_fp8
participant ModelWeight as FP8 Model Weight
participant PAG as post_all_gather_processing
Note over User,PAG: Default behavior (keep_columnwise=False)
User->>Optimizer: Initialize with keep_columnwise=False
Optimizer->>CMWF: cast_master_weights_to_fp8(..., keep_columnwise=False)
CMWF->>ModelWeight: _reset_caches() or update_usage(columnwise=False)
Note over ModelWeight: Transpose/columnwise data removed
CMWF-->>Optimizer: Returns (no transpose/columnwise data)
Optimizer->>Optimizer: all_gather weights
Note over PAG: post_all_gather_processing NOT called
Note over User: Compatible with older MCore
Note over User,PAG: New behavior (keep_columnwise=True)
User->>Optimizer: Initialize with keep_columnwise=True
Optimizer->>CMWF: cast_master_weights_to_fp8(..., keep_columnwise=True)
Note over CMWF: Skip _reset_caches()/update_usage()
Note over ModelWeight: Transpose/columnwise data preserved
CMWF-->>Optimizer: Returns (with transpose/columnwise data)
Optimizer->>Optimizer: all_gather weights
Optimizer->>PAG: post_all_gather_processing(quantized_weights)
PAG->>ModelWeight: _create_transpose() or _create_columnwise()
Note over User: Requires calling post_all_gather_processing
3 files reviewed, no comments
| keep_columnwise: bool. If True, keep the columnwise data of model weights, and the | ||
| post_all_gather_processing function must be called manually by user after the | ||
| weights all-gather. Default is False. |
There was a problem hiding this comment.
| keep_columnwise: bool. If True, keep the columnwise data of model weights, and the | |
| post_all_gather_processing function must be called manually by user after the | |
| weights all-gather. Default is False. | |
| keep_columnwise: bool, default = `False` | |
| If True, keep the columnwise data of model weights, and the | |
| post_all_gather_processing function must be called manually by user after the | |
| weights all-gather. Default is False. |
| start_offsets, | ||
| group, | ||
| fsdp_shard_model_weights=None, | ||
| keep_columnwise=False, |
There was a problem hiding this comment.
This name is not quite correct. If we generalize to MXFP8 and NVFP4, it would be wrong to deallocate the column-wise data when keep_columnwise=False. This arg isn't really about column-wise data, but whether we need to post-process after the AG. Maybe a name like with_post_all_gather_processing would make this contract more explicit.
There was a problem hiding this comment.
OK. I've changed the name to manual_post_all_gather_processing, does it sound good to you? I kind of feel with_post_all_gather_processing is a bit ambiguous to me.
| @pytest.mark.parametrize("quantization", ["fp8", "fp8_cs", "fp8_block"]) | ||
| def test_cast_master_weights_to_fp8(quantization): | ||
| @pytest.mark.parametrize("keep_columnwise", [False, True]) |
There was a problem hiding this comment.
Not critical yet, but as we add test cases we should consider reorganizing the distributed launches. Each call to torchrun takes ~seconds. If we have many test cases, it's better to call torchrun once and perform multiple tests within the same session.
See distributed/test_fusible_ops.py for an example where we only launch parallel jobs a few times:
TransformerEngine/tests/pytorch/distributed/test_fusible_ops.py
Lines 1043 to 1044 in 0e80c84
Within each job, we run many test cases:
There was a problem hiding this comment.
I refactored cast_master_weights_to_fp8.py based on the structure of test_fusible_ops.py:
- Now,
torchrunis only launched once, with different test cases executed internally via a for loop. - The
run_cast_master_weights_to_fp8.pyandtest_cast_master_weights_to_fp8.pyhave been merged, with only latter one retained.
…e unit test Signed-off-by: kunlunl <kunlunl@nvidia.com>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Restores backward compatibility with older MCore versions by changing the default behavior of cast_master_weights_to_fp8 to automatically clear transpose/columnwise caches (matching pre-PR #2266 behavior). Adds new manual_post_all_gather_processing parameter (default=False) to allow users to opt-in to manual cache management when needed.
Key Changes:
- Added
manual_post_all_gather_processingparameter tocast_master_weights_to_fp8and its three helper functions - When False (default), automatically calls
_reset_caches()for delayed/current scaling orupdate_usage(rowwise_usage=True, columnwise_usage=False)for blockwise scaling - When True, users must explicitly call
post_all_gather_processing()after weights are gathered - Consolidated test implementation from separate file into main test file with comprehensive coverage for both modes
- Tests verify both MiniZero_1 (ZeRO-1) and MiniFSDP (FSDP) optimizer patterns with all three FP8 scaling types
Confidence Score: 4/5
- Safe to merge with proper documentation of the breaking change for users who may have adapted to PR #2266 behavior
- The implementation correctly restores backward compatibility and is well-tested. The default behavior now matches pre-PR #2266, preventing issues with older MCore versions. Comprehensive tests cover both manual and automatic post-processing modes across all scaling types. The only concern is that users who adapted to PR #2266 behavior need to explicitly set manual_post_all_gather_processing=True
- No files require special attention - changes are straightforward and well-tested
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| transformer_engine/pytorch/tensor/utils.py | 4/5 | Added manual_post_all_gather_processing parameter (default=False) to restore backward compatibility by automatically clearing transpose/columnwise caches unless explicitly requested by user |
| tests/pytorch/distributed/test_cast_master_weights_to_fp8.py | 5/5 | Moved test implementation from separate file and added comprehensive test coverage for both manual_post_all_gather_processing modes |
| tests/pytorch/distributed/run_cast_master_weights_to_fp8.py | 5/5 | File deleted - test implementation consolidated into test_cast_master_weights_to_fp8.py |
Sequence Diagram
sequenceDiagram
participant User as User/Optimizer
participant CMW as cast_master_weights_to_fp8
participant Helper as _cast_*_scaling
participant Weight as FP8 Weight
participant Cache as Transpose/Columnwise Cache
User->>CMW: Call with manual_post_all_gather_processing flag
alt manual_post_all_gather_processing=False (default)
CMW->>Helper: Pass flag=False
Helper->>Cache: Clear caches (_reset_caches or update_usage)
Note over Cache: Automatic cleanup<br/>Compatible with old MCore
Helper->>Weight: Update FP8 data
Helper->>CMW: Return
CMW->>User: Complete
Note over User: Forward pass auto-creates caches
else manual_post_all_gather_processing=True
CMW->>Helper: Pass flag=True
Helper->>Weight: Update FP8 data (preserve caches)
Helper->>CMW: Return
CMW->>User: Complete
User->>User: Call post_all_gather_processing()
Note over User: User controls cache creation timing
end
3 files reviewed, no comments
Signed-off-by: kunlunl <kunlunl@nvidia.com>
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Adds backward compatibility for older MCore versions by changing cast_master_weights_to_fp8() default behavior to remove transpose/columnwise data (reverting PR #2266 behavior) and introducing a manual_post_all_gather_processing flag for users who want to manually call post_all_gather_processing().
Key Changes:
- Added
manual_post_all_gather_processingparameter (defaultFalse) tocast_master_weights_to_fp8() - When
False(default): automatically resets transpose cache (delayed/current scaling) or clears columnwise data (blockwise scaling) - compatible with older MCore - When
True: skips automatic cache/data cleanup, requiring users to manually callpost_all_gather_processing()after all-gather operations - Test file consolidated from separate script into single file with both modes tested
- Tests cover ZeRO-1 and FSDP patterns with delayed scaling, current scaling, and blockwise scaling
Confidence Score: 5/5
- Safe to merge - well-designed backward compatibility fix with comprehensive test coverage
- Implementation correctly restores pre-#2266 behavior as default while providing opt-in flag for new functionality. All three scaling modes properly handle the flag. Tests thoroughly validate both code paths.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| transformer_engine/pytorch/tensor/utils.py | 5/5 | Added manual_post_all_gather_processing parameter to restore backward compatibility; implementation correctly conditionalizes cache reset/columnwise data cleanup |
| tests/pytorch/distributed/test_cast_master_weights_to_fp8.py | 5/5 | Consolidated test file with comprehensive coverage for both old (default) and new (manual) post-processing modes across ZeRO-1 and FSDP patterns |
Sequence Diagram
sequenceDiagram
participant User as User/Optimizer
participant Cast as cast_master_weights_to_fp8()
participant PostProc as post_all_gather_processing()
participant Weight as FP8 Weight
alt manual_post_all_gather_processing=False (default)
User->>Cast: Cast master weights to FP8
Cast->>Weight: Reset transpose cache / Clear columnwise
Cast-->>User: Return (compatible with old MCore)
Note over User: All-gather happens
Note over Weight: Forward auto-creates cache/columnwise
else manual_post_all_gather_processing=True (new mode)
User->>Cast: Cast master weights to FP8
Note over Cast: Skip cache/columnwise cleanup
Cast-->>User: Return (data retained)
Note over User: All-gather happens
User->>PostProc: Manually call post processing
PostProc->>Weight: Create transpose / Create columnwise
PostProc-->>User: Return
end
2 files reviewed, no comments
|
/te-ci pytorch L1 |
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR addresses backward compatibility with older MCore versions by adding a manual_post_all_gather_processing flag to cast_master_weights_to_fp8().
Key Changes:
- Added
manual_post_all_gather_processingparameter (default:False) to control when transpose/columnwise cache data is cleared - When
False: automatically resets caches duringcast_master_weights_to_fp8()(backward-compatible behavior) - When
True: users must manually callpost_all_gather_processing()after all-gather operations - Tests refactored: moved from separate script to inline implementation, now covering both flag modes
- Maintains consistency with pre-PR #2266 behavior by default while supporting advanced use cases
Impact:
This resolves the breaking change introduced in PR #2266 where post_all_gather_processing() was required but older MCore couldn't call it. The default behavior now matches the old API contract.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are well-designed and maintain backward compatibility. The new flag has a sensible default (
False) that restores pre-#2266 behavior, preventing breaking changes for older MCore versions. The implementation correctly propagates the flag through all three scaling methods (delayed, current, blockwise) and tests comprehensively cover both modes. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| transformer_engine/pytorch/tensor/utils.py | 5/5 | Added manual_post_all_gather_processing parameter with proper default behavior, correctly restoring cache reset logic when flag is False |
| tests/pytorch/distributed/test_cast_master_weights_to_fp8.py | 5/5 | Comprehensive test refactoring with proper coverage of both manual and automatic post-processing modes |
| tests/pytorch/distributed/run_cast_master_weights_to_fp8.py | 5/5 | File deleted - test implementation moved inline to test file |
Sequence Diagram
sequenceDiagram
participant User as User/Optimizer
participant CMWF as cast_master_weights_to_fp8
participant Helper as _cast_*_scaling
participant Weight as FP8 Weight
participant Post as post_all_gather_processing
Note over User,Post: Default Mode (manual_post_all_gather_processing=False)
User->>CMWF: call with master_weights
CMWF->>Helper: pass manual_post_all_gather_processing=False
Helper->>Weight: _reset_caches() / update_usage(columnwise=False)
Helper->>Weight: update quantized weights
Helper-->>CMWF: return
CMWF-->>User: return
Note over User: Cache cleared automatically<br/>Compatible with old MCore
Note over User,Post: Manual Mode (manual_post_all_gather_processing=True)
User->>CMWF: call with manual_post_all_gather_processing=True
CMWF->>Helper: pass manual_post_all_gather_processing=True
Note over Helper,Weight: Skip cache reset
Helper->>Weight: update quantized weights only
Helper-->>CMWF: return
CMWF-->>User: return
Note over User: Perform all-gather operation
User->>Post: call post_all_gather_processing(weights)
Post->>Weight: _create_transpose() / _create_columnwise()
Post-->>User: return
Note over User: Advanced control for<br/>CUDA Graph / overlapping
3 files reviewed, no comments
* Make cast_master_weights_to_fp8 compatible with older MCore version Signed-off-by: kunlunl <kunlunl@nvidia.com> * Rename keep_columnwise to manual_post_all_gather_processing & Optimize unit test Signed-off-by: kunlunl <kunlunl@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove redundant _test_mini_optimizer() Signed-off-by: kunlunl <kunlunl@nvidia.com> --------- Signed-off-by: kunlunl <kunlunl@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com>
* [Common] Deleted unused header (#2324) Deleted unused header Signed-off-by: Oleg Goncharov <ogoncharov@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] L1_jax_distributed_test suit with individual executions (#2321) * L1 rework Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> * comment out test_multi_process_grouped_gemm for now Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> * rm e5m2 from test norm + MXFP8 Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> --------- Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * for branch Signed-off-by: Peter Dykas <wdykas@nvidia.com> * clean up and tests Signed-off-by: Peter Dykas <wdykas@nvidia.com> * change tests Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [PyTorch debug] Fixes to debug tests failures (#2268) * code drop Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix: Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [PyTorch Debug] Add max_blockwise_dynamic_range stats (#2137) * code drop Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Fix bug with pre scale bias (#2300) * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Try to use pre-downloaded dataset artifacts first (#2345) * Try to use pre-downloaded dataset artifacts first Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * Set HF_HUB_OFFLINE to disable any network calls to HF when the pre-downloaded dataset is available Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> --------- Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Fix out of bounds access in the FP4 dequantize kernel (#2346) Signed-off-by: Przemek Tredak <ptredak@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Make FP8 weights compatible with older MCore version (#2342) * Make cast_master_weights_to_fp8 compatible with older MCore version Signed-off-by: kunlunl <kunlunl@nvidia.com> * Rename keep_columnwise to manual_post_all_gather_processing & Optimize unit test Signed-off-by: kunlunl <kunlunl@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove redundant _test_mini_optimizer() Signed-off-by: kunlunl <kunlunl@nvidia.com> --------- Signed-off-by: kunlunl <kunlunl@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Add test to check jaxpr that amax is reused for nvfp4 recipe (#2348) * Add test to check jaxpr that amax is reused for nvfp4 recipe Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * Move test to test_helper.py and rename file Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Fix sharding of segment position to match id in ring attention. (#2349) Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Disable cuDNN attention for known IMA and NaNs (#2344) * Fix cuDNN backend selection for more case. Add CG as a option as well Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * fix logic Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Fix cuDNN checks Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Add more checks Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Fix cuddn version Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Fix error message Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Add check for window size Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> --------- Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Default to fused attention in JAX DPA (#2363) * Default to fused attention in JAX DPA Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com> * Consolidate documentation for DPA in JAX Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> * Correctly update the documentation for defaults in JAX DPA Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> --------- Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Update cudnn frontend to v1.16.0 (#2362) Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [common] Remove kvpacked and qkvpacked attention functions for every kernel type. (#2287) * code drop Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * depracted compile time warning + \warning -> \deprecated Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Move Triton to common (#2359) * move triton to common and change paths Signed-off-by: tdophung <tdophung@nvidia.com> * Formatting Signed-off-by: tdophung <tdophung@nvidia.com> --------- Signed-off-by: tdophung <tdophung@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Fused layers argument default values changed (#2347) * Changing default activations in MLP, TransformerLayer, dropout rate after FC1 to 0, and return_layernorm_output to False Signed-off-by: tdophung <tdophung@nvidia.com> * Fixing the failing tests by hard coding arguments to the previous values instead of relying on newer default values Signed-off-by: tdophung <tdophung@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: tdophung <tdophung@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * remove comment from gpt Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor changes for num_splits logic Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * replace None with 1 as default Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix last commit Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * fix docstring Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * fix dtype in pack/unpack when FP8 Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * add fused_attn_supported constraint for some tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * update FA3 installation commands Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * update FA3 installation commands in DPA Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * separate fused fp8 and f16 flags in tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * initialize fused_attn_supported_f16 Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * fix FA installation in L3 tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> --------- Signed-off-by: Oleg Goncharov <ogoncharov@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Signed-off-by: Przemek Tredak <ptredak@nvidia.com> Signed-off-by: kunlunl <kunlunl@nvidia.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> Signed-off-by: tdophung <tdophung@nvidia.com> Co-authored-by: Oleg Goncharov <64355998+Oleg-Goncharov@users.noreply.github.com> Co-authored-by: Phuong Nguyen <phuonguyen@nvidia.com> Co-authored-by: root <root@gpu-h100-0496.cm.cluster> Co-authored-by: Peter Dykas <wdykas@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Paweł Gadziński <62263673+pggPL@users.noreply.github.com> Co-authored-by: jberchtold-nvidia <158520091+jberchtold-nvidia@users.noreply.github.com> Co-authored-by: Przemyslaw Tredak <ptredak@nvidia.com> Co-authored-by: Kunlun Li <94586211+kunlunl@users.noreply.github.com> Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Co-authored-by: Michael Goldfarb <mgoldfarb@nvidia.com> Co-authored-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Co-authored-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Teddy Do <tdophung@nvidia.com> Co-authored-by: wdykas <73254672+wdykas@users.noreply.github.com>
* [Common] Deleted unused header (#2324) Deleted unused header Signed-off-by: Oleg Goncharov <ogoncharov@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] L1_jax_distributed_test suit with individual executions (#2321) * L1 rework Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> * comment out test_multi_process_grouped_gemm for now Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> * rm e5m2 from test norm + MXFP8 Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> --------- Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * for branch Signed-off-by: Peter Dykas <wdykas@nvidia.com> * clean up and tests Signed-off-by: Peter Dykas <wdykas@nvidia.com> * change tests Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [PyTorch debug] Fixes to debug tests failures (#2268) * code drop Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix: Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [PyTorch Debug] Add max_blockwise_dynamic_range stats (#2137) * code drop Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Fix bug with pre scale bias (#2300) * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Try to use pre-downloaded dataset artifacts first (#2345) * Try to use pre-downloaded dataset artifacts first Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * Set HF_HUB_OFFLINE to disable any network calls to HF when the pre-downloaded dataset is available Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> --------- Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Fix out of bounds access in the FP4 dequantize kernel (#2346) Signed-off-by: Przemek Tredak <ptredak@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Make FP8 weights compatible with older MCore version (#2342) * Make cast_master_weights_to_fp8 compatible with older MCore version Signed-off-by: kunlunl <kunlunl@nvidia.com> * Rename keep_columnwise to manual_post_all_gather_processing & Optimize unit test Signed-off-by: kunlunl <kunlunl@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove redundant _test_mini_optimizer() Signed-off-by: kunlunl <kunlunl@nvidia.com> --------- Signed-off-by: kunlunl <kunlunl@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Add test to check jaxpr that amax is reused for nvfp4 recipe (#2348) * Add test to check jaxpr that amax is reused for nvfp4 recipe Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * Move test to test_helper.py and rename file Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Fix sharding of segment position to match id in ring attention. (#2349) Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Disable cuDNN attention for known IMA and NaNs (#2344) * Fix cuDNN backend selection for more case. Add CG as a option as well Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * fix logic Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Fix cuDNN checks Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Add more checks Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Fix cuddn version Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Fix error message Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Add check for window size Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> --------- Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Default to fused attention in JAX DPA (#2363) * Default to fused attention in JAX DPA Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com> * Consolidate documentation for DPA in JAX Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> * Correctly update the documentation for defaults in JAX DPA Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> --------- Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Update cudnn frontend to v1.16.0 (#2362) Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [common] Remove kvpacked and qkvpacked attention functions for every kernel type. (#2287) * code drop Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * depracted compile time warning + \warning -> \deprecated Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * Move Triton to common (#2359) * move triton to common and change paths Signed-off-by: tdophung <tdophung@nvidia.com> * Formatting Signed-off-by: tdophung <tdophung@nvidia.com> --------- Signed-off-by: tdophung <tdophung@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [JAX] Fused layers argument default values changed (#2347) * Changing default activations in MLP, TransformerLayer, dropout rate after FC1 to 0, and return_layernorm_output to False Signed-off-by: tdophung <tdophung@nvidia.com> * Fixing the failing tests by hard coding arguments to the previous values instead of relying on newer default values Signed-off-by: tdophung <tdophung@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: tdophung <tdophung@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> * remove comment from gpt Signed-off-by: Peter Dykas <wdykas@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor changes for num_splits logic Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * replace None with 1 as default Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix last commit Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * fix docstring Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * fix dtype in pack/unpack when FP8 Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * add fused_attn_supported constraint for some tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * update FA3 installation commands Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * update FA3 installation commands in DPA Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * separate fused fp8 and f16 flags in tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * initialize fused_attn_supported_f16 Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> * fix FA installation in L3 tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> --------- Signed-off-by: Oleg Goncharov <ogoncharov@nvidia.com> Signed-off-by: Peter Dykas <wdykas@nvidia.com> Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com> Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Signed-off-by: Przemek Tredak <ptredak@nvidia.com> Signed-off-by: kunlunl <kunlunl@nvidia.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com> Signed-off-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com> Signed-off-by: tdophung <tdophung@nvidia.com> Co-authored-by: Oleg Goncharov <64355998+Oleg-Goncharov@users.noreply.github.com> Co-authored-by: Phuong Nguyen <phuonguyen@nvidia.com> Co-authored-by: root <root@gpu-h100-0496.cm.cluster> Co-authored-by: Peter Dykas <wdykas@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Paweł Gadziński <62263673+pggPL@users.noreply.github.com> Co-authored-by: jberchtold-nvidia <158520091+jberchtold-nvidia@users.noreply.github.com> Co-authored-by: Przemyslaw Tredak <ptredak@nvidia.com> Co-authored-by: Kunlun Li <94586211+kunlunl@users.noreply.github.com> Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Co-authored-by: Michael Goldfarb <mgoldfarb@nvidia.com> Co-authored-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Co-authored-by: Kshitij Lakhani <33047503+KshitijLakhani@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Teddy Do <tdophung@nvidia.com> Co-authored-by: wdykas <73254672+wdykas@users.noreply.github.com>
* Make cast_master_weights_to_fp8 compatible with older MCore version Signed-off-by: kunlunl <kunlunl@nvidia.com> * Rename keep_columnwise to manual_post_all_gather_processing & Optimize unit test Signed-off-by: kunlunl <kunlunl@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove redundant _test_mini_optimizer() Signed-off-by: kunlunl <kunlunl@nvidia.com> --------- Signed-off-by: kunlunl <kunlunl@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
Description
The old MCore version cannot call the
post_all_gather functionintransformer_engine/pytorch/tensor/utils.py. This MR modifies the default behavior ofcast_master_weights_to_fp8back to remove transpose/columnwise data (making it consistent with before #2266 is merged), and adds a flag to manually enable retaining transpose/columnwise data. This prevents users from unknowingly invoking the newcast_master_weights_to_fp8without manually callingpost_all_gather_processing.Type of change
Changes
cast_master_weights_to_fp8back to remove transpose/columnwise data (making it consistent with before Add post-processing API for FP8 primary weights to support CUDA Graph #2266 is merged)Checklist: