Skip to content

refactor(rocke): deduplicate conv/attention emitter clone groups - #14078

Closed
AviralGoelAMD wants to merge 44 commits into
ROCm:developfrom
AviralGoelAMD:users/AviralGoelAMD/rocke/refactor-dedup-503f5c82876
Closed

AviralGoelAMD wants to merge 44 commits into
ROCm:developfrom
AviralGoelAMD:users/AviralGoelAMD/rocke/refactor-dedup-503f5c82876

Conversation

@AviralGoelAMD

Copy link
Copy Markdown
Contributor

Summary

Deduplicate verbatim-cloned statement blocks in the rocKE Python kernel emitters, discovered mechanically with clone_check --backlog against develop@503f5c82876 and extracted into private helpers.

29 clone groups fixed, all gated through ir_snapshot.py verify before commit — emitted IR is byte-identical to the pre-refactor baseline for every change.

Verification

  • ir_snapshot.py compare: IR IDENTICAL: 4522 verified entries byte-identical; 425 identical rejections (exit 0)
  • pytest library/tests platform/tests: before 344 failed, 61648 passed, 11995 skipped, after 344 failed, 61648 passed, 11995 skipped — identical failure set
  • junit_cmp.py: PYTEST SAME — identical case IDs, failing/erroring IDs, and skips
  • pytest exit code: 1 in both runs (pre-existing failures unchanged)

Extractions

Group Helper Copies
#75 _emit_direct_params_tuple 9
#177 _implicit_gemm_output_config 4
#281 _iu8_gemm_lane_and_acc (gfx1151 WMMA) 2
#489 _online_softmax_update 3
#854 _decode_staged_slot (loads) 3
#295 _c_lane_rows_cols 3
#1040 _declare_fmha_fwd_params 2
#1411 _wmma_lane_tile_setup 2
#686 _direct_dgrad_params_read 2
#804 _direct_wgrad_params 2
#1102 _conv_lds_dims 2
#1315 _direct_dgrad_params 2
#1332 _direct_conv_lane_setup 2
#1335 _conv_io_buffer_rsrcs 2
#1217 _fma_tap_load 2
#1326 _direct_conv_builder 4
#1317 _conv_lds_base 2
#1020 _direct_store_offset 2
#1215 _reorg_src_dst_off 2
#214 _direct_conv_h_loop_setup 3
#474 _direct_conv_h_loop_args 3
#528 _direct_conv_constants 3
#599 _direct_conv_q_constants 3
#652 _direct_conv_lane_head 2
#1232 _sparse_builder_setup 2
#646 _gemm_universal_c_lane 2
#267 _direct_flush_acc 3
#1195 _direct_conv_lane_s 2
#1214 _sparse_q_setup 2

Skips

196 distinct skip labels (219 pass-level rows; the ledger keys on the clone tool's per-pass numeric ID, not reconstructed content signatures). Breakdown: 165 too_small_after_alignment (shared run < 3 statements or < 6 lines), 16 gate_failed (IR gate failed after retry — reverted), 8 no_shared_home, 4 control_flow (shared run contains a def with return or spans a with boundary), 3 not_identical (literal-value differences). Six gate-failed groups (#131, #286, #658, #751, #807, #950) were reverted and remain unre-extracted.

Notes

  • Net −32 lines across 17 files (all under library/kernels/ and platform/python/rocke/).
  • The ml_dtypes module-not-found failures are pre-existing environment gaps, unchanged.
  • Draft PR — not for merge until reviewed.

…nv_direct_grouped.py (clone group #131)"

This reverts commit 526e5f2.
…es into rocke.helpers.geometry (clone group #286)"

This reverts commit 80a4037.
…nto _conv_implicit_gemm_common (clone group #658)"

This reverts commit 54dd61d.
… conv_implicit_gemm_dgrad.py (clone group #950)"

This reverts commit 33535a7.
…s in conv_direct_grouped.py (clone group #807)"

This reverts commit aef89f5.
…rom conv_direct_grouped.py (clone groups #1102, #1332)
… it from build_direct_conv_16c (clone group #1317)
…from conv_direct_grouped.py (clone groups #1020, #1215)
…es in conv_direct_grouped.py (clone group #474)
…m 3 copies in conv_direct_grouped.py (clone group #474)"

This reverts commit 4454298.
…_direct_grouped.py (clone group #474 rework)
@github-actions github-actions Bot added project: hip-kernel-provider rocke-lib: attention Touches rocKE library attention/FMHA kernels rocke: platform Touches rocKE platform labels Oct 20, 2026
@therock-pr-bot

therock-pr-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

⏳ Waiting on Required Checks

⏳ Required checks have not all concluded yet. This bot run is exiting without failing so those checks can report independently.

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: dnn-providers/hip-kernel-provider/rocke/library/kernels/common/_conv_implicit_gemm_common.py, dnn-providers/hip-kernel-provider/rocke/library/kernels/common/_fmha_common.py, dnn-providers/hip-kernel-provider/rocke/library/kernels/common/_fmha_warp_body.py, dnn-providers/hip-kernel-provider/rocke/library/kernels/common/conv_direct_grouped.py, dnn-providers/hip-kernel-provider/rocke/library/kernels/common/conv_direct_nongrouped.py (+12 more); no test file found
🔎 pre-commit ⏳ Pending ⏳ Still running…
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

⏳ Required checks are still running or have not started yet.
This PR is not ready for review until they complete.

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

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

⏳ Waiting for required checks to start or finish:

  • ⏳ pre-commit

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

Labels

organization: ROCm project: hip-kernel-provider rocke: platform Touches rocKE platform rocke-lib: attention Touches rocKE library attention/FMHA kernels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant