Files
TheRock/compiler/amd-llvm/amd/comgr/test-lit/hotswap/rewriter/hotswap-kernel-entry-trampoline-mixed-existing.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

127 lines
4.0 KiB
ArmAsm

// COM: An object can contain an existing appended entry stub and a different
// COM: raw kernel entry. Direct displacement would move the existing stub's
// COM: body target without repairing the stub, so the whole rewrite must stay
// COM: on the appended-stub path.
// COM: First create an object where the pre-fixed first kernel is skipped and
// COM: the second kernel receives a fast-path appended stub.
// RUN: %clang -target amdgcn-amd-amdhsa -mcpu=gfx1250 -nostdlib %s \
// RUN: -o %t.prefixed.elf
// RUN: env AMD_COMGR_HOTSWAP_ENTRY_STUB_SYMBOLS=1 hotswap-rewrite \
// RUN: %t.prefixed.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250:gfx1250-b0-specific+ \
// RUN: amdgcn-amd-amdhsa--gfx1250:gfx1250-b0-specific+ \
// RUN: --entry-trampolines --output %t.seed.elf \
// RUN: | %FileCheck --check-prefix=API %s
// COM: Replace only .text with an equal-sized raw variant. This preserves the
// COM: second descriptor and appended stub while making the first entry need
// COM: the workaround.
// RUN: sed 's/^\.set raw_entry, 0$/.set raw_entry, 1/' \
// RUN: %s > %t.raw.s
// RUN: %clang -target amdgcn-amd-amdhsa -mcpu=gfx1250 -nostdlib %t.raw.s \
// RUN: -o %t.raw.elf
// RUN: %llvm-objcopy --dump-section .text=%t.raw.text %t.raw.elf
// RUN: %llvm-objcopy --update-section .text=%t.raw.text %t.seed.elf \
// RUN: %t.mixed.elf
// RUN: hotswap-rewrite %t.mixed.elf \
// RUN: amdgcn-amd-amdhsa--gfx1250 amdgcn-amd-amdhsa--gfx1250 \
// RUN: --entry-trampolines --output %t.out.elf \
// RUN: | %FileCheck --check-prefix=API %s
// API: RESULT: SUCCESS
// COM: Both original bodies keep their addresses; direct displacement would
// COM: move mixed_second by 16 bytes and leave its old stub target stale.
// RUN: (echo ORIGINAL; %llvm-readelf -Ws %t.mixed.elf; \
// RUN: echo REWRITTEN; %llvm-readelf -Ws %t.out.elf) \
// RUN: | %FileCheck --check-prefix=SYMBOL %s
// SYMBOL: ORIGINAL
// SYMBOL-DAG: [[FIRST:[0-9a-fA-F]+]] {{.*}} mixed_first
// SYMBOL-DAG: [[SECOND:[0-9a-fA-F]+]] {{.*}} mixed_second
// SYMBOL: REWRITTEN
// SYMBOL-DAG: [[FIRST]] {{.*}} mixed_first
// SYMBOL-DAG: [[SECOND]] {{.*}} mixed_second
// SYMBOL-DAG: {{[0-9a-fA-F]+}} {{.*}} mixed_first.stub
// SYMBOL-DAG: {{[0-9a-fA-F]+}} {{.*}} mixed_second.stub
// RUN: %llvm-objdump -d %t.out.elf | %FileCheck --check-prefix=DISASM %s
// DISASM-LABEL: <mixed_first>:
// DISASM-NEXT: s_nop 0
// DISASM-LABEL: <mixed_second>:
// DISASM-NEXT: v_mov_b32_e32 v0, 2
// DISASM: global_prefetch_b8 v0, s[0:1] scope:SCOPE_SE
// DISASM-NEXT: v_nop
// DISASM-NEXT: s_get_pc_i64
// DISASM: global_prefetch_b8 v0, s[0:1] scope:SCOPE_SE
// DISASM-NEXT: v_nop
// DISASM-NEXT: s_get_pc_i64
.amdgcn_target "amdgcn-amd-amdhsa--gfx1250"
.set raw_entry, 0
.text
.globl mixed_first
.p2align 8
.type mixed_first,@function
mixed_first:
.if raw_entry
s_nop 0
s_nop 0
s_nop 0
.else
global_prefetch_b8 v0, s[0:1] scope:SCOPE_SE
.endif
v_nop
s_endpgm
.Lmixed_first_end:
.size mixed_first, .Lmixed_first_end-mixed_first
.globl mixed_second
.p2align 8
.type mixed_second,@function
mixed_second:
v_mov_b32_e32 v0, 2
s_endpgm
.Lmixed_second_end:
.size mixed_second, .Lmixed_second_end-mixed_second
.rodata
.p2align 8
.amdhsa_kernel mixed_first
.amdhsa_next_free_vgpr 1
.amdhsa_next_free_sgpr 1
.end_amdhsa_kernel
.p2align 8
.amdhsa_kernel mixed_second
.amdhsa_next_free_vgpr 1
.amdhsa_next_free_sgpr 1
.end_amdhsa_kernel
.amdgpu_metadata
amdhsa.version:
- 3
- 0
amdhsa.kernels:
- .name: mixed_first
.symbol: mixed_first.kd
.sgpr_count: 1
.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
- .name: mixed_second
.symbol: mixed_second.kd
.sgpr_count: 1
.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