upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/thread_stacks.cpp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-22 03:57:19 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-22 04:57:17 -0500
commitd3ca882585f580587493d324fc8a7f020d103a9c (patch)
tree7602d236f7a97c2a190ec2bc1910175b9329a28b /runtime/src/thread_stacks.cpp
parentc0ac5fd6518b3ba9fa66765b8b07099990dadd74 (diff)
Tools: a Linux backend for the hardware oracle through libdrm_amdgpu, and its first runs on RDNA2
tools/hw_oracle ran only on Windows, through the HIP runtime in the AMD driver, and so far only on gfx1150. On Linux the same kernels now run as raw compute dispatches through the kernel driver: no ROCm, only clang with the amdgcn target, gcc and the libdrm headers. - hw_oracle_drm.c is the launcher. Its command stream is libdrm's own compute dispatch test for GFX10 (amdgpu_test_dispatch_memset), with what belongs to the kernel put in: the entry point, the group size, the kernarg pointer in two user SGPRs, and COMPUTE_PGM_RSRC1, COMPUTE_PGM_RSRC2 and the wave size as the kernel's descriptor has them. So the .amdhsa_* directives (register counts, float rounding and denormal modes, IEEE, DX10 clamp) take effect as under the HIP runtime. It prints the same lines as hw_oracle.c. Compute engine version 10 only (RDNA1 and RDNA2). - drm.py is the backend: it assembles with clang, takes .text, the kernel offsets and the kernel descriptors out of the object, and runs the launcher. A descriptor that asks for what the launcher does not provide (LDS, scratch, more user SGPRs) is refused. The render node must be named in LEONIDA_HW_DRM_NODE, and a node with a display connected is refused unless LEONIDA_HW_DRM_ALLOW_DISPLAY=1. - runner.open_oracle() picks the backend for the platform. The Windows path is unchanged. - asm.raw_kernel_text puts the GFX10 names of the global memory instructions back for gfx10xx. crosslane_fuzz stores with global_store_b32, which a GFX10 assembler does not have, so on RDNA2 every one of its programs was rejected. One thing the launcher had to learn: while it rewrote one command buffer in place, the second kernel of every process ran the first kernel's commands (200 of 200 runs). Every submission now gets command memory of its own; 24,500 distinct kernels in both wave sizes then each returned their own words, and a test runs 300 of them. Results on the integrated GPU of a Ryzen 9 7950X3D (Raphael, gfx1036), Linux 7.3.5, libdrm 2.4.134, clang 23.1.5: - salu_diff --oracle hw: 70,000 programs, 69,021 run, 0 mismatches (seeds 1-8; seeds 1-4 with --bfe-any; seeds 1-2 with --inline64). The s_bfe_i32 rule measured on gfx1150 holds on RDNA2, and s_ff0_i32_b32 and s_ff0_i32_b64, which gfx1150 lacks, match (2,000 programs). --oracle translator,hw: 3,000 programs pass. - crosslane_fuzz --oracle hw: 32,000 programs, 0 mismatches: seeds 1-6 (12,000 wave32, 12,000 wave64, 6,586 with the permlane hypothesis) and seeds 1-2 with --dpp (8,000, 972 with the DPP hypothesis). - f32_fuzz --oracle hw, seeds 1-6: 38,858 programs, 28,671 match, 0 mismatches, 56 known deviations (an output modifier turns -0 into +0, as on gfx1150), the rest skipped or not judged. The four MODE settings read back as the descriptors set them. - Controls: a reference with s_min_i32's SCC changed from < to <= gives 2 mismatches in 5,000 programs, minimized to that instruction; crosslane_fuzz --permlane-fetch-inactive mismatches in 239 of 1,000; f32_fuzz --negative-control catches all six wrong models. - No GPU fault, timeout or reset in the kernel log. Tests: tests/test_hw_oracle.py gains tests of the backend that need no GPU (reading the object and its descriptors, tokens, the display check, the platform choice, the GFX10 mnemonics) and two on hardware: 300 distinct kernels, and an f32 rounding mode set in the descriptor that must change a sum. The HIP-only test skips on Linux. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/thread_stacks.cpp')
0 files changed, 0 insertions, 0 deletions