Files
TheRock/compiler/amd-llvm/amd/comgr/test-lit/hotswap/rewriter/hotswap-barrier-isfirst.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

118 lines
4.5 KiB
ArmAsm

// COM: Test HotSwap in-place patch s_barrier_signal_isfirst -> s_barrier_signal
// COM: for GFX1250 A0. A0 may return stale SCC before the barrier completes
// COM: when the barrier ID names a user cluster barrier; the non-isfirst
// COM: variant shares encoding size and operand layout but does not write SCC.
// 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
// COM: Verify the patched layout: both isfirst sites are replaced by the
// COM: non-isfirst variant in place with their operand values preserved
// COM: (-1 stays -1, -3 stays -3). Surrounding waits and endpgm stay put.
// COM: DISASM-NOT brackets ensure no s_barrier_signal_isfirst remains
// COM: anywhere. Wait operands are shown as raw 16-bit hex by llvm-objdump
// COM: (signed -1 = 0xffff, -3 = 0xfffd).
// RUN: %llvm-objdump -d %t.out.elf | %FileCheck --check-prefix=DISASM %s
// DISASM-NOT: s_barrier_signal_isfirst
// DISASM: s_barrier_signal -1
// DISASM-NEXT: s_barrier_wait 0xffff
// DISASM-NEXT: s_barrier_signal -3
// DISASM-NEXT: s_barrier_wait 0xfffd
// DISASM-NEXT: s_endpgm
// DISASM-NOT: s_barrier_signal_isfirst
// COM: Idempotency: rewriting the patched output again must produce
// COM: identical bytes.
// RUN: hotswap-rewrite %t.out.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250 amdgcn-amd-amdhsa--gfx1250 \
// RUN: --output %t.out2.elf \
// RUN: | %FileCheck --check-prefix=API2 %s
// API2: RESULT: SUCCESS
// RUN: cmp %t.out.elf %t.out2.elf
// COM: One-sided stepping annotations must also be honored. An explicit A0
// COM: source with a generic target is not B0->A0, and a generic source with
// COM: an explicit B0 target is not B0->A0 either.
// RUN: hotswap-rewrite %t.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250:gfx1250-b0-specific- \
// RUN: amdgcn-amd-amdhsa--gfx1250 \
// RUN: --output %t.a0generic.elf \
// RUN: | %FileCheck --check-prefix=A0GENERIC-API %s
// A0GENERIC-API: RESULT: SUCCESS
// RUN: %llvm-objdump -d %t.a0generic.elf | %FileCheck --check-prefix=NO-PATCH %s
// RUN: hotswap-rewrite %t.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250 \
// RUN: amdgcn-amd-amdhsa--gfx1250:gfx1250-b0-specific+ \
// RUN: --output %t.genericb0.elf \
// RUN: | %FileCheck --check-prefix=GENERICB0-API %s
// GENERICB0-API: RESULT: SUCCESS
// RUN: %llvm-objdump -d %t.genericb0.elf | %FileCheck --check-prefix=NO-PATCH %s
// NO-PATCH: s_barrier_signal_isfirst -1
// NO-PATCH-NEXT: s_barrier_wait 0xffff
// NO-PATCH-NEXT: s_barrier_signal_isfirst -3
// NO-PATCH-NEXT: s_barrier_wait 0xfffd
// NO-PATCH-NEXT: s_endpgm
// COM: With explicit B0->B0 stepping, entry trampolines must not accidentally
// COM: enable B0-to-A0 instruction patches. The isfirst opcodes remain, while
// COM: the kernel descriptor is still redirected through an appended entry stub.
// RUN: hotswap-rewrite %t.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250:gfx1250-b0-specific+ \
// RUN: amdgcn-amd-amdhsa--gfx1250:gfx1250-b0-specific+ \
// RUN: --entry-trampolines --output %t.b0b0.elf \
// RUN: | %FileCheck --check-prefix=B0B0-API %s
// B0B0-API: RESULT: SUCCESS
// RUN: %llvm-objdump -d %t.b0b0.elf | %FileCheck --check-prefix=B0B0 %s
// B0B0: s_barrier_signal_isfirst -1
// B0B0-NEXT: s_barrier_wait 0xffff
// B0B0-NEXT: s_barrier_signal_isfirst -3
// B0B0-NEXT: s_barrier_wait 0xfffd
// B0B0: global_prefetch_b8 v0, s[0:1] scope:SCOPE_SE
.amdgcn_target "amdgcn-amd-amdhsa--gfx1250"
.text
.globl test_barrier_isfirst
.p2align 8
.type test_barrier_isfirst,@function
test_barrier_isfirst:
// Two isfirst sites with different barrier IDs; both must be swapped
// to s_barrier_signal in place with their operand values preserved.
s_barrier_signal_isfirst -1
s_barrier_wait -1
s_barrier_signal_isfirst -3
s_barrier_wait -3
s_endpgm
.Ltest_barrier_isfirst_end:
.size test_barrier_isfirst, .Ltest_barrier_isfirst_end-test_barrier_isfirst
.rodata
.p2align 8
.amdhsa_kernel test_barrier_isfirst
.amdhsa_next_free_vgpr 1
.amdhsa_next_free_sgpr 2
.end_amdhsa_kernel
.amdgpu_metadata
amdhsa.version:
- 3
- 0
amdhsa.kernels:
- .name: test_barrier_isfirst
.symbol: test_barrier_isfirst.kd
.sgpr_count: 2
.vgpr_count: 1
.kernarg_segment_size: 0
.group_segment_fixed_size: 0
.private_segment_fixed_size: 0
.kernarg_segment_align: 8
.wavefront_size: 64
.max_flat_workgroup_size: 256
.end_amdgpu_metadata