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
34 lines
1.5 KiB
Plaintext
34 lines
1.5 KiB
Plaintext
// Copyright (c) 2026 Advanced Micro Devices, Inc.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Register-padded vector_add for the DBI probe-CALL hardware smoke test
|
|
// (tests/dbi/hsa_dbi_nop_probe_test.cpp). Functionally identical to
|
|
// tests/kernels/vector_add.hip.
|
|
//
|
|
// Why a separate kernel: the no-op probe `rj_nop_probe` is compiled with the
|
|
// standard AMDGPU function ABI and returns through the link pair s[30:31]. The
|
|
// probe-call trampoline therefore writes/reads s[30:31], which the wave must
|
|
// actually own. A normal vector_add only allocates ~12 SGPRs, so s[30:31] lie
|
|
// outside the allocation and the call faults/hangs the GPU.
|
|
//
|
|
// Until the instrumentor grows the patched kernel's SGPR allocation itself
|
|
// (deferred to a follow-up PR), this fixture forces the allocation up to >=32
|
|
// SGPRs with an inline-asm clobber of s30/s31. The clobber emits no
|
|
// instructions and the registers are never read, so they stay dead at every
|
|
// anchor (the probe-call resource planner still accepts the patch) -- it only
|
|
// bumps the descriptor's .sgpr_count so s[30:31] are granted.
|
|
|
|
#include <hip/hip_runtime.h>
|
|
|
|
extern "C" __global__ void vector_add(const float *__restrict__ A, const float *__restrict__ B,
|
|
float *__restrict__ C, unsigned N) {
|
|
// Force the SGPR allocation up through s31 without making them live.
|
|
asm volatile("" ::: "s30", "s31");
|
|
|
|
constexpr unsigned BLOCK_SIZE = 64;
|
|
unsigned gid = blockIdx.x * BLOCK_SIZE + threadIdx.x;
|
|
|
|
if (gid < N)
|
|
C[gid] = A[gid] + B[gid];
|
|
}
|