Skip to content

fix(ck,ck_tile): microscale pipeline B and BQ layout mismatch & bug in mxfp conversion with float scale - #11560

Merged
JiaLuo-CAN merged 6 commits into
developfrom
users/jialuo/ck/aick_1884
Sep 11, 2026
Merged

JiaLuo-CAN merged 6 commits into
developfrom
users/jialuo/ck/aick_1884

Conversation

@JiaLuo-CAN

@JiaLuo-CAN JiaLuo-CAN commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Jira ID: AICK-1884
two bugs found in tests:
test_tile_gemm_quant_bquant_microscale_rcr_1d_64
test_tile_gemm_quant_bquant_microscale_crr_1d_64
test_tile_gemm_quant_bquant_microscale_rrr_1d_64
test_tile_gemm_quant_bquant_microscale_ccr_1d_64
test_tile_gemm_quant_bquant_microscale_rcr_1d_128
test_tile_gemm_quant_bquant_microscale_crr_1d_128
test_tile_gemm_quant_bquant_microscale_rrr_1d_128
test_tile_gemm_quant_bquant_microscale_ccr_1d_128
Two root causes:

  1. B is 16-bit and B is ColumnMajor (8 failures)
  2. B is PkFP4 (10 failures; every PkFP4 case fails)

Technical Details

fix for 1: BQuant tile distribution is hardcoded thread-raked while B on gfx1250 is warp-raked. Ask BQuant to check B's layout.
fix for 2: this is more general, the gfx1250 mx fp4 conversion use packed 4 scale. The pipeline is using legacy way of passing float scale. Fix the fp4 conversion with float scale. (fp8 has the same issue and similar fix.)
Caveat for fix2: The fix is for correctness. Using float scale for mx fp4 conversion is only for backward compatibility and is not an efficient approach. Fast approach/optimization is to use packed scale in the kernel/pipeline to better utilize the native conversion instruction.

Test Plan

Test Result

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/composablekernel/include/ck_tile/core/numeric/float8_ext.hpp, projects/composablekernel/include/ck_tile/core/numeric/pk_fp4.hpp, projects/composablekernel/include/ck_tile/ops/elementwise/unary_element_wise_operation.hpp, projects/composablekernel/include/ck_tile/ops/gemm_quant/pipeline/gemm_microscale_pipeline_ag_bg_cr_policy.hpp; no test file found
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

… FP8

fix clang format

fix clang format in ck examples and host utility headers

clang-format-18 requires a space before an empty function body following a
constructor initializer list. These nine files predate that and were failing
the repo-wide format CI stage.

Co-authored-by: Cursor <cursoragent@cursor.com>

revert clang-format spacing to match CI's clang-format-18

CI formats an empty function body following a constructor initializer list
as `){};` with no space, which is what develop uses. The locally installed
clang-format 18.1.8 produces `) {};` instead. Earlier commits followed the
local binary, so each one added more files to the CI format failure (1 file
at build #2, 2 at #3, 11 at #4). This restores develop's spacing on all 11
affected files; the ck_tile file keeps its gfx125 functional changes.

Co-authored-by: Cursor <cursoragent@cursor.com>

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 hardware-specific lane mapping and tile distributions require gfx1250 validation, but no test results were provided.

Pull request overview

Fixes gfx1250 microscale GEMM scale-layout alignment and float-scale conversion correctness.

Changes:

  • Aligns BQuant distribution with B’s warp/thread-raked layout.
  • Corrects per-lane FP4 and FP8 scaling.
  • Uses native packed FP4 vector conversions on gfx1250.
File summaries
File Description
gemm_microscale_pipeline_ag_bg_cr_policy.hpp Mirrors B access patterns for BQuant.
unary_element_wise_operation.hpp Uses gfx1250 FP4 vector conversions.
pk_fp4.hpp Adds per-lane FP4 scale selection.
float8_ext.hpp Corrects per-lane FP8 scale selection.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JiaLuo-CAN

Copy link
Copy Markdown
Contributor Author

Some changes according to the review comments:

  1. fp6 conversion has the similar issue and will be addressed in a follow-up change.
  2. Remove the related tests from the known-failure list so CI can run them.

@JiaLuo-CAN
JiaLuo-CAN requested a review from andriy-ca September 8, 2026 18:07

@andriy-ca andriy-ca 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.

LGTM!

@JiaLuo-CAN
JiaLuo-CAN merged commit 12a5962 into develop Sep 11, 2026
106 checks passed
@JiaLuo-CAN
JiaLuo-CAN deleted the users/jialuo/ck/aick_1884 branch September 11, 2026 14:54
assistant-librarian Bot pushed a commit to ROCm/composable_kernel that referenced this pull request Sep 11, 2026
fix(ck,ck_tile): microscale pipeline B and BQ layout mismatch
 & bug in mxfp conversion with float scale (#11560)

## Motivation

Jira ID: AICK-1884
two bugs found in tests:
  test_tile_gemm_quant_bquant_microscale_rcr_1d_64
  test_tile_gemm_quant_bquant_microscale_crr_1d_64
  test_tile_gemm_quant_bquant_microscale_rrr_1d_64
  test_tile_gemm_quant_bquant_microscale_ccr_1d_64
  test_tile_gemm_quant_bquant_microscale_rcr_1d_128
  test_tile_gemm_quant_bquant_microscale_crr_1d_128
  test_tile_gemm_quant_bquant_microscale_rrr_1d_128
  test_tile_gemm_quant_bquant_microscale_ccr_1d_128
Two root causes:
1. B is 16-bit and B is ColumnMajor (8 failures)
2. B is PkFP4 (10 failures; every PkFP4 case fails)

## Technical Details

fix for 1: BQuant tile distribution is hardcoded thread-raked while B on
gfx1250 is warp-raked. Ask BQuant to check B's layout.
fix for 2: this is more general, the gfx1250 mx fp4 conversion use
packed 4 scale. The pipeline is using legacy way of passing float scale.
Fix the fp4 conversion with float scale. (fp8 has the same issue and
similar fix.)
**Caveat for fix2:** The fix is for correctness. Using float scale for
mx fp4 conversion is only for backward compatibility and is not an
efficient approach. Fast approach/optimization is to use packed scale in
the kernel/pipeline to better utilize the native conversion instruction.
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants