Skip to content

[MoE] [Bugfix] Give stage 1 only the padding columns its stage 2 skips - #7822

Open
eppaneamd wants to merge 4 commits into
mainfrom
eppaneamd/moe-v2-stage1-nopad
Open

eppaneamd wants to merge 4 commits into
mainfrom
eppaneamd/moe-v2-stage1-nopad

Conversation

@eppaneamd

@eppaneamd eppaneamd commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

get_2stage_cfgs now gives a tuned FlyDSL or Opus stage 1 only the padding columns its stage 2 skips, so stage 1
writes every column stage 2 reads. This fixes the NaN output of #6565 (its repro: NaN in 28 / 88 calls → 0).

Motivation

Given intermediate_pad, stage 1 leaves trailing columns of its torch.empty output and e8m0 scales unwritten, and
most stage 2s read them. An unwritten 0xFF e8m0 scale byte is NaN.

Kernel Columns written or read
FlyDSL stage 1 writes the unpadded width rounded up to tile_k // 2 (less for a small tile_n)
Opus stage 1 writes the unpadded width
v2 layout FlyDSL (flydsl_moe2_layout_*), CK stage 2 read every column
CK-Tile stage 2 skips whole 128-column blocks (k_pad_zeros)
v1 FlyDSL stage 2 skips whole 128-column blocks of its last K tile, at most the tile_k it runs with
Opus stage 2 reads the unpadded width

Affected tuned rows:

Source Key Real / padded columns Stage 2
#6565, DeepSeek-V4.1-Flash TP4 — 576 / 640 v2 layout
qwen3_5_397b_fp4_tuned_fmoe.csv, Qwen3.5-397B TP8, 16 rows (4096, 256, 512, 10) 128 / 256 v2 layout
minimax_m25_fp4_tuned_fmoe.csv, MiniMax-M2.x TP8, 16 rows (3072, 256, 256, 8) 192 / 256 CK at 1–8 tokens, v2 layout above

Callers and related PRs:

Changes

  • aiter/fused_moe.py, get_2stage_cfgs, the stage-1 inter_dim_pad:

    Stage 2 Before After
    Opus intermediate_pad intermediate_pad
    v1 FlyDSL intermediate_pad min(tile_k, intermediate_pad // 128 * 128), tile_k from resolve_flydsl_stage2_tile_k
    CK-Tile intermediate_pad intermediate_pad // 128 * 128
    v2 layout FlyDSL, CK intermediate_pad 0
    • Stage 1 computes the columns it is no longer given: zero from w1's zero padding, times w2's zero padding.
    • Rows bound with 0 run the stage-1 variant the tuner timed and the FlyDSL AOT prebuild compiles for tables without
      a pad column.
  • op_tests/test_moe_mxfp4_inter_dim_dispatch.py: test_padded_stage1_writes_the_columns_stage2_reads.

  • Not changed: kernel selection; calls without a pad; the untuned path (tile_n 128 stage 1, v1 stage 2).
    It gives stage 1 the full pad. At widths that are multiples of 128 its stage 1 still writes every column its
    stage 2 reads for any pad below 256 (derived from both grids, not run); 128 or 256 alignment never pads more.

  • With [FlyDSL] Fix and efficiently initialize A8W4 MoE stage1 padding #7796: a stage 1 whose epilogue would clear the pad (A8W4, interleaved gate/up, BF16 or FP16 output) computes
    those columns instead when stage 2 reads them.

Performance (if applicable)

Hardware Workload/configuration Before After Change
MI355X #6565 repro_min.py --rounds 8 (a8w4, inter_dim 640, pad 64) NaN in 28 / 88 calls 0 / 88 fixed
MI355X fused_moe, the 16 Qwen3.5-397B rows, 30 token counts non-finite in 30 / 30 0 / 30 GPU time 1.201×
MI355X fused_moe, the 16 MiniMax-M2.x rows, 30 token counts non-finite in 1 / 30 0 / 30 GPU time 0.997×

Setup:

  • [Issue]: a8w4 fused_moe writes NaN at small token counts on gfx950 (uninitialized padded scratch) #6565: lmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261109 (AITER 285579b62), as published and with a hunk that
    binds that row as this PR does.
  • fused_moe rows: the same AITER, MoE path as shipped (other patches outside it, [Triton/Gluon] [FlyDSL] [CI] [Bugfix] Never share scratch buffers whose zero fill was recorded into a graph #7126 among them); "after" with a
    hunk that binds these rows as this PR does (0 before their v2 layout and CK stage 2s).
  • Inputs: weights zero in their padding columns (gate, up and w2), as a padded inter_dim is served, quantized and
    shuffled with gemm_moe_tune.py's helpers; intermediate_pad = padded − real.
  • Token counts: each row's bucket count and the smallest count get_padded_M maps to it.
  • Non-finite: every Python-level torch.empty result inside fused_moe filled with 0xFF (NaN as bf16, fp8 e4m3fn
    and e8m0).
  • Time: GPU time per call (run_perftest), seeds 0–2; arms alternated twice in one container. Repeat-to-repeat
    geomean 1.000, per case 0.96–1.05.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

The change is internal to get_2stage_cfgs; no guide describes how it binds the stage-1 pad.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None for callers whose padding is zero. Where stage 1 now computes padding columns, w1's padding rows and their e8m0
scales must give finite values (zero weights; any scale byte but 0xFF), as w2's padding already had to be zero.

PR Self-Review

Reviewed revision

753b907f4d5366a698c7004b969c35373cbaa402

Behavior and intent

With intermediate_pad > 0, a tuned FlyDSL or Opus stage 1 leaves unwritten only the columns its stage 2 skips, so the
output no longer depends on what the allocator handed back. Rows with an Opus stage 2 keep the full pad; no key changes
kernels.

Validation and unverified scope

  • CPU: op_tests/test_moe_mxfp4_inter_dim_dispatch.py, 34 passed on this branch (main at 66ec1adad2).
    • With main's fused_moe.py: the 8 cases whose binding changes fail, 26 pass.
    • Binding mutations, each failing the test: no tile_k cap, CK-Tile 0, v1 FlyDSL the full pad, Opus 0; and for
      the tile_k resolution: none (fails the 384 case), a fixed 128, or resolved with the unpadded width (768).
    • Environment: vllm/vllm-openai-rocm:nightly-rocm100-083fbac021348c2c7af8a7bc71ba18199d0dd7a4, FlyDSL 0.5.0 from
      PyPI, GPU_ARCHS=gfx950.
  • GPU: the Performance runs on one MI355X, with AITER 285579b62 plus a hunk with this PR's bindings for the measured
    rows (all 0), not a build of main.
  • GPU, this head on a build of main 8c964fa61, with this branch's trees and the JIT modules built from them (one
    MI355X, every Python-level torch.empty in fused_moe filled with 0xFF, 1, 16 and 200 tokens), A4W4: 7 forced
    pairs, a v1 FlyDSL stage 2 at pads 64, 128 and 256, the v2 layout one at 64 and 128, the CK one at 64. The 4 whose
    stage 1 left columns its stage 2 reads unwritten are non-finite in every row before and in none after. The 3
    controls are finite in both, and their outputs before and after differ as much as repeated calls do.
  • Not run on a GPU: FlyDSL stage 1s other than A4W4 (A8W4, A8W8, BF16 activations) and the Opus stage 1; the A8W4
    ones are the tables' only FlyDSL or Opus stage 1s before a CK-Tile stage 2, so no CK-Tile stage 2 with a pad either;
    a v1 stage 2 at tile_k 256 (the 384-wide case runs at 128); an Opus stage 1 before a v2 stage 2 with a pad
    (main's 3 such rows are at inter_dim 2304 and 384, widths callers do not pad).

PR-specific question

What behavior each changed op test would fail on before this PR, and why existing tests do not cover it:

  • test_padded_stage1_writes_the_columns_stage2_reads fails on main in 8 of 9 cases (main passes the full pad):

    Stage 1 → stage 2 Pad Expected
    FlyDSL → v2 layout 64 0
    FlyDSL → CK 64 0
    Opus → v2 layout 64 0
    FlyDSL → CK-Tile 192 128
    FlyDSL → v1 FlyDSL (tile_k 128) 64, 256 0, 128
    FlyDSL → v1 FlyDSL (tile_k 256, inter_dim 384, runs as 128) 256 128
    FlyDSL → v1 FlyDSL (tile_k 256, inter_dim 768) 384 256
    FlyDSL → Opus (passes on main) 64 64
  • No other test asserts the stage-1 pad: the file's other tests check backend selection and the CK-Tile guard;
    op_tests/test_moe_2stage.py checks outputs, which depend on allocator contents.

Changed op tests

op_tests/test_moe_mxfp4_inter_dim_dispatch.py, test_padded_stage1_writes_the_columns_stage2_reads: the stage-1 pad
of a tuned FlyDSL or Opus stage 1 per stage-2 kind and pad (9 cases).

This change was developed with AI assistance (Claude); I reviewed every line and ran the tests listed.

🤖 Generated with Claude Code

Given intermediate_pad, get_2stage_cfgs binds a tuned FlyDSL or Opus
stage 1 with inter_dim_pad=intermediate_pad. The FlyDSL stage 1 then
launches tiles for the unpadded width rounded up to tile_k // 2 (fewer
for a small tile_n) and the Opus stage 1 writes exactly the unpadded
width; the rest of its torch.empty output stays unwritten. Most stage
2s read more: the v2 layout (flydsl_moe2_layout_*) and CK stage 2 read
every column, CK-Tile skips whole 128-column blocks (k_pad_zeros), and
the v1 FlyDSL stage 2 whole 128-column blocks of its last K tile. Only
the Opus stage 2 reads exactly the unpadded width. An unwritten 0xFF
e8m0 scale byte gives NaN (#6565).

Stage 1 now gets the trailing columns its stage 2 skips: the pad before
the Opus stage 2; the pad rounded down to 128 columns before CK-Tile,
and also capped at tile_k before the v1 FlyDSL stage 2; 0 before the
v2 layout and CK stage 2. It computes the other padding columns: zero
given w1's zero padding, multiplied by w2's zero padding in stage 2.

The test checks the stage-1 pad for each stage-2 kind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7822 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The stage-2 cap uses the registered tile size rather than the resolved size, so a 256-to-128 downgrade can make stage 2 read unwritten stage-1 data and produce NaNs; the dispatch test also needs coverage for this case.

1 open issue
What changed in this PR

This PR adjusts tuned two-stage MoE dispatch so stage 1 initializes the padded columns that stage 2 reads, addressing the uninitialized-data NaNs reported in #6565.

Changes:

  • Derives stage-1 padding from the selected stage-2 backend’s padding behavior.
  • Adds seven dispatch regression cases covering backend combinations and padding sizes.
File Description
op_tests/​test_moe_mxfp4_inter_dim_dispatch.py Adds assertions for stage-1 padding across stage-2 backends.
aiter/​fused_moe.py Adjusts padding passed to tuned FlyDSL and Opus stage-1 kernels.

Review effort: Balanced

Comment thread aiter/fused_moe.py Resolved
A v1 FlyDSL stage 2 runs with resolve_flydsl_stage2_tile_k(inter_dim,
tile_k), which lowers a tile_k of 256 to 128 when 256 does not divide
inter_dim, and it skips at most that many pad columns. The stage-1 pad
was capped at the registered tile_k, so at inter_dim 384 with a pad of
256 stage 1 left 256 columns unwritten while stage 2 read 128 of them.

The test adds that case (stage-1 pad 128) and one where the cap stays
256 (inter_dim 768, pad 384).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human runtime review is needed because GPU evidence does not cover the exact head or key padded dispatch paths, while the new tests verify only dispatch metadata.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@eppaneamd

Copy link
Copy Markdown
Contributor Author

GPU check of the padded dispatch paths on this head (cdfb589b08 over a build of main 8c964fa61, JIT modules built from these trees; one MI355X; A4W4; 1, 16 and 200 tokens; every Python-level torch.empty in fused_moe filled with 0xFF, so an unwritten value reads as NaN):

Stage 2 (forced pair) Padded / real inter_dim Stage-1 pad before → after Non-finite rows before → after
v1 FlyDSL, tile_k 128 256 / 192 64 → 0 all → 0
v1 FlyDSL, tile_k 256 resolved to 128 384 / 128 256 → 128 all → 0
v2 layout FlyDSL 256 / 128 128 → 0 all → 0
CK 256 / 192 64 → 0 all → 0
3 controls (pad unchanged, or stage 1 already covers what stage 2 reads) 0 → 0

The controls' outputs differ before vs after as much as repeated calls do. Not run: stage 1s other than A4W4 and Opus (so no CK-Tile stage 2 with a pad), and a v1 stage 2 at tile_k 256; details in the description's Validation section.

@eppaneamd
eppaneamd marked this pull request as ready for review November 16, 2026 16:40
@eppaneamd
eppaneamd requested a review from a team November 16, 2026 16:40
Copilot AI balanced review requested due to automatic review settings November 16, 2026 16:41
@aiter-bot

aiter-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 11d792f7f591 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The cross-backend MoE padding changes require human runtime review because no head-matched GPU validation is supplied for Opus stage 1, A8W4, and padded CK-Tile combinations.

No open issues 🎉

Review effort: Balanced

@zufayu
zufayu self-requested a review November 17, 2026 13:30
cpersson-amd added a commit to cpersson-amd/aiter that referenced this pull request Nov 18, 2026
…h-grid remap

ROCm#7796 was closed without merging; ROCm#7822 handles the stage-1 padding in
the dispatch instead. Drop its padding changes and tests, but keep the
remap over the launch grid: stage 1 launches tile2_pad more N columns
than the count the remap recomputed, so with intermediate_pad (DSv4.1
TP4: 576 + 64) an xcd_swizzle stage 1 left the padded columns unwritten.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Signed-off-by: Carl Persson <[email protected]>
@eppaneamd

Copy link
Copy Markdown
Contributor Author

Serving check on a key whose 16 tuned rows pad 128 columns and use a v2-layout stage 2 (amd/Qwen3.5-397B-A17B-MXFP4, TP8): without this PR's binding, 4 of 4 launches serve NaN logits (GSM8K 0/1319); with it, none do (GSM8K 0.96).

This is the PR's binding block, as on this head, applied to the image's aiter/fused_moe.py (AITER 285579b62), not a build of this head. fused_moe.py is the only file that differs between bound and unbound runs (sha256 checked per launch).

aiter/fused_moe.py Padded-call buffers filled with Launches NaN logits reported GSM8K
image – 4 4 of 4, all 8 ranks 0.0000 each
image 0xFF 1 1, all 8 ranks 0.0000
image 0x00 2 0 0.9659, 0.9666
+ binding – 4 0 0.9666, 0.9606, 0.9659 (3 of 4 ran it)
+ binding 0xFF 1 0 0.9583
+ binding 0x00 1 0 0.9621

GSM8K: 1319 questions, SE ≈ 0.005 per launch. Without the binding, all 1319 replies run to the 512-token limit with a ! tail.

  • One unbound launch followed another in the same container, with its kernels already built: not a cold-start effect.
  • Zeroing the buffers fixes the unbound file too, so the NaN comes from bytes its stage 1 leaves unwritten. Op level, this key's 16 rows at 30 token counts (1–32768): under 0xFF the unbound file is non-finite in 30/30 and the bound one in 0/30; under 0x00 their errors against a quantized reference agree to 0.9986–1.0015×.
  • [FlyDSL] MoE v2 stage 2: skip the inter_dim padding #7917 changes the same v2-layout case from the stage-2 side; as its description says, whichever lands second reconciles get_2stage_cfgs.
Setup
  • lmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261109 (SGLang 5325cfabd7, AITER 285579b62), 8 × MI355X.
  • amd/Qwen3.5-397B-A17B-MXFP4 @ edf0958bc3, TP8 with MTP: InferenceX qwen3.5/sglang/mi355x-fp4-mtp/agentic.yaml base, plus --max-running-requests 64 --cuda-graph-max-bs-decode 64 and SGLANG_SANITIZE_NAN_LOGITS=1 (reports NaN logits once per process).
  • MoE key: 512 experts, top-10, per-rank intermediate 128 padded to 256 (intermediate_pad 128); the image's 16 rows pair a FlyDSL A4W4 stage 1 with a flydsl_moe2_layout_* stage 2. Calls of ≤ 40 tokens run SGLang's gfx950 small-M kernel, not AITER, on both sides.
  • GSM8K: test split, 5-shot chat, temperature 0, max 512 tokens, thinking off.
  • Fill: a wrapper around aiter.fused_moe.fused_moe fills every CUDA torch.empty inside calls with intermediate_pad > 0.

Copilot AI balanced review requested due to automatic review settings November 20, 2026 13:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-backend GPU padding contracts warrant human review because added tests verify only dispatch, leaving finite padded-weight scales and key stage/dtype combinations without GPU validation.

No open issues 🎉

Review effort: Balanced

@msaffari-amd

Copy link
Copy Markdown
Contributor

There is a merge conflict with main in op_tests/test_moe_mxfp4_inter_dim_dispatch.py. Please rebase.

Comment on lines +266 to +273
(
dtypes.fp8,
INTER_DIM,
_FP8_STAGE1,
"opus_moe2_afp8_wfp4_atomic_t32x128x256_sbm32_occ1_cache_b2_ws2",
64,
64,
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On gfx942 this case fails: the Opus stage 2 is gfx950-only, so get_2stage_cfgs discards the tuned row ("Opus stage2 config unsupported (requires gfx950, got gfx942)") and meta.stage1.keywords["kernelName"] is ''. The file's _SKIP allows gfx942, and main's post-merge MI300X run includes this file, so it would go red there (we ran it on gfx942: 33/34 pass, only this case fails). Could you skip this case off gfx950?

Suggested change
(
dtypes.fp8,
INTER_DIM,
_FP8_STAGE1,
"opus_moe2_afp8_wfp4_atomic_t32x128x256_sbm32_occ1_cache_b2_ws2",
64,
64,
),
pytest.param(
dtypes.fp8,
INTER_DIM,
_FP8_STAGE1,
"opus_moe2_afp8_wfp4_atomic_t32x128x256_sbm32_occ1_cache_b2_ws2",
64,
64,
marks=pytest.mark.skipif(
get_gfx() != "gfx950", reason="the Opus stage 2 runs only on gfx950"
),
),

Comment thread aiter/fused_moe.py
Comment on lines +6222 to +6223
else:
stage1_inter_dim_pad = 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small suggestion: for a v2-layout stage 2 this makes stage 1 compute the padding, which the description measures at 1.13–1.32× fused_moe GPU time on the Qwen3.5-397B rows (256 columns instead of 128). #7917 changes the same v2-layout case in get_2stage_cfgs from the other side: the v2 stage 2 skips the padding, so stage 1 can skip it too and the NaN goes away without the extra work. It might be worth keeping pad 0 here only for the CK stage 2, and noting in the description that the v2-layout binding is a stopgap until a stage-2 skip lands.

Comment thread aiter/fused_moe.py
# output unwritten, so it gets only the columns its stage 2 skips: the Opus stage
# 2 reads the unpadded width, the v1 FlyDSL one skips whole 128-column blocks of
# the last K tile it runs with (resolve_flydsl_stage2_tile_k), CK-Tile whole
# 128-column blocks, and the v2 layout and CK ones read every column. Stage 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small suggestion: the bf16-activation v1 FlyDSL stage 2 (flydsl_moe2_abf16_*) never gets inter_dim_pad and reads every column (the a16w-mix branch of _flydsl_moe_stage2_impl), so "skips whole 128-column blocks" is not true for it. It is safe only because the stage 1s feeding it (the a16w port and the gfx942 _g942 a8w4 kernel) ignore the pad and tile the full width; here they just switch from torch.zeros to torch.empty for pads below 128. It might be worth saying so in the comment, so a later stage 1 that honors the pad does not bring the NaN back.

Suggested change
# 128-column blocks, and the v2 layout and CK ones read every column. Stage 1
# 128-column blocks, and the v2 layout and CK ones read every column. The
# bf16-activation v1 FlyDSL stage 2 reads every column too; its stage 1s ignore
# the pad and write the full width. Stage 1 computes the others: zero from w1's
# zero padding, times w2's zero padding.

@msaffari-amd

Copy link
Copy Markdown
Contributor

Nit: the PR Self-Review lists 753b907 as the reviewed revision, while the head is 11d792f (the self-review bot flags it). The "With #7796" bullet under Changes can also go, since #7796 was closed without merging.

This branch has not been deployed

No deployments
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.

4 participants