Files
TheRock/rocm-libraries/shared/stinkytofu/tests/filecheck/region_clone_initc.stir
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

73 lines
3.6 KiB
Plaintext

# RUN: %stinkytofu-opt --arch gfx1250 %s --RegionClonePass --print-output
#
# RegionClonePass: in-pass clone of unrolled-loop iter0 into an initC stage
# with src C = 0 on each chain-head MFMA.
#
# Input shape (mirrors Tensile's gfx1250 unrolled loop):
# ^pre_loop : preamble (no clone trigger)
# ^label_LoopBeginL: the well-known unrolled-loop entry label emitted by
# Tensile's openLoop. In production CFGBuilder splits at LABEL
# instructions so the BB header equals the label name; the test
# authors that state directly. Contains a v[0:7] chain head, a
# second v[0:7] write (accumulates), then a v[8:15] chain head.
#
# The pass computes the region end in-pass: the boundary is the last chain
# head, i.e. the last MFMA whose src C (acc) first appears scanning forward
# from ^label_LoopBeginL (here the v[8:15] write). The scan is bounded by the
# loop back-edge (s_branch label_LoopBeginL), so the v[16:23] write in
# ^post_loop (after the back-edge) is NOT part of the region and is left alone.
#
# Expected after the pass:
# - A new cloned BB inserted physically before ^label_LoopBeginL, labeled
# ^label_InitCIterWmma_<origLabel>_<jobIdx>:.
# - The cloned BB's chain-head wmmas have src C rewritten to literal 0
# (one per unique src C acc); the second write to v[0:7] keeps its
# accumulator (it's no longer a chain head).
# - A new ^label_InitCIterWmma_target_0: BB created by splitBBAt; cloned
# tail ends with s_branch to it so first entry skips origin iter0.
# - The origin ^label_LoopBeginL's wmma chain is untouched (still accumulates).
#
# CHECKs use CHECK-LABEL to bind each scan window to a single BB. A cross-BB
# regression (e.g. pass accidentally rewriting origin's src C) fails on the
# right CHECK rather than being silently swallowed by an unbounded forward scan.
# CHECK-LABEL: @initc_iter0_clone
# === Pre-loop region: untouched preamble ===
# CHECK-LABEL: ^pre_loop:
# CHECK: s_mov_b32
# === Cloned region (granular): chain heads zeroed; 2nd v[0:7] keeps acc ===
# Anchor to the cloned BB and walk its body in order.
# CHECK-LABEL: ^label_InitCIterWmma_label_LoopBeginL_0:
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}, 0)
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}v[0:7])
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}, 0)
# CHECK: s_branch{{.*}}label_InitCIterWmma_target_0
# === Origin region: all 3 wmmas keep accumulators ==========================
# CHECK-LABEL: ^label_LoopBeginL:
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}v[0:7])
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}v[0:7])
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}v[8:15])
# === Target region: created by splitBBAt after the boundary; holds back-edge ===
# CHECK-LABEL: ^label_InitCIterWmma_target_0:
# CHECK: s_branch{{.*}}label_LoopBeginL
# === Post-loop region: after the back-edge, its new acc is left untouched ===
# CHECK-LABEL: ^post_loop:
# CHECK: v_wmma_f32_16x16x16_bf16{{.*}}v[16:23])
st.func @initc_iter0_clone() {
^pre_loop:
v0 = "st.s_mov_b32"(0) { issueCycles = 1, latencyCycles = 1 }
^label_LoopBeginL:
v[0:7] = "st.v_wmma_f32_16x16x16_bf16"(v[8:15], v[16:23], v[0:7]) { mod.mfma = { reuseA = false, reuseB = false } }
v[0:7] = "st.v_wmma_f32_16x16x16_bf16"(v[24:31], v[32:39], v[0:7]) { mod.mfma = { reuseA = false, reuseB = false } }
v[8:15] = "st.v_wmma_f32_16x16x16_bf16"(v[8:15], v[16:23], v[8:15]) { mod.mfma = { reuseA = false, reuseB = false } }
"st.s_branch"(label_LoopBeginL) { issueCycles = 1, latencyCycles = 1 }
^post_loop:
v[16:23] = "st.v_wmma_f32_16x16x16_bf16"(v[24:31], v[32:39], v[16:23]) { mod.mfma = { reuseA = false, reuseB = false } }
}