Files
TheRock/rocm-systems/emulation/rocjitsu/tests/kernels/virtual_lds_smoke.hip
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

52 lines
2.0 KiB
Plaintext

// Copyright (c) 2026 Advanced Micro Devices, Inc.
// SPDX-License-Identifier: MIT
#include <hip/hip_runtime.h>
/// Oversized static-LDS kernel used to validate rocjitsu's virtual-LDS sidecar.
///
/// The shared array is 108288 bytes, matching the size class of the Qwen/Tensile
/// gate-projection kernel that cannot fit in gfx942 hardware LDS. The body uses
/// vectorized 16-byte LDS accesses at both low offsets and offsets above 64 KiB
/// so the translated sidecar must correctly remap wide DS reads/writes into the
/// per-workgroup global backing store.
extern "C" __global__ void virtual_lds_smoke(const unsigned *__restrict__ input,
unsigned *__restrict__ output,
unsigned workgroup_size) {
constexpr unsigned kThreads = 256;
constexpr unsigned kHighBase = 4096; // 4096 * sizeof(uint4) == 64 KiB.
constexpr unsigned kLdsVectors = 6768; // 6768 * sizeof(uint4) == 108288 bytes.
__shared__ __align__(16) uint4 scratch[kLdsVectors];
const unsigned tid = threadIdx.x;
const unsigned gid = blockIdx.x * workgroup_size + tid;
const unsigned seed = input[gid];
uint4 low;
low.x = seed ^ 0x10203040u;
low.y = seed + 0x31415927u;
low.z = seed ^ (tid * 0x01010101u);
low.w = seed + gid;
uint4 high;
high.x = seed ^ 0xa5a50000u;
high.y = seed + 0x27182818u;
high.z = seed ^ (gid * 0x00010001u);
high.w = ~seed;
scratch[tid] = low;
scratch[kHighBase + tid] = high;
__syncthreads();
// Cross-lane reads force the compiler to materialize the values from LDS
// rather than forwarding each lane's own stores through registers.
const uint4 from_low = scratch[(tid + 1u) & (kThreads - 1u)];
const uint4 from_high = scratch[kHighBase + ((tid + 17u) & (kThreads - 1u))];
const unsigned out = gid * 4u;
output[out + 0] = from_low.x ^ from_high.w;
output[out + 1] = from_low.y + from_high.z;
output[out + 2] = from_low.z ^ from_high.y;
output[out + 3] = from_low.w + from_high.x;
}