Commit Graph
456 Commits
Author SHA1 Message Date
Manuel Pérez 51b9d09b34 GPU: hold SHADER_HEAPS across descriptor mirror and check query offsets
mirror() previously dropped the SHADER_HEAPS lock inside shader_slot() before using the returned &Heap, allowing a concurrent Heap::drop to free the heap while mirror() accessed it. Also guards copy_simple() against invalid descriptor kinds, rejects placed heaps whose address+size wraps u64, and checks offset+count*bytes in resolve_queries() against overflow (with a regression test).

(cherry picked from commit 628b95da5e738046d00995743e07137e48936ba6)
2026-11-25 01:02:56 -06:00
localandClaude Opus 5.5 f1650b7e45 Merge fork main a26859f (the first room renders right)
Descriptor records the title copies as bytes are mirrored before each
submission. Views off their copy's elements: our rule (raw views too, and
now typed views on 16 bytes), the fork's copies. Wave sums of halves: ours
(the fork's test passes with it). Sizes of descriptors nothing uses: ours,
then the fork's for 2D images. The fork's count of cut indirect groups is
left out: up to WIDEST groups run as asked here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 01:00:56 -06:00
localandClaude Opus 5.5 a2e7bf901f A texture filled while the runtime remaps takes the pages that are there
With VICTORY_TEXTURE_NO_WAIT=1 a refresh that met the runtime remapping
title memory read the whole chain or nothing. A texture the title holds
only the smaller levels of is never all there, so nothing was read, and
the upload recorded before put the staging buffer's zeros over the
levels on the card. A staging buffer never filled now takes the pages
that are there; what was away for the moment of a change is read after
it, and a filling with less than was mapped makes the slots due again
(at most 8 times in a row). VICTORY_TEXTURE_FILL=0: as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:55:56 -06:00
fxcelessandClaude Fable 5.2 6afd80f252 The first room renders right: byte-copied descriptor records are mirrored, views off their copy's elements get their own bytes, card room for the first world frame, levels on demand run on the card
- Descriptor records the title copies into its heap as bytes are mirrored
  before each submission (pull request #305 by Flyander, after upstream
  VIctory 86a5ed6), with a per-slot fingerprint so only records that
  changed are mirrored, the page read through the kernel, a switch
  (VICTORY_HEAP_SYNC=0) and a counter: about 40,000 records a frame on the
  test machine.
- A buffer view off its copy's elements gets a copy of its own bytes
  (after upstream 86a5ed6; VICTORY_VIEW_OWN_COPY=0: refused as before).
- Room on the card for the world's first-frame bursts: buffer copies
  (VICTORY_CARD_ROOM_FOR_BUFFERS, now on) and render targets
  (VICTORY_CARD_ROOM_FOR_TARGETS_MB, 3,072); a copy turned down gives its
  room up and is logged; the texture pass asks again every 32 MiB. 98
  buffer copies made (945 MB) where earlier runs made 1; 25 MB compared
  on the processor a frame where it was 550 to 710.
- Levels on demand: the fixes of pull request #747 by AscilCH. First run
  on a card (RTX 4070, VICTORY_LEVELS_ON_DEMAND=1): no device loss, 3.1 GB
  not allocated for levels the title does not hold. Still off by default.
- The guarded blocks under storage writes into physical pages are opened
  by default (VICTORY_PAGE_WRITES=0: counted only).
- Shaders: a program is translated with first-half interpolation pairs
  only if it was refused for one (with it on for every program 8,551
  working pixel programs came out changed); parked lane-mask pairs,
  f64 conversions and sums, lane permutations: 14 more programs translate.
- Counted, not fixed: an indirect compute pass asks for about 77,500
  groups in x and is cut to 65,535.

One five-minute game run of these changes on the test machine: no device
loss, no failed request. This merged tree was built; its test suites
were not run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-25 01:46:49 -05:00
localandClaude Opus 5.5 f0bc1d234c Merge local/world: fork main 8dd30ab (every view of a page is guarded)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:39:06 -06:00
localandClaude Opus 5.5 c45d109380 Merge fork main 8dd30ab: writes through one view of a page are seen at its other views
The fork's guard over every view of a physical page is kept on our own block
bits, known holes, kernel writes and changing blocks; what both had, ours.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:38:57 -06:00
localandClaude Opus 5.5 12c7e7c696 VICTORY_SEND_CHANGED off by default: run tile1-0 lost light and geometry with it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:31:25 -06:00
localandClaude Opus 5.5 ebd9d33b72 Title buffer copies stand where the list has them (VICTORY_COPIES_IN_PLACE)
On by default. They were all done on the CPU when their submission was
prepared, ahead of its first draw: of copy, draw, copy, draw both draws read
the second, and a source a shader writes earlier in the submission was read as
it was before. The list copies now, in the destination's host copy, out of the
source's host copy where shaders write it, else out of upload memory filled at
submission; copies into textures take what shaders wrote too. Title memory and
the reference of the host copy take the bytes at submission as before, so the
landing finds only what the card made of them.

VICTORY_WINDOWS_OWN=1 (off): windows have two sides as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:29:19 -06:00
localandClaude Opus 5.5 fb861f169e Stores by raw address declare what their dispatch names, not every copy reached so far
Also: victory replay --images writes the bytes of buffers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:20:28 -06:00
local e888289c6f Buffer views that begin between elements read their own bytes
A view D3D12 cannot place (a raw view off 16 bytes, a structured one off
16 and off its stride, a typed one off its element) was null, and the
shader read zeros: the colour-table bakes' parameter blocks are raw views
at byte 8. Such a view now gets a copy of its own bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b2a3ce9ced69e669d2d56e20c2dca7011b7e405a)
2026-11-25 00:17:46 -06:00
localandClaude Opus 5.5 c6604f99cf Merge Each submission's shaders read the bytes it was prepared with (VICTORY
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:17:28 -06:00
localandClaude Opus 5.5 7114782978 Merge Merge local/next
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:17:28 -06:00
local 193f50fe5a Merge commit '572bd4c' into local/upcopies 2026-11-25 00:08:25 -06:00
local 1161647e1d Merge local/next 2026-11-25 00:01:05 -06:00
localandClaude Opus 5.5 7a2b0b0099 Addresses of ray-tracing structures: views of a structure have no buffer
A shader that walks a structure takes its address out of the structure's
descriptor. The view has no resource, so the address came out 0 and every
ray missed. Also: only programs that store by raw address declare the
copies they reach that way as written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:00:08 -06:00
localandClaude Opus 5.5 6bdb85106c A pipeline sync waits for shader writes on the host
The console's syncs recorded nothing on the host, which orders nothing
between dispatches by itself. The ray-tracing structure builder has no
other wait between its stages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:00:07 -06:00
localandClaude Opus 5.5 fa83615d1e victory replay --flow, --images, --until; shader-info names the hashes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:00:07 -06:00
localandClaude Opus 5.5 05f7bcff65 Each submission's shaders read the bytes it was prepared with (VICTORY_SEND_OWN)
On by default. Sends to card copies were copies out of their CPU sides made
when the card came to them, and later submissions had written those by then:
of three submissions that each copy a value to the same bytes and read them,
all read the last one's (test: 12 of 12 wrong). The bytes are taken into
memory of the submission's own at preparing; short runs go as one scatter per
copy. Title buffer copies go up whether our side changed or not.

VICTORY_CARD_ALL=1 (off): every title buffer's copy has two sides, so that
this holds for the small ones too (they are written in place now, under the
submissions in the air). VICTORY_PICKED_WRITES: 1 declares, 2 lands too.

The check (VICTORY_UPCOPY_CHECK): what a submission took twice is no longer
counted as older values sent; copies of the title's out of their place in a
submission; copies held for unchanged that are not title memory's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:59:54 -06:00
localandClaude Opus 5.5 f15df2cca2 Merge local/world: VICTORY_IMAGE_WATCH
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:56:38 -06:00
local 22967b2124 Indirect dispatches of more than 65,535 groups run whole (VICTORY_INDIRECT_WIDE)
The title's tile lists are dispatches of a group per tile: in the captured frame 2dc364df5d3278b8 asks for 67,440 groups (the one before it 67,272) and 940c2635dc1312f4 for 47,760, the 115,200 tiles of 2560x1440. The clamp cut the first to 65,535: 1,905 tiles at the list's end, the lowest of the picture, did not run. Up to 2^20 groups run as asked on AMD cards (a test on the card: every group once, under its number); more still runs 65,535.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b856c46dd10bbb550157b255d113a3cca2f3f38a)
2026-11-24 23:55:23 -06:00
localandClaude Opus 5.5 f1541634fd Merge local/shaders2: the dynamic descriptor search
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:54:17 -06:00
localandClaude Opus 5.5 7704c3e460 Dynamic descriptor slots: the search goes past the cursor as far as it should
The scan was cut to the heap's length, which left out the slots past the
cursor a run that crosses it needs; upstream's corrected test (072fde0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:52:47 -06:00
local 4f54afe221 Merge commit 'c651346' into local/upcopies 2026-11-24 23:51:11 -06:00
local b64d65845f wip: submissions send their own bytes 2026-11-24 23:51:11 -06:00
localandClaude Opus 5.5 1f5ea84955 Merge victory replay --pixel: which commands change a pixel, in every target
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:51:04 -06:00
localandClaude Opus 5.5 0703d16748 Merge How much of a texture is mapped is read from the runtime's own record
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:51:02 -06:00
localandClaude Opus 5.5 8e124f4b76 Merge A refresh of a copy on the card sends the dwords title memory changed,
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:51:01 -06:00
localandClaude Opus 5.5 2d2f9477fc Merge Merge local/next (e6f492d) into local/tests
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:51:01 -06:00
localandClaude Opus 5.5 b4b13e4f32 victory replay --pixel: which commands change a pixel, in every target
After each command that can change a texture, the texel under a point of
the picture is copied out; commands that changed one are named with their
pipeline and the values before and after. The listing names textures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:50:34 -06:00
localandClaude Opus 5.5 61cbfe3ea0 A refresh of a copy on the card sends the dwords title memory changed, and no others (VICTORY_SEND_CHANGED, on)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:48:35 -06:00
localandClaude Opus 5.5 8ae4ae6077 Words of the title's image logged each second (VICTORY_IMAGE_WATCH; off)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:47:25 -06:00
localandClaude Opus 5.5 4833ae6ea2 Merge local/next (e6f492d) into local/tests
Blocks the kernel writes, or the runtime is unmapping, are no known holes
and not published; foreign blocks are never held; freed memory forgets its
known holes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:47:04 -06:00
localandClaude Opus 5.5 34a278c990 How much of a texture is mapped is read from the runtime's own record of its views
The pass that uploads textures picked by index asked the host for every
64 KiB of every texture it looked at, and twice for each block that was not
there (12,000 slots wait for their memory during a load, each looked at
again and again): 146 us for a texture of 22 MB, 721 us with 1 MB of it
there. The views of physical pages are known: 1.4 and 0.1 us. Memory that
is in no view is asked of the host as before. VICTORY_MAPPED_BY_VIEWS=0:
always. Measurement: cargo test --release -p victory-gpu --lib look_costs
-- --ignored --nocapture

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:46:35 -06:00
localandClaude Opus 5.5 cb5384fc9c Merge local/shaders2: upstream translator and state fixes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:44:32 -06:00
fxcelessandClaude Fable 5.2 847a0af35e A write through one view of a page is seen at its other views; page writes counted; levels on demand (off); warm-up; card memory numbers
Memory sync:
- The guard over every view of a physical page (code by myokex, victory-amd
  c6dc4d8, after pull request #115 by Spexivus, its correction by joroyt and
  a part of VIctory #1122 by tightfall): the title shows one page at several
  addresses and a copy was guarded at one only. 0.8 to 1.0 million writes
  through another view in a five-minute run on the test machine.
  VICTORY_VIEW_GUARD=0 turns it off.
- Kernel reads into title memory are read beside and copied in (Joshua Odom,
  10ea38e).
- Writes of the storage layer into physical pages are counted where the
  title has the pages mapped and can open the guards there
  (VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads
  are retried.

Card memory:
- Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the
  title fills takes card memory for the levels the title holds; held levels
  get memory only while the card has room and are asked for again. Its test
  runs on the software adapter; not run on a card yet.
- Refused texture slots are held back so a pass reaches the slots behind
  them; room can be kept for card copies of title buffers (off).

Tools: translate --warm all; the shader cache is keyed on the translator's
source; counters for copy-back races, page writes and the copies the
texture sweep never lets go; a walls trace.

Game runs of these changes on an RTX 4070: five five-minute runs without a
device loss or a failed request. This merged tree was built; its test
suites were run on the tree the changes come from (gpu 129, hle 97).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-25 00:44:25 -05:00
localandClaude Opus 5.5 fd3865fec4 DirectStorage reads files on a handle per worker; its page lookups do not wait for the title's mapping calls
- All 24 workers read each file through one handle, whose reads the host
  does one after the other: 48 KiB at random from levels.rpf gave 185 MB/s
  where a handle per worker gives 990 (5 GB/s against 14 from the cache).
  VICTORY_DSTORAGE_IO=one|handles|overlapped|direct (handles).
- xmem: the title's pages by number, and where it sees them, each have a
  lock of their own, apart from the one its mapping calls hold while the
  host maps, commits and unmaps. Looking pages up, filling one and telling
  of it, 24 threads beside one that maps: 2.7 million requests a second
  for 0.57, 145,000 maps a second for 60,000. A view is noted before the
  GPU side is told of it, so that a write between the two is not missed.
- Title memory is not touched with these locks held.

Benchmarks: read_bench (VICTORY_BENCH_FILE), map_bench, both ignored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:40:43 -06:00
localandClaude Opus 5.5 de135da286 Merge local/copies: holes known by their bits, landed blocks taken
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:35:15 -06:00
localandClaude Opus 5.5 68c36284d8 Typed buffer loads of 16-bit channels pack two per register; skipped devices say why (upstream c430b1d, 100de0e)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:25:32 -06:00
localandClaude Opus 5.5 fa97cdb3fe Upstream graphics state fixes: rectangle attributes, sampler bounds, A8 copies, depth footprints
Ports of 6f36cdf (normalized attributes of rectangle lists), 97c8783
(A8_UNORM is not of the R8 typeless family), b956320 (copy footprints of
depth-stencil textures), c1c3281 (the descriptor ring's wrap), e6fe8ec and
e34cb53 (CreateSamplerX bounds), 691236d (appended elements are aligned).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:25:15 -06:00
localandClaude Opus 5.5 6acade55fe Anisotropic samplers with point mips keep them where the card has them (upstream e45bacd, 23fc8a5, 7dfa86f)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:24:56 -06:00
localandClaude Opus 5.5 a780306f4c Upstream instruction fixes: 64-bit literals, exact normalized ends, flat offsets, rare forms
Ports of 7d04943 (a signed 64-bit operand sign-extends its literal),
645391b (a normalized buffer format's ends load as exactly 1.0 and -1.0),
40f30be (FLAT offsets ignore bit 11), 3d71ad1, 344704e, 5d6889e, 78c1267,
c3a04e2, e3fe5bf and the tests 259ba31, 8610ffb, 41b2472, 45ed8e3, 8d67fa5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:24:50 -06:00
local 0b3af7939c Merge branch 'local/next' into local/copies 2026-11-24 23:24:47 -06:00
localandClaude Opus 5.5 25f78a079c Mesh primitive exports: corner indices are nine bits, the edge flags dropped (upstream c0228d9)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:24:23 -06:00
localandClaude Opus 5.5 0d70c26014 Immediate sampler slots are kept apart by comparison mode (upstream 2286e03)
One constant used by a comparison and an ordinary sample became a
comparison sampler for both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:24:05 -06:00
local 5ff9f4e56a Merge commit '74045e4' into local/upcopies 2026-11-24 23:22:55 -06:00
localandClaude Opus 5.5 e7e70680cb Holes of view memory known by their bits; landed blocks taken; askings of views left out
VICTORY_KNOWN_HOLES (on): a placeholder's holes are known until the runtime
tells of a mapping or an allocation there; other holes are asked about with
the guards' lock not held. VICTORY_LAND_TAKEN (on): a copy a landing went
through is noted as up to date with it. The split tells more of the askings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:12:04 -06:00
localandClaude Opus 5.5 7321eeb96f Merge local/upcopies: checks of what goes up to card copies, picked writes (both off)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:11:04 -06:00
localandClaude Opus 5.5 8a475da9cf Kernel reads, remapped views, freed memory and lost writes of title memory
- What the kernel is writing (file reads) is not guarded by a refresh before
  the call is done (`kernel_writing`): the read would have failed.
- A title thread that uses a page while the runtime remaps another page of
  the same view waits for that in the fault handler; it faulted on a page
  the title never gave up.
- Blocks being unmapped are not guarded again, memory the title frees leaves
  no notes of its blocks (its VirtualFree is taken over), and other memory at
  an address once guarded or absent keeps its protection.
- The second part of a submission's one asking has a number of its own.
- What shaders wrote waits for a change of mapping instead of being lost;
  what could not be written is counted and said; zeros into title memory
  that went are no fault.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:10:44 -06:00
localandClaude Opus 5.5 424013a59c Writes through views picked from the heap come back (VICTORY_PICKED_WRITES)
Off by default. A shader that stores through a view it picks by an index (37
compute programs of the title, 82a2ad6d07417d36 one of them) writes buffers
nobody declared. With a submission that has one, the buffers found written
that way are declared and landed as any; of the other buffers the heap shows
unordered views of 32 MB a frame are compared on the card, in turn, and one
that changed undeclared is found. Found late is not landed late.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 23:09:03 -06:00
localandClaude Opus 5.5 72d856ec7a Merge local/streaming: requests start at the title's submit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 22:54:06 -06:00