Skip to content

Graphics prerequisites: memory map, toolchain v3.0.4, sparse VM and CP indirect launch - #566

Merged
tinebp merged 4 commits into
masterfrom
feat/graphics-prereqs
Dec 3, 2026
Merged

tinebp merged 4 commits into
masterfrom
feat/graphics-prereqs

Conversation

@tinebp

@tinebp tinebp commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Base: fix/master-bugfixes (#560). Head: ae91a21 (6 commits: 5 features and one baseline commit).

Rebased 2026-12-01 onto fix/master-bugfixes 2dafca1 (master cba70a4). Each commit's tree equals the tested tree plus only master's pipeline-isolation rules commit (docs, ci/change_impact.py) and #560's comment-only commit, so every result below carries over. The toolchain commit's message now names v3.0.4, the pin it sets.
Depends on:

  • fix/master-bugfixes; merge that first.
  • feat/fpu-split-timing: its one commit is also this PR's first commit (identical patch, patch-id 435211353f6a), because the GEOM front end of feat/vulkan-graphics instantiates VX_fdiv_unit_rtl #(.SPLIT(1)). Merge feat/fpu-split-timing first; rebasing this stack onto master then drops the duplicate automatically.

feat/vulkan-graphics is stacked on this PR.

These are the general features the Vulkan stack needs that are not graphics units themselves.

commit what why
466f12bb4 fpu SPLIT = feat/fpu-split-timing (see that PR) GEOM's setup divider uses SPLIT=1
df4c4c391 memmap A 16 KiB stack per thread (VX_MEM_STACK_LOG2_SIZE 13 → 14). RV64 heap grows to 32 GB with the stack window reserved. A Vulkan shader's deepest call chain needs more than 8 KiB (the robustness megashader uses 9,136 B). LumiBench scenes exceed 8 GB on RV64.
34ed4832f toolchain TOOLCHAIN_REV v3.0.4: mesa-vortex, PoCL, the pinned SPIR-V translator and the Khronos Vulkan loader. The graphics stack's driver and loader.
9e070319a sparse VM VX_MEM_SPARSE reservations and vx_buffer_bind. A PTE RSW bit marks a null translation: an unbound page reads 0 and drops writes and atomics. The CP's DMA translates page by page. Vulkan sparse resources.
fa2c0b453 CP indirect launch vx_launch_indirect_t: grid from device memory, predicate, zero-grid skip, skip count. The RTL CP gets a launch sequencer (opcode 0x0D, caps SUPPORTS_QMD/INDIRECT). The CP walks every step of a draw descriptor. vkCmdDispatchIndirect, indirect draws and conditional rendering without a host read-back.

Default-behaviour impact

  • UNGATED, timing: N11 moves every kernel's stack base and size. SimX cycles shift by up to about ±0.5%; with master's stack size, 15 of 20 differing apps become identical.
  • UNGATED, RTL CP only (xrt/FPGA): N2 adds the launch sequencer and opcode 0x0D, and the caps bits read 1. Existing commands are unchanged; SimX and rtlsim are identical.
  • Gated: N3 (VM is off by default).
  • Toolchain only: N8.

Verification

Results name the commit they ran on. Before the restack onto fix/master-bugfixes 4bdefdb (master 7470f62), this branch's tip was 414bfd11e. Each restacked commit's tree equals its pre-restack tree plus exactly fix/master-bugfixes' own delta 22198fdea → 4bdefdb (normalized-patch md5 68e275b1 for all five commits), so runs on 414bfd11e carry over.

check commit result
per-commit x32 build (sw, simx, rtlsim, xrtsim), every commit alone 466f12bb4, df4c4c391, 34ed4832f, 9e070319a (the tip in the next row) PASS, all rc 0
tip build x32 + lint, change_impact, synth_gate_ref, boundaries fa2c0b453 tree PASS, 0 warnings; lint 1070 OK; change_impact 133 passed / 1 skipped; synth_gate_ref 6; boundaries OK
vm category, simx x32 (VM, sparse VM, CP DMA translation) 414bfd11e 35/35 PASS
vm category, rtlsim x32 414bfd11e 33/33 PASS
model_parity: parity-indirect, parity-vm*, parity-lazy-fetch-full, parity-sgemm-mc64 (rtlsim x32) 414bfd11e 14/14 PASS
cache lazy_fetch-4 (rtlsim x32) 414bfd11e PASS
regression indirect-xrt (xrtsim x32, the RTL CP launch sequencer) 414bfd11e PASS
sw runtime (host x32) 414bfd11e PASS
unittest hw-cp, mmu (host x32) 414bfd11e 4/4 PASS
N4 identity at the default build (Beacon U55C/ASIC core, tcu, tensor vs master; hw-fpu unit tests) ae2c141dd LUT/FF/BRAM/DSP and depth identical to master; hw-fpu PASS

Baselines

Commit ae91a21, data only. This branch moves CI to toolchain v3.0.4, whose Beacon (134d03b9e) is part of every logic_gate golden's config_hash, and changes the resolved perf config (VX_MEM_STACK_LOG2_SIZE, VX_VM_PTE_SPARSE_BIT). Every golden is re-recorded; no metric is relaxed.

  • perf_gate, all 49 entries, rtlsim x32 with CI's v3.0.4 toolchain: 34 from the full shards on 414bfd11e, 15 recorded on fa2c0b453 (user decision). The config_hash of all 49 matches the resolved config. Moves against fix/master-bugfixes' records, which used the v3.0.3 compiler: dxa copy-nt4/nt16 +3.5% / +3.7% (instrs +8), sgemm2-fp16 +2.25%, sgemmx-nt16 −1.26%, softmax-nt4/nt16 −0.20% / −0.06% (instrs −6144 / −1536), sgemm2-dxa-nt16 +0.36%; every other entry within ±0.1%. Attribution was not split between the two causes: the compiler change (v3.0.3 → v3.0.4) and N11's stack move both act on these entries.
  • logic_gate U55C, all 16 entries, recorded from the finished Beacon v3.0.4 run on 414bfd11e (--resume --update-baseline, no new synthesis). The restacked tree differs from 414bfd11e only by fix/master-bugfixes' rebase; master's VX_cache_init change there is logic-equal ("same leaves, same node equations, same root", dc686d1). Against master under the same Beacon: 14 PASS; top_vortex and vm read DEEPER on the count of registers at or above 8 levels (460 → 464, 657 → 660), with the deepest path unchanged at 15. The maintainer accepted these two counts on 2026-12-01. fix/master-bugfixes' F8 adds registers at that level in both entries (accepted, VX_cache_tags g_dirty), and this branch's N3 touches the VM path both entries enable; the split between them was not measured. CI's merge-base comparison on this PR is against fix/master-bugfixes.
  • logic_gate ASIC (beacon_asic), 14 entries, recorded on fa2c0b453 with Beacon v3.0.4. Against master's committed ASIC goldens (recorded with the v3.0.3 Beacon): stages equal or fewer on every entry (fewer on cache, core, gfx, lmem, om, rtu, tcu and vm, which is the tool version); cells within +3% (top +3%, cache +2%, others ≤ +0.5%) and flip-flops within +1%.
  • Note on depth numbers: Beacon v3.0.4 reports shallower absolute depths than v3.0.3 on some entries (top_vortex and vm 21 → 15 levels) for the same RTL; that is the tool, which is why the goldens move with the toolchain.

🤖 Generated with Claude Code

@tinebp tinebp left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of #566: Graphics prerequisites: memory map, toolchain v3.0.4, sparse VM and CP indirect launch

Head ae91a21, base 2dafca1, range reviewed 2dafca1..ae91a21 (a0cf82a, 47381c0, 5d54f8e, 0c18b5e, ae91a21; 676c098 is reviewed in #561). Rules: master 3fb83fd (incl. coding_guidelines_verilog §13 and the review policy v5).
Static review: nothing built or run. Ratings: 1-5 (5 = must fix), with the policy's F0-F3.

Summary

The PR raises the per-thread stack to 16 KiB and the RV64 heap to 32 GB, moves CI to toolchain v3.0.4, adds sparse VM reservations (a null-translation PTE bit, vx_buffer_bind), adds an indirect or predicated launch to the C++ CP model and to a new RTL launch sequencer, and re-records every golden.

  • The C++ model side of sparse VM and indirect launch is sound: SimX and the C++ CP agree, and the skip counting is consistent between the runtime, the model and the RTL engine.
  • The RTL command processor does not match it. The new sequencer reads descriptors without translating them, and the RTL CP DMA still translates only a transfer's base. Both break xrt with VM enabled, and the first one breaks every launch, not only the new features.
  • The 16 KiB stack makes two in-tree profiles (mi300a, mi300x) fail to compile.
  • The baselines commit says "No metric is relaxed", but several values moved toward a looser bar without attribution.
  • Dependencies: the PR is stacked on a version of #560 that is not yet pushed to fix/master-bugfixes (origin is at 4bdefdb; this PR sits on 6ac4232 + 2dafca1). 2dafca1 cleans up comments for #560's findings and belongs in #560.

Class

R3 (classifier: isa-encoding, sw-common-abi, installed-api, toolchain-pins, test-coverage, golden-values).

  • isa-encoding (VX_types.toml: VX_MEM_STACK_LOG2_SIZE 13→14, stack_window_top, VX_VM_PTE_SPARSE_BIT): RTL, SimX, runtime and the kernel crt0 all read the toml, so they agree. Refuted for profiles: mi300a and mi300x no longer build (finding 3). Open: the Mesa prebuilt's embedded kernels (finding 6).
  • sw-common-abi (cp_launch_abi.h): Confirmed. The writer (queue.cpp) and the C++ reader agree, and the RTL ILD_OFF_*/ILD_CTL_* in VX_cp_pkg.sv equal the header's values.
  • installed-api (vortex2.h): additions only. One behaviour change: on master vx_launch_info_t.next was ignored; now an unknown chain returns VX_ERR_INVALID_INFO. Downstream builds (Mesa, PoCL, chipStar) are not shown.
  • toolchain-pins (v3.0.3→v3.0.4): Confirmed. Tag v3.0.4 exists at dcb1da86d. Its components are published: mesa vortex_3.1 = d6393456d15, pocl vortex_3.1 = 6b98cc8d4f5c, llvm a0df07abbec2. The tag was moved on 11-28 (from 22005d5); CI keys its cache on tag+sha, so the move is safe.
  • test-coverage: three existing cases moved to -DVX_CFG_CP_LLC_CLIENT=0 (finding 7). Extending runtime-1 is fine.
  • golden-values: refuted as submitted (finding 4).
  • Evidence: golden provenance only partly given; toolchain pin OK; configure-copied files mean a re-configure is needed.
  • pipeline-stage: not raised and none found. The only shared-unit hunk (VX_lsu_agu.sv:62-66) is a STATIC_ASSERT, with no logic.

Recommended changes (highest rating first)

[5] F3 high static-proof · 0c18b5e hw/rtl/cp/VX_cp_axil_regfile.sv:225-229, VX_cp_launch_seq.sv:256,454-457 — the RTL CP now runs every launch through an untranslated descriptor read

What: The regfile now advertises SUPPORTS_QMD (bit 26) and SUPPORTS_INDIRECT (bit 28); on master the RTL advertised neither. With QMD advertised, the runtime sends every launch as CMD_LAUNCH_QMD (queue.cpp:882). The descriptor lives in an args slot, mem_alloc(…, VX_MEM_READ) (device.cpp:191,213), which under VM has a minted VA. The sequencer puts cmd.arg0, rec_addr and pred_addr straight onto axi_dev, which reaches physical memory or the LLC with no MMU. Page walking exists only inside VX_cp_dma (satp, VX_cp_dma.sv:249-287).
Scenario: CI vm:cp-dma-walk (xrt, VX_CFG_VM_ENABLE, VORTEX_RANDOMIZE_VA=1). The QMD replay reads the PA equal to the VA, so the KMU DCRs come from unrelated memory and the kernel launches with the wrong PC, args and grid, or hangs. The C++ model translates (cp_dev_read), so simx and rtlsim pass and only xrt fails. indirect-xrt runs without VM and cannot catch it.
Alternative: Two options:

  • (a) The minimum for this PR: advertise both bits only without VM, 1'(!VX_CFG_VM_ENABLED)`. The runtime then falls back to DCR replay and refuses indirect launches under VM. This costs zero logic.
  • (b) The proper fix: give the sequencer the DMA's translation. Factor VX_cp_dma's S_XLATE walk into a small VX_cp_xlate unit that sits on the dev xbar ahead of both clients. One walk per read is enough, because every sequencer read is one aligned 64-byte line.

Why better: (a) restores every xrt+VM launch at no area cost. (b) reuses walk logic that is already verified, instead of adding a second walker, and it serves finding 2 as well.

[5] F3 high static-proof · 5d54f8e hw/rtl/cp/VX_cp_dma.sv:89-94,283-287 (unchanged) vs sim/common/cmd_processor.cpp cp_mem_copy — the sparse contract is implemented in the C++ CP only

What: The commit makes the C++ CP DMA translate page by page, read zeros from null pages and drop writes to them. The RTL CP DMA is unchanged. It translates the operand's base once ("every allocation maps to one contiguous physical range") and does not look at the N bit. The runtime accepts VX_MEM_SPARSE whenever VM is on (device.cpp:1197), xrt included.
Scenario: On xrt with VM, take a copy into a sparse buffer whose first page is unbound. The null leaf has ppn 0, so the DMA writes PA 0x0+offset, which is the IO/COUT region at VX_MEM_IO_BASE_ADDR. A copy across two bound pages that map to non-adjacent PAs writes the second page to the wrong PA. vm-sparse runs only on simx and rtlsim, so CI cannot see this.
Alternative: Translate per chunk in VX_cp_dma. Chunks already end at 4 KiB (beats_to_4k), so re-enter S_XLATE when a chunk starts a new page. On an N leaf, drive zero data on the read side and zero wstrb on the write side. Until that lands, gate the feature: add a CP caps bit for "page-granular DMA" that the C++ CP sets and the RTL clears, and have mem_alloc(VX_MEM_SPARSE) return VX_ERR_NOT_SUPPORTED without it.
Why better: The CP-side half of the contract then exists on the hardware path. The caps gate costs nothing now and keeps a supported configuration from corrupting the IO page.

[5] F3 high static-proof · a0cf82a VX_types.toml:24, sim/simx/stack_interleave.h:52-53, hw/rtl/core/VX_lsu_agu.sv:65 — the mi300a and mi300x profiles no longer build

What: The new unconditional assert requires the stack window to stay above PAGE_TABLE_BASE + PT_SIZE_LIMIT (RV64: 0xF2000000, 3.78 GiB). At 16 KiB per stack:

  • mi300a (6×38 CUs × 32 warps × 64 threads = 466,944 stacks) spans 7.1 GiB, so the window bottom is at 0.87 GiB. On master (8 KiB) the bottom was 4.44 GiB and the profile built.
  • mi300x (622,592 stacks) spans 9.5 GiB, which exceeds the 8 GiB top. On master its window already overlapped the page tables and the OM aperture (bottom 3.25 GiB) with VM_ENABLE set, so the assert is right to catch it.
  • In the runtime, stack_low (device.cpp:408) wraps for mi300x instead of failing cleanly.

Scenario: configure --profile=mi300a (or mi300x), then build SimX: the static_assert in stack_interleave.h fails. The RTL STATIC_ASSERT fails the same way.
Alternative: Derive the stack size in VX_types.toml from the hart count. The toml exprs already use $VX_CFG_NUM_THREADS, so VX_MEM_STACK_LOG2_SIZE can be 14 where NUM_STACKS << 14 fits between PAGE_TABLE_END and stack_window_top, and the largest power of two that fits otherwise. That gives mi300a 8 KiB and mi300x 4 KiB, and every other profile 16 KiB. Make the runtime reject a window that does not fit instead of wrapping.
Why better: Every in-tree profile keeps building, and the master bug for mi300x (stacks overlapping the page tables under VM) is fixed rather than turned into a build break. The shaders that need more than 8 KiB keep 16 KiB on every profile that can hold it.

[4] F2 high static-proof · ae91a21 ci/baselines/** — goldens re-recorded with loosened values, no attribution, not at the landed tree

What: The message says "No metric is relaxed", but these values got worse:

  • perf: dxa copy-nt16 +3.7% cycles and +8 instrs; copy-nt4 +3.5% cycles and +8 instrs; tensor sgemm2-fp16 +2.3% cycles; dxa sgemm2-dxa-nt16 +0.4%.
  • Beacon: cp_dma and cp_dma_vm pred_fmax 343→310 MHz; rtu 313→294; tex 293→288; core +1,099 LUT; top_vortex +633 LUT and +408 FF; vm deep registers 657→660; top 460→464.
  • ASIC: top +36.5k cells (+2.7%); cache +6.7k cells (+2.4%).

None is split into toolchain versus design (bug_fixes §6.1), and none has a case → commit → mechanism → class row (§6.3). Two more gaps:

  • The values were recorded on 414bfd11e and fa2c0b453, not on any commit in this range. They were recorded with the #560 stack in a different state.
  • The perf_gate update command is not named. Only the logic_gate one is (--resume --update-baseline).
  • Who ran it is not stated. Only a human may re-record.

Scenario: The +8 instructions on dxa copy can come from the v3.0.4 compiler (47381c0) or from the stack and memory-map change (a0cf82a). Absorbed into the golden, the next bisect cannot tell them apart.
Alternative: Re-record at the final head, after #560 lands, with the update commands in the message. Add the §6 table for each loosened entry. To split toolchain from design, build the same RTL with v3.0.3 and with v3.0.4. The 676c098 FPU entries belong to #561's attribution.
Why better: This is the policy's golden-values obligation. Without it the gate passes regressions that nobody has owned.

[4] F2 high static-proof · 47381c0 tests/vulkan/common.mk:111,166-193 — the toolchain Vulkan loader is linked but never loaded, and the check never runs

What: $(VK_LOADER_CHECK) is never defined anywhere in the tree, so each recipe line expands to an empty no-op. RUN_LD_PATH (line 111) does not include $(VULKAN_LOADER_PATH)/lib, and nothing adds an rpath. So the test links against the toolchain's libvulkan and then runs with the host's. That contradicts the common.mk comment and docs/building_toolchain.md:662-666 ("puts it first on LD_LIBRARY_PATH"). ci/vk_loader_check.sh is also mode 100644.
Scenario: On EL9 the tests load the host's 1.4.328 loader, which is exactly the loader the commit sets out to avoid. Only the -z nodelete ICD in the v3.0.4 Mesa hides it.
Alternative: Three small changes:

  • Prepend $(VULKAN_LOADER_PATH)/lib to RUN_LD_PATH.
  • Define VK_LOADER_CHECK := LD_LIBRARY_PATH=$(RUN_LD_PATH) VK_ICD_FILENAMES=… bash $(VORTEX_HOME)/ci/vk_loader_check.sh.
  • chmod +x the script.

Why better: The mechanism the commit describes then actually runs. As it stands it is a switch that is parsed and ignored.

[4] F2 medium reasoned-risk · 47381c0 VERSION / a0cf82a VX_types.toml:24 — the Mesa embedded kernels may carry the old stack map

What: building_toolchain.md says mesa-vortex must be rebuilt whenever VX_types.toml changes, because vortexpipe embeds precompiled front-end kernels whose crt0 loads sp from VX_MEM_STACK_BASE_ADDR (sw/kernel/src/vx_start.S:98). The v3.0.4 prebuilt says it compiled those kernels from Vortex 459df51e2. That commit is neither on GitHub nor in this range, and its message does not say whether it contains the 16 KiB/0xFFF80000 map.
Scenario: Suppose the kernels predate a0cf82a. Then they place stacks at 0xFFFC0000 − t·8 KiB. The top 256 KiB of that range, [0xFFF80000, 0xFFFC0000), now lies inside the local-memory window that starts at the new VX_MEM_STACK_BASE_ADDR. The first 32 harts' stacks then alias shared memory, and vortexpipe draws corrupt.
Alternative: Check the embedded image's sp load, lui sp,0xfff80 versus 0xfffc0, and state the result. If it is old, rebuild mesa-vortex from a tree that contains a0cf82a and refresh the prebuilt before this PR lands (landing order).
Why better: It closes the isa-encoding contract for the one consumer that bakes the memory map into binaries.

[3] F2 medium static-proof · 0c18b5e ci/testcases/cache.yaml:357-364, core.yaml:151-160,218-225 — existing cases moved off the default CP configuration inside a feature commit

What: lazy_fetch-4, parity-lazy-fetch-full and parity-sgemm-mc64 now add -DVX_CFG_CP_LLC_CLIENT=0. The default (=1) is unchanged since master, and the commit message does not mention these changes.

  • For the lazy-fetch pair, the comments say the default never exercised the intended path, which is a coverage gap that already exists on master.
  • For sgemm-mc64, the comment says the RTL is bistable at the default, at ~145k or ~156k cycles.

Scenario: The default configuration loses its model_parity coverage on mc64, and the bistable pathology at the default is left unowned (bug_fixes §6.2).
Alternative: Do this in its own commit. Keep the original cases and add CP_LLC_CLIENT=0 variants as new ids, since new cases are not findings. For lazy_fetch, make the test meet its intent at the default instead, for example by evicting the pre-pattern from the LLC after the upload. File the mc64 bistability with its own plan.
Why better: The default configuration keeps its coverage, and the case change stops riding along with an unrelated feature.

[3] F2 medium reasoned-risk · 5d54f8e sw/runtime/common/buffer.cpp:58, device.cpp:1302-1321 — binding to megapage-heap memory leaves stale aliases after free

What: mem_bind accepts any non-PHYS, non-HOST, non-SPARSE buffer, and resolves its pages with page_table_walk, which handles superpages. With VORTEX_VM_MEGAPAGE_HEAP=1, heap buffers are identity-mapped (vm.cpp:222) and have no vm_maps_ entry. Freeing such a buffer therefore never calls unmap(). Even if it did, leaf_pte_addr returns 0 for superpage leaves, so the alias loop would be skipped.
Scenario: Bind a sparse page to a megapage-heap buffer, free the buffer, then allocate again. The sparse page now reads the new buffer's data, which breaks "Releasing mem unbinds every page bound to it" (vortex2.h).
Alternative: In mem_bind, also require every source page to pass vm_mgr_->bindable(mem_addr + i*page), so the source must be base-page mapped. Otherwise return VX_ERR_INVALID_VALUE.
Why better: It is one check in the existing validation loop, and it matches the API's own restriction ("a buffer mapped at a device-chosen address").

[3] F2 medium reasoned-risk · a0cf82a sw/runtime/common/common.h:38 — a fixed 32 GB heap regardless of how much memory the device has

What: GLOBAL_MEM_SIZE is a compile-time 32 GB on RV64, and VX_CAPS_GLOBAL_MEM_SIZE reports it as is.

  • The U55C has 16 GB.
  • gem5's backend bounds requests at 8 GB (sim/simx/gem5/vortex_gpgpu.cpp:36,104).
  • Under VM, PT_SIZE_LIMIT (32 MB) holds leaf tables for only about 16 GB of base pages.

On master the 8 GB bound fit every backend.
Scenario: An RV64 xrt run that allocates past 16 GB gets addresses with no memory behind them. As the self-test comment says, those accept and retire writes silently. On gem5, any allocation past 8 GB errors.
Alternative: Size global_mem_ at cp_init to min(GLOBAL_MEM_SIZE, VX_CAPS_NUM_MEM_BANKS × VX_CAPS_MEM_BANK_SIZE) (the self-test already queries both), report that value, and keep the stack-window reservation.
Why better: Scenes larger than 8 GB keep working where the device has the memory, without over-promising where it does not. It costs one query.

[2] F1 high static-proof · 0c18b5e hw/rtl/cp/VX_cp_axil_regfile.sv:225-230 — DEV_CAPS bit 28 changes meaning

What: DMA_LLC_CLIENT moves from bit 28 to bit 29, and bit 28 becomes SUPPORTS_INDIRECT. A new runtime reading an existing bitstream decodes bit 28 (LLC client) as indirect support and its LLC-client bit as 0. Indirect launch is still refused there, because QMD is clear, so the cost is extra cache flushes, not a wrong result.
Alternative: Leave DMA_LLC_CLIENT at 28 and put SUPPORTS_INDIRECT at bit 29 (or 30).
Why better: It costs nothing, and existing xclbins stay decoded correctly.

Checked, no finding

  • VX_mmu null replay (replay_void into the kill path): loads and AMOs get a zero response; stores and fetches retire. A fetch cannot reach a null page in practice, because sparse PTEs lack X, so the permission fault is reported first. SimX replay_or_kill uses the same order (permission before null), and neither L1 caches a null entry.
  • VX_tlb_l2 per-slot row copy: equal to the arrays under fill, hit, all-MRU clear and flush by construction, with a RUNTIME_ASSERT at every fill. It is a timing change folded into the feature commit with no Beacon numbers of its own (vm still +3 deep registers, see the goldens finding).
  • VX_cp_launch_seq protocol:
    • arvalid and rready come from registers, and a held beat stays valid while rready is low.
    • dcr_hold blocks the combinational DCR grant before S_DCR_ACQ samples proxy_idle, so the DCR bus mux can never see the sequencer and the proxy active together.
    • Skip, zero-grid, misalignment and the 64-pair clamp match the C++ model exactly.
    • SETTLE=3 depends on the depth of VX_cp_gpu_slice, a timing contract between modules that the code does not enforce. Note it for whoever changes that slice.
  • Runtime skip accounting: cmd_ring_count matches what cp_ring_append_ inserts (a launch always leaves l1_dirty_). It matches between the draw and ring encodings, which use the same in_draw flag, and MMU satp is programmed outside the batch. Dirty-cache bookkeeping stays conservative across a skipped range.
  • Q_ERROR (sticky, per queue) is read at cp_batch_end. Alignment faults follow the same path in the RTL and in C++.
  • vm_test return 1 replaces return errors != 0, which is correct (it no longer masks at 256). No test was weakened.
  • Comments: no PR or task names, and no cross-layer signal names, in the new code. The runtime comment that named VX_cp_axil_regfile was removed.
  • Accepted-regression records and renamed units/* entries were removed from the goldens. That is tool-generated churn, not a hand edit.

Not reviewed / evidence not seen

  • 676c098 (FPU SPLIT): reviewed in #561.
  • Test bodies were only skimmed: tests/runtime/test_indirect.cpp, tests/regression/{indirect,vm_sparse}, tests/vulkan/dispatchindirect, hw/unittest cp_core/cp_launch. Docs were not checked line by line.
  • No run was seen. Not run: vm-sparse, parity-vm-sparse, parity-indirect, indirect-xrt, hw-cp, vm:cp-dma-walk(-megapage) at the head, fpga_gate cp, and any profile build.
  • tests/vulkan/dispatchindirect is in no CI yaml.
  • Whether the v3.0.4 mesa-vortex embedded kernels include a0cf82a (459df51e2 is not reachable).

Obligations open (by contract)

  • isa-encoding: profiles build (finding 3); the Mesa embedded kernels match the memory map (finding 6).
  • sw-common-abi / installed-api: the RTL CP side of QMD, ILD and sparse is translated (findings 1 and 2). Downstream Mesa, PoCL and chipStar build against the new vortex2.h, with next zeroed.
  • golden-values: re-record at the head by a human, with the update commands and the §6 table (finding 4).
  • test-coverage: a measured reason and a split commit for the three CP_LLC_CLIENT=0 cases (finding 7).
  • R2 evidence: Beacon or fpga_gate depth for VX_cp_launch_seq. logic_gate has no cp DUT, so it is visible only through top_vortex. Name the model_parity cases that show the stack change's cycle shift.
  • Process: #560 is pushed first in the version this PR stacks on, and 2dafca1 moves to it.

Verdict: land after the rated-5 and rated-4 changes

@tinebp
tinebp force-pushed the fix/master-bugfixes branch from 2dafca1 to 96ded66 Compare December 3, 2026 10:38
Base automatically changed from fix/master-bugfixes to master December 3, 2026 10:39
tinebp and others added 4 commits December 3, 2026 03:18
…tack window

- VX_MEM_STACK_LOG2_SIZE 13 -> 14. A Vulkan shader's deepest call chain
  (register spills across an unrolled loop of calls into the software
  sampler) needs more than 8 KiB (the robustness megashader uses 9,136 B),
  and a frame past its stack corrupts the neighbouring thread's. The stack
  window's top is aligned to 512 KB instead of 256 KB. VX_lsu_agu and SimX's
  stack interleave assert that the window stays above the page tables.
- RV64: the runtime's heap grows from 8 GB to 32 GB (a scene's acceleration
  structures and resident buffers exceed 8 GB together, LumiBench CAR and
  ROBOT). The stack and local-memory window, whose top stays at 8 GB, is
  reserved out of it before any allocation.

Default behaviour (changes it): every kernel's stack base and size move
(lui sp, 0xfff80 instead of 0xfffc0); SimX cycles shift by up to about
+/-0.5% (identity check: with master's stack size, 15 of 20 differing apps
become identical).

Branch commits: 8e60ede4b, b7799cb2b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the graphics stack

TOOLCHAIN_REV moves to v3.0.4, whose bundles the graphics
stack needs: llvm-vortex fixes, mesa-vortex rebuilt from the integrated Mesa
(with a -z nodelete ICD), PoCL and Mesa built from their vortex_3.1 branches,
the pinned SPIR-V translator, and the Khronos Vulkan loader
(toolchain_install.sh --vulkan-loader, ci/vk_loader_check.sh). Docs:
building_toolchain.md, rhel/9 prebuilt bundles of CIRCT, Beacon and Foldsim.

Default behaviour: none in the hardware or simulators; the CI toolchain
version changes.

Branch commits: c2c244152, 67b516acf, 90746d69d, f1052b7, fcc855352,
e0b786247, 79d9e0a5b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nslations

Vulkan sparse resources need device virtual addresses with no memory behind
them. A VX_MEM_SPARSE buffer reserves such a range: every page reads 0 and
discards writes until vx_buffer_bind maps memory there (whole bind or none,
through the command processor, with a TLB flush before the next launch).

- A PTE's RSW bit (N) marks a null translation; the MMU and L1 TLB honour it
  (VX_tlb_pkg, VX_mmu, VX_tlb_l1/l2/mshr; SimX mmu, mmu_tlb, ptw, tlb_l2).
- The command processor's DMA and descriptor reads translate page by page
  (cp_dev_read, cp_mem_copy), so a copy across an unbound page reads zeros.
- A freed buffer is unmapped and the TLBs flushed before the next launch.
- The L2 TLB fill reads its victim set row from a registered per-slot copy
  (logic depth, no cycle change); an aperture inside an identity-mapped
  region counts as reserved already.

Test: tests/regression/vm_sparse (CI vm-sparse cases), vm_test.
Default behaviour: none at default config (VM is off by default).

Branch commits: 84136cc, f9ac6eee2, 2bd54a3fb, 294aae748, 559bf634d,
ac5fe07.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ip) and draw-descriptor steps

Vulkan's vkCmdDispatchIndirect, indirect draws and conditional rendering need
the device to read a launch's grid, or whether to launch at all, from device
memory when the launch reaches the head of the queue, with no host read-back.

- vx_launch_indirect_t, chained on vx_launch_info_t (VX_CAPS_CP_INDIRECT):
  a predicate (pred > ref, optionally inverted), a grid from a record of
  32-bit words (per dimension: word index, shift, an x bias and divisor), and
  a skip count for the commands of the same submission when the launch does
  not execute; a zero dimension never starts a kernel.
- The RTL command processor gains a launch sequencer (VX_cp_launch_seq),
  opcode 0x0D and the caps bits SUPPORTS_QMD/INDIRECT; the C++ CP model
  (sim/common/cmd_processor) and the runtime queue implement the same.
- The CP walks every step of a draw descriptor; a launch on a backend busy
  from its start waits only for the busy fall (firesim, foldsim, gem5
  declare it too).

Tests: tests/regression/indirect, tests/runtime/test_indirect,
tests/unittest/cp_model, hw/unittest cp_launch/cp_core/cp_engine (CI hw-cp).
Default behaviour: existing commands are unchanged in the model (SimX and
rtlsim identical); the RTL CP runs only on xrt/FPGA.

Branch commits: a343f8c, cd7a99d, 7299ec588, 24669bcc4, 641d3e7e4,
0d623eef5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tinebp
tinebp force-pushed the feat/graphics-prereqs branch from ae91a21 to cc19f0b Compare December 3, 2026 11:19
@tinebp
tinebp merged commit 8e575d4 into master Dec 3, 2026
1 of 10 checks passed
@tinebp
tinebp deleted the feat/graphics-prereqs branch December 3, 2026 11:19
tinebp added a commit that referenced this pull request Dec 3, 2026
…hain v3.0.4

Toolchain v3.0.4 (#566) moved the Beacon version and some instruction
counts, so every golden is re-recorded on the final tree of the #560..#569
merge series, by the gates' own --update-baseline(s):

- logic_gate U55C (16 entries) and beacon_asic (14): no build deeper or
  slower than its previous golden; LUT flat except raster +1%.
- perf_gate (51 x32 entries): geomean +0.52% cycles.
  - dxa/wgmma (accepted): wgmma-dxa-mcast-nt4 +6.7%, copy-nt16/-nt4 +3.6%
    (+8 instructions), wgmma-dxa-mcast-nt16 +2.0%, wgmma-sparse +1.5%,
    the rest of dxa and wgmma under +1%.
  - core:sgemm2-wide +4.74% (313459 -> 328310, instructions equal): from #560,
    whose barrier and fence now drain the warp's memory requests (a
    correctness fix). rtlsim before #560 313459, after 328310; SimX moves
    the same way (312426 -> 324923). Later merges leave it unchanged (#569:
    328310; #568 equal on SimX).
  - sgemmx +0.4%, sgemm2-fp16 +0.3%, softmax -0.2% (-6,144 instructions);
    all other entries within +/-0.1%.

Not re-recorded (skipped for time): fpga_gate, asic_gate, and the opt-in
gpu logic_gate entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tinebp added a commit that referenced this pull request Dec 3, 2026
…E_ENABLE at FLEN 64) (#568)

VX_CFG_EXT_LDST_WIDE_ENABLE required FLEN 32, where vx_flw.d/.q are macro-ops
of 2 or 4 flw uops. With 64-bit FP registers a vx_flw.d/.q is now one LSU
instruction, as NVIDIA's LDS.128 and AMD's DS_READ_B128 are: each lane reads
its 8 or 16 bytes in one memory access and one writeback writes the 2 or 4
registers, each word NaN-boxed in its own register. The address must be
naturally aligned (8 / 16 B). vx_fsw.d/.q stay fsw uops.

- RTL: decode carries the group size; the scoreboard reserves the aligned
  group; LSU lanes are 16 B with one addressed word in the low half; the LMEM
  engine reads whole lanes for a quad; VX_lsu_dcache_narrow (new) sends a quad
  to the D-cache in two half-lane passes; result/commit/writeback carry the
  upper 64 bits.
- SimX: the same model (IntrLsuArgs::wide, group scoreboard, one writeback,
  local memory serving a quad lane's two banks in one pass, two half-lane
  coalescer passes).
- Everything is under the derived LSU_WIDE_ENABLE (the extension on at
  FLEN 64); every other configuration elaborates master's logic.
- Profiles: on in the NVIDIA and AMD root profiles (derived ones inherit);
  tinygpu unchanged. a100, one core, SimX: sgemm -n64 -18.4%, sgemm2 -n64 -t4
  -24.0% cycles.
- Tests: tests/ldst_wide covers FLEN 64 (NaN-boxing, junk upper halves, end of
  the read-only words); parity-ldst-wide-x64 is a 64-bit model_parity case
  (testcase.py lets a model_parity case name its own xlen).

Rebased onto master after #565, #566 and #569: the LSU alignment assertion
keeps #569's fault exemption on both the wide and the normal path. On the
final tree: parity-ldst-wide-x64 instructions equal, cycle gap 0.01%.

CI goldens, re-recorded on this tree with toolchain v3.0.4 (#566 moved some
instruction counts and the Beacon version) by the gates' own update flags:
- logic_gate U55C (16 entries) and beacon_asic (14 entries): no build deeper
  or slower than its previous golden; LUT flat except raster +1%.
- perf_gate (51 x32 entries): geomean +0.52% cycles; dxa/wgmma up to +6.7%
  (accepted); core:sgemm2-wide +4.74% from #560's barrier/fence memory drain
  (a correctness fix; SimX moves the same way); everything else within
  +/-0.4%.
- parity on the paths where the merged PRs meet (atomics, fences, ldst-wide,
  ldst-matrix, lmem, barriers, traps): 13 of 14 pass. isa:parity-amo-scatter is
  5.52% (> 5%) on master since #569: the RTL uop sequencer spends a start
  cycle on every macro-op, which SimX does not model, and #569 made every
  atomic a macro-op. Fixed separately.
fpga_gate, asic_gate and the gpu logic_gate entries were not re-recorded
(skipped for time).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant