Skip to content

[Debug] Add AutoswitchGEmm for Debug Precision Tool#2883

Draft
shangxiaokang wants to merge 3 commits intoNVIDIA:mainfrom
shangxiaokang:autoswitch_gemm
Draft

[Debug] Add AutoswitchGEmm for Debug Precision Tool#2883
shangxiaokang wants to merge 3 commits intoNVIDIA:mainfrom
shangxiaokang:autoswitch_gemm

Conversation

@shangxiaokang
Copy link
Copy Markdown

@shangxiaokang shangxiaokang commented Apr 15, 2026

Description

Add AutoswitchGemm to Transformer Engine precision debug tools and integrate it into the TE debug quantization path.
This change introduces dynamic GEMM precision switching based on quantization quality metrics (underflow% / MSE), with same-iteration metric consumption, per-GEMM decisions, and dedicated autoswitch metric logs. It also updates TE debug wrappers to support dequantized-weight fallback paths needed by autoswitch behavior.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

  • Add new feature: transformer_engine.debug.features.autoswitch_gemm.AutoswitchGemm.
  • Support GEMM-level autoswitch decisions (fprop, dgrad, wgrad) using underflow_threshold_pct and mse_threshold.
  • Implement OR-style aggregation across monitored tensors and same-iteration metric consumption.
  • Add dedicated per-rank autoswitch logs under:
    nvdlfw_inspect_autoswitchgemm_logs/nvdlfw_inspect_globalrank-<rank>.log.
  • Add fp8-model-params handling:
    • block unsafe switching by default for fprop/dgrad,
    • allow configurable dequantized-weight fallback via
      allow_fp8_model_params_dequantized_weight.
  • Update debug quantization integration:
    • guard quantizer invocation by active rowwise/columnwise usage,
    • extend wrap_quantized_tensor(...) with dtype-aware dequantized fallback handling,
    • fix usage updates for separate rowwise/columnwise storage paths.
  • Update TE base module integration:
    • pass workspace_dtype into debug quantized weight wrapping.
  • Update docs:
    • register AutoswitchGemm in API feature docs,
    • add autoswitch user guide sections,
    • add docs/debug/autoswitch_gemm_example.yaml.

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@pggPL pggPL self-assigned this Apr 15, 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.

2 participants