Skip to content

runtime: probe an unreadable memory SRV range once per refusal - #3466

Merged
R0Y00 merged 2 commits into
R0Y00:mainfrom
Leyukaka:runtime-probe-unreadable-once
Nov 30, 2026
Merged

R0Y00 merged 2 commits into
R0Y00:mainfrom
Leyukaka:runtime-probe-unreadable-once

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Fixes #3462.

What changes

publish_tiled_texture now reports through a bool& unreadable whether its readability probe failed. texture_unavailable_reason uses that result and no longer calls x2w_local::readable on the same range (it also loses its address parameter). All three publish_tiled_texture call sites in device_memory_srv pass the same flag.

Faults on an unreadable range, per slot-70 refusal:

main (5de0b114) this PR
logged refusal (first 8, then the first of each new shape) 3 2
repeated refusal 2 1

The 1-byte probe in log_refused_memory_srv is unchanged; it is the second fault of a logged refusal.

Refusal decisions and census names are the same: texture_no_resource, texture_over_64mib, texture_unreadable, texture_unavailable. The size check still comes before the probe. The census class now follows the probe that made the decision, not a later one.

Why

Each failed probe is a first-chance access violation, and under the debugger each one stops the whole process. See #3462.

Tests

tests/startup_memory_srv_diag.cpp reserves one page without committing it, sends the same one-texel view to slot 70 twice, and counts read access violations at that address with a vectored handler. It expects 2 faults for the first call (logged) and 1 for the repeat, and texture_unreadable 2, in the census. tests/startup_memory_srv_diag_check.py expects the new shape's texture_unreadable line after the nine existing slot-70 lines.

ctest --preset dev -R '^startup_memory_srv_': 23/23 passed, twice (WARP and hardware diag included).

Mutations, each restored afterwards:

  • d3d12_memory_srv.inl back to the 5de0b114 version: diag_warp and diag_hardware fail with Expected 2 logged and 1 repeat reserved texel probe faults, observed 3 and 2.
  • Log probe removed (address_readable forced to false in log_refused_memory_srv): both fail with observed 1 and 1.
  • "texture_unreadable" renamed in texture_unavailable_cause (run on the first commit, 62e0a3c1): startup_memory_srv_census fails.

Not covered

@lukaslw-lab lukaslw-lab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed 5ca1d954 by reading the diff; not built or run.

Verdict: approve. One fault fewer per refusal, and the census class is unchanged on every path. No MUST.

  • Census on the shared path (d3d12_memory_srv.inl:768-792): with published true, texture_unavailable_reason runs only when there is no texture and nothing is held. On the BC / bc64 path, publish_tiled_texture has just run. On the console-layout path, the only way through without held is the else if (!texture) branch, which also calls publish_tiled_texture. So unreadable is always the result of a probe on the same call, never the stale false default. A view with both a BC and a console layout probes twice, and the second result wins, which is the correct one.
  • Order is kept: the 64 MiB check still returns before the probe with unreadable = false, so texture_over_64mib is unchanged. A nullptr after a successful probe still gives texture_unavailable.
  • The fixture holds on current main (2e30cc59). readable goes through probe_readable → mapped_prefix, which skips only MEM_FREE. A MEM_RESERVE page is still touched with the pre-check on or off (X2W_PROBE_PRECHECK, #3313), so the expected 2 / 1 faults do not depend on the debugger or the environment. Neither file has changed on main since this head.

Tests: the vectored-handler count at the exact address shows the probe count per call, and the 5de0b114 mutation (3 / 2) shows it catches the double probe. The diag_check.py change follows the new tenth slot-70 line. CI did not run startup_memory_srv_diag_*: they are not in the pr preset's list, and /O2 was skipped on the PR.

@R0Y00
R0Y00 merged commit 1e36560 into R0Y00:main Nov 30, 2026
5 checks passed
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.

startup: slot-70 memory SRV probes unreadable memory twice per refusal

3 participants