Files
TheRock/compiler/amd-llvm/amd/comgr/test-lit/hotswap/rewriter/hotswap-trampoline-ds-pipelined.s
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

128 lines
3.5 KiB
ArmAsm

// COM: Test HotSwap trampoline patch: each ds_*_2addr_* split is followed by
// COM: a local s_wait_dscnt 0x0 drain so both split halves complete before any
// COM: downstream consumer. An existing non-drain wait (s_wait_dscnt 0x1) is
// COM: left untouched -- the split's own drain provides the ordering, so the
// COM: downstream wait must NOT be relaxed (relaxing it would let a consumer
// COM: read a not-yet-landed half; see the patchDs2Addr rationale).
// RUN: %clang -target amdgcn-amd-amdhsa -mcpu=gfx1250 -nostdlib %s -o %t.elf
// RUN: hotswap-rewrite %t.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250 amdgcn-amd-amdhsa--gfx1250 \
// RUN: --output %t.out.elf \
// RUN: | %FileCheck --check-prefix=API %s
// API: RESULT: SUCCESS
// RUN: %llvm-objdump -d %t.out.elf | %FileCheck --check-prefix=DISASM %s
// COM: Kernel 1 (single split): one DS2 -> two single-address loads followed
// COM: by an s_wait_dscnt 0x0 drain; the downstream s_wait_dscnt 0x1 is left
// COM: unchanged.
// DISASM-LABEL: <test_ds_pipelined_single>:
// DISASM-NOT: ds_load_2addr_stride64_b32
// DISASM: s_branch
// DISASM: s_wait_dscnt 0x1
// DISASM: ds_load_b32 v0
// DISASM: ds_load_b32 v1
// DISASM: s_wait_dscnt 0x0
// DISASM: s_branch
// COM: Kernel 2 (two splits): each split lands its own s_wait_dscnt 0x0 drain;
// COM: the shared downstream s_wait_dscnt 0x1 is left unchanged.
// DISASM-LABEL: <test_ds_pipelined_multi>:
// DISASM-NOT: ds_load_2addr_stride64_b32
// DISASM: s_branch
// DISASM: s_branch
// DISASM: s_wait_dscnt 0x1
// DISASM: ds_load_b32 v0
// DISASM: ds_load_b32 v1
// DISASM: s_wait_dscnt 0x0
// DISASM: ds_load_b32 v2
// DISASM: ds_load_b32 v3
// DISASM: s_wait_dscnt 0x0
// COM: Idempotency: a second rewrite produces identical bytes (the 2-addr
// COM: forms are gone, so there is nothing left to split).
// RUN: hotswap-rewrite %t.out.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250 amdgcn-amd-amdhsa--gfx1250 \
// RUN: --check-idempotent \
// RUN: | %FileCheck --check-prefix=IDEM %s
// IDEM: IDEMPOTENT: YES
// ---- Kernel 1: single split + drain; downstream 0x1 wait preserved ----------
.amdgcn_target "amdgcn-amd-amdhsa--gfx1250"
.text
.globl test_ds_pipelined_single
.p2align 8
.type test_ds_pipelined_single,@function
test_ds_pipelined_single:
ds_load_2addr_stride64_b32 v[0:1], v2 offset0:1 offset1:3
s_wait_dscnt 0x1
s_endpgm
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
.Ltest_ds_pipelined_single_end:
.size test_ds_pipelined_single, .Ltest_ds_pipelined_single_end-test_ds_pipelined_single
// ---- Kernel 2: two splits, each + drain; downstream 0x1 wait preserved ------
.globl test_ds_pipelined_multi
.p2align 8
.type test_ds_pipelined_multi,@function
test_ds_pipelined_multi:
ds_load_2addr_stride64_b32 v[0:1], v4 offset0:0 offset1:1
ds_load_2addr_stride64_b32 v[2:3], v4 offset0:2 offset1:3
s_wait_dscnt 0x1
s_endpgm
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
s_nop 0
.Ltest_ds_pipelined_multi_end:
.size test_ds_pipelined_multi, .Ltest_ds_pipelined_multi_end-test_ds_pipelined_multi
.rodata
.p2align 8
.amdhsa_kernel test_ds_pipelined_single
.amdhsa_next_free_vgpr 3
.amdhsa_next_free_sgpr 1
.end_amdhsa_kernel
.amdhsa_kernel test_ds_pipelined_multi
.amdhsa_next_free_vgpr 5
.amdhsa_next_free_sgpr 1
.end_amdhsa_kernel