aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / scripts / gpu_bench / README.md
| 1 | # scripts/gpu_bench -- bench scripts for the ck_gpu_bench console |
| 2 | |
| 3 | The console (`ck_gpu_bench`, docs/IMAC_GPU_BENCH.md on feat/imac-gpu-bench) reads these. |
| 4 | Check them before a run: |
| 5 | |
| 6 | bash scripts/gpu_bench/check_bench.sh # exit 0 clean, 1 grammar error, 3 allowlist gaps |
| 7 | |
| 8 | Grammar is checked against the console's commands and argument counts. An allowlist gap |
| 9 | (exit 3) is not a grammar error: the console refuses that write with BENCH_ERR_RANGE until |
| 10 | the entry below is added to its allowlist. The console lives on the bench branch, so this |
| 11 | branch cannot add the entries itself. |
| 12 | |
| 13 | ## Register numbers are checked against AMD's headers |
| 14 | |
| 15 | bash scripts/gpu_bench/check_regs.sh # exit 0 when every number matches, 1 otherwise |
| 16 | |
| 17 | It fetches AMD's MIT register headers from the Linux kernel (v6.12, cached in |
| 18 | ~/.cache/aienos-amd-hdr) and checks every `mm...` index, mask and shift in |
| 19 | `native/kernel/gpu/amd_gpu_regs.h` (value and the cited `header:line`), the SMU constants, and |
| 20 | every `bar5_*` index in the STEP files. Earlier versions of these files used numbers that were |
| 21 | never checked (GRPH 0x5045 where the header says 0x1a04, SMC 0x178 where it says 0x94). |
| 22 | |
| 23 | ## Write allowlist entries the STEPs need |
| 24 | |
| 25 | The console on feat/imac-gpu-bench allowlists BAR5 DWORD 0x4800-0x4900, 0x4A00-0x4C00, |
| 26 | GRPH 0x1a04-0x1a12 (DCP0), SMC 0x94-0x95 and 0xa4. |
| 27 | |
| 28 | | Step | Writes (BAR5 DWORD index) | In the allowlist | |
| 29 | |-------|----------------------------------------------------|------------------| |
| 30 | | STEP1 | 0x1a04, 0x1a07, 0x1a11, 0x1a12 (GRPH, controller 0) | yes | |
| 31 | | STEP3 | none (reads 0x94, 0x95, 0xa4) | not needed | |
| 32 | |
| 33 | ## Entries STEP4-6 need (the same console change, for those runs) |
| 34 | |
| 35 | | Step | Writes (BAR5 DWORD index) | Entry to add | |
| 36 | |-------|--------------------------------------------------|--------------| |
| 37 | | STEP4 | 0x2008, 0xf814, 0xf83c, 0xec00, 0x3041, 0x3045 | those indices (GRBM_SOFT_RESET, CP_PFP_UCODE_ADDR, RLC_GPM_UCODE_ADDR, RLC_CNTL, CP_RB0_CNTL, CP_RB0_WPTR) | |
| 38 | | STEP5 | 0x3480, 0x3483, 0x3484 | 0x3480-0x3489 (SDMA0 gfx ring) | |
| 39 | | STEP6 | 0xc200, 0x3247, 0x324f, 0x3256, 0x326c | 0xc200, 0x3247-0x326c (review the queue-select step first, see STEP6) | |
| 40 | |
| 41 | ## Changes from the first version of these files |
| 42 | |
| 43 | - Commands were in an older form (`r32`, `w32`, `poll`) with byte offsets. Now they use |
| 44 | the console's commands (`bar5_read`, `bar5_write`, `bar5_poll`) and DWORD indices |
| 45 | (byte offset / 4, given in each comment). |
| 46 | - STEP1: CRTC_STATUS is 0x1ba3 (byte 0x6E8C), not 0x604e; GRPH registers are 0x1a04-0x1a12, not 0x5045-0x5048 (Linux dce_11_2_d.h). |
| 47 | - STEP2: all indices now from gmc_8_1_d.h (AGP_TOP 0x80a, AGP_BOT 0x80b). |
| 48 | - STEP3: now reads only; the old 0x201 "GetSMFWVersion" message does not exist in smu7_ppsmc.h. |
| 49 | - STEP4 and STEP6: a poll line had no arguments; fixed. |
| 50 | - Inline comments moved to their own lines (the console doc says comments start with `#`). |
| 51 | |
| 52 | ## Not verified (do not run blind) |
| 53 | |
| 54 | - SMU message 0x0201 (GetSMFWVersion): not in smu7_ppsmc.h (Linux v6.6, |
| 55 | drivers/gpu/drm/amd/pm/powerplay/inc). PPSMC_Result_OK = 0x01 is verified (same file, line 83). |
| 56 | - STEP4 GRBM_SOFT_RESET bit values (0x00010005, 0x0): not checked against gfx_v8_0.c. |
| 57 | - The checker assumes the console parses 0x-prefixed hex. Confirm in the console source. |
| 58 | - STEP5's verify read at BAR0 + 0x2400000 (DWORD 0x900000) is outside the console's BAR0 |
| 59 | window (DWORD 0-65535). It needs a wider window or a readback by the driver. |
| 60 | - Ring, PQ, EOP and fence addresses are physical addresses from the driver's boot log. |
| 61 | The scripts leave those lines commented. |
| 62 | |
| 63 | Register indices are from native/kernel/gpu/amd_gpu_regs.h. Every STEP index was checked |
| 64 | against that header on 2026-10-19; the STEP2/3/4/5/6 byte offsets match except where noted. |