Skip to content

[gfx1250][optimization] qk norm rope quant optimization for gfx1250#4073

Closed
jli-melchior wants to merge 2 commits into
ROCm:mainfrom
jli-melchior:jli/gfx1250/qk_norm_opt
Closed

[gfx1250][optimization] qk norm rope quant optimization for gfx1250#4073
jli-melchior wants to merge 2 commits into
ROCm:mainfrom
jli-melchior:jli/gfx1250/qk_norm_opt

Conversation

@jli-melchior

Copy link
Copy Markdown
Contributor

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

jli-melchior and others added 2 commits July 2, 2026 02:10
Hoist scale-multiply before NOPE/ROPE branch to eliminate duplicate
computation, and skip FP8 underflow clamp on e4m3fn architectures
(gfx950/gfx1250) where 0x80 encodes -0, not NaN.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Store scaled values to rmem before the NOPE/ROPE branch. ROPE threads
load from rmem, apply cos/sin rotation, and write back. After the
branch, all threads read from rmem and issue a single full-width
coalesced store instead of two partial-width divergent stores.

The PromoteRegMemToVectorSSA pass automatically threads the rmem
state through scf.if yield, keeping SSA semantics correct.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@jli-melchior jli-melchior requested a review from a team July 3, 2026 09:08
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 4073 --add-label <label>

@jli-melchior jli-melchior force-pushed the jli/gfx1250/qk_norm_opt branch from 1b3513d to 4621442 Compare July 3, 2026 15:12
@Boss2002n Boss2002n force-pushed the jli/gfx1250/qk_norm_opt branch from 2910039 to 5597772 Compare July 4, 2026 04:50
# gfx942 ships e4m3fnuz (max_pos=240), gfx950+ ships OCP e4m3fn (max_pos=448).
# ``emit_mx_e8m0_scale`` uses this to pick the right ``max_pos`` reciprocal.
_fp8_mx_dtype = _D.FP8_E4M3_FNUZ if get_hip_arch() == "gfx942" else _D.FP8_E4M3
_is_fnuz = get_hip_arch() == "gfx942"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

_is_fnuz check _is_fnuz by tensor's DType intead of arch

Comment thread runperf-qknormrope-bf16.sh Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove this one before merge

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

@jli-melchior jli-melchior force-pushed the jli/gfx1250/qk_norm_opt branch from a3c7a24 to 4621442 Compare July 5, 2026 08:39
@zufayu zufayu requested a review from junhaha666 July 6, 2026 02:01
@jli-melchior

Copy link
Copy Markdown
Contributor Author

switch to PR #4089

@jli-melchior jli-melchior reopened this Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 4073 --add-label <label>

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