diff --git a/docs/startup-runtime.md b/docs/startup-runtime.md index 5d6ea5e955..ccccb572db 100644 --- a/docs/startup-runtime.md +++ b/docs/startup-runtime.md @@ -556,8 +556,9 @@ Three census lines follow the five-second report whenever their counts changed - `x2w-d3d12 memory SRV refusals (slot 70): total N; n, ...; distinct shapes K` counts every refused slot 70 call by reason. It then prints one `x2w-d3d12 memory SRV refused shape i:` line per distinct `reason`, dimension, format, size, mips, layout and flags, for the reasons that depend on the - description (all but `null_destination`, `unreadable_resource`, `unreadable_view`, `null_address` and - `destination_outside_view_heaps`). The reasons include the partial-tile holds (`partial_tile_*`) and the + description (all but `null_destination`, `unreadable_resource`, `unreadable_view`, `null_address`, + `destination_outside_view_heaps` and the acceleration-structure holds `as_unaligned`, `as_not_placed` and + `as_wrong_state`). The reasons include the partial-tile holds (`partial_tile_*`) and the console-layout holds (`unsupported_desktop_format`, `console_layout_*`, `overlapping_resource`). Up to 128 shapes are kept; later shapes are only counted. The periodic report lists the shapes counted since it last ran. diff --git a/src/startup_stubs/memory_srv_census.h b/src/startup_stubs/memory_srv_census.h index 9a6a725ec4..240dbb8f30 100644 --- a/src/startup_stubs/memory_srv_census.h +++ b/src/startup_stubs/memory_srv_census.h @@ -29,8 +29,10 @@ namespace x2w_startup { // tools/startup/triage_run.py keeps the same list (SLOT70_REASONS). constexpr const char* memory_srv_reasons[] = { "null_destination", "unreadable_resource", "unreadable_view", "null_address", - "unsupported_description", "destination_outside_view_heaps", "gpu_written_resource", "buffer_unavailable", - "texture_unavailable", + "unsupported_description", "destination_outside_view_heaps", "gpu_written_resource", + // the acceleration-structure holds of publish_as_srv (memory_srv_as.h, as_srv_refusal_name) + "as_unaligned", "as_not_placed", "as_wrong_state", + "buffer_unavailable", "texture_unavailable", // the partial-tile holds of device_memory_srv (upstream #2105) "partial_tile_xg_rows", "partial_tile_beyond_xg_size", // the console-layout holds of device_memory_srv (#2015) @@ -47,10 +49,13 @@ inline int memory_srv_reason_index(const char* reason) } // The reasons that depend on the resource description: their shapes are kept. The others (no -// destination, unreadable arguments, no address, a destination outside the view heaps) do not. +// destination, unreadable arguments, no address, a destination outside the view heaps, and the +// acceleration-structure holds, which read only the view's address) do not. inline bool memory_srv_reason_has_shape(int reason) { return reason < memory_srv_reason_count && reason != memory_srv_reason_index("null_destination") && + reason != memory_srv_reason_index("as_unaligned") && reason != memory_srv_reason_index("as_not_placed") && + reason != memory_srv_reason_index("as_wrong_state") && reason != memory_srv_reason_index("unreadable_resource") && reason != memory_srv_reason_index("unreadable_view") && reason != memory_srv_reason_index("null_address") && reason != memory_srv_reason_index("destination_outside_view_heaps"); } diff --git a/tests/startup_memory_srv_census_check.cpp b/tests/startup_memory_srv_census_check.cpp index c8f4b0ec20..8390174439 100644 --- a/tests/startup_memory_srv_census_check.cpp +++ b/tests/startup_memory_srv_census_check.cpp @@ -2,6 +2,7 @@ // distinct refused shapes, the first 4 pipelines and the first 8 written entries, shapes only for // description-dependent reasons, the overflow counters, and a periodic report that is skipped when // nothing changed. +#include "startup_stubs/memory_srv_as.h" #include "startup_stubs/memory_srv_census.h" #include @@ -41,6 +42,27 @@ int main() check("same shape, other reason is a new shape", srv.note("texture_unavailable", &a)); check("reasons without a shape keep none", !srv.note("null_address", &a) && !srv.note("null_destination", &a)); check("unreadable description keeps no shape", !srv.note("unsupported_description", nullptr)); + // Every name the acceleration-structure resolver can return is a census reason of its own (not "other") + // and, because that path does not read the resource description, keeps no shape. The names come from + // as_srv_refusal_name, so a fourth refusal that is not added to memory_srv_reasons fails here. + { + int as_names = 0; + MemorySrvCensus probe; + for (int r = static_cast(AsSrvRefusal::none) + 1;; ++r) { + const char* name = as_srv_refusal_name(static_cast(r)); + if (!std::strcmp(name, "none")) break; + ++as_names; + const int index = memory_srv_reason_index(name); + check("acceleration-structure refusal has its own census reason", index < memory_srv_reason_count); + check("acceleration-structure refusal keeps no shape", !memory_srv_reason_has_shape(index) && !probe.note(name, &a)); + } + check("the acceleration-structure refusals were enumerated", as_names >= 3); + MemorySrvCensus fresh; + fresh.note("as_unaligned", &a); + const auto fresh_report = lines(fresh, false); + check("as_unaligned is reported by name", fresh_report.size() == 1 && fresh_report[0].find(" as_unaligned 1,") != std::string::npos && + fresh_report[0].find(" other 0;") != std::string::npos); + } const auto b = texture(128, DXGI_FORMAT_BC7_UNORM, 8), c = texture(256, DXGI_FORMAT_R8G8B8A8_UNORM, 9), d = texture(512, DXGI_FORMAT_BC3_UNORM, 10); check("third shape is detailed", srv.note("buffer_unavailable", &b)); @@ -58,7 +80,7 @@ int main() check("summary", !report.empty() && report[0] == "x2w-d3d12 memory SRV refusals (slot 70): total 138; null_destination 1, unreadable_resource 0, unreadable_view 0, " "null_address 1, unsupported_description 133, destination_outside_view_heaps 0, gpu_written_resource 0, " - "buffer_unavailable 1, texture_unavailable 1, partial_tile_xg_rows 0, partial_tile_beyond_xg_size 0, unsupported_desktop_format 0, " + "as_unaligned 0, as_not_placed 0, as_wrong_state 0, buffer_unavailable 1, texture_unavailable 1, partial_tile_xg_rows 0, partial_tile_beyond_xg_size 0, unsupported_desktop_format 0, " "console_layout_xg_rows 0, console_layout_without_footprints 0, console_layout_beyond_xg_size 0, overlapping_resource 0, " "other 1; distinct shapes 128 (calls past the shape table 5)"); check("first shape line", report.size() > 1 && report[1] == diff --git a/tests/startup_memory_srv_diag_check.py b/tests/startup_memory_srv_diag_check.py index 539e9cb62b..10753fbe53 100644 --- a/tests/startup_memory_srv_diag_check.py +++ b/tests/startup_memory_srv_diag_check.py @@ -25,7 +25,7 @@ " return float4(t.Load(int3(uint2(p.xy) % 2, 0)), 0, 0, 1);\n}\n") REFUSALS = (r"x2w-d3d12 memory SRV refusals \(slot 70\): total 9; null_destination 0, unreadable_resource 0, " r"unreadable_view 0, null_address 8, unsupported_description 1, destination_outside_view_heaps 0, " - r"gpu_written_resource 0, buffer_unavailable 0, texture_unavailable 0, partial_tile_xg_rows 0, partial_tile_beyond_xg_size 0, " + r"gpu_written_resource 0, as_unaligned 0, as_not_placed 0, as_wrong_state 0, buffer_unavailable 0, texture_unavailable 0, partial_tile_xg_rows 0, partial_tile_beyond_xg_size 0, " r"unsupported_desktop_format 0, console_layout_xg_rows 0, console_layout_without_footprints 0, " r"console_layout_beyond_xg_size 0, overlapping_resource 0, other 0; " r"distinct shapes 1 \(calls past the shape table 0\)") diff --git a/tests/startup_triage_run_check.py b/tests/startup_triage_run_check.py index c2fcba5db0..75337d70f3 100644 --- a/tests/startup_triage_run_check.py +++ b/tests/startup_triage_run_check.py @@ -203,6 +203,9 @@ def check_every_slot70_reason_is_reported(failures: list[str]) -> None: ("unsupported memory SRV arguments", "unsupported_description"), ("unsupported memory SRV arguments", "destination_outside_view_heaps"), ("GPU-written resource at the supplied address", "gpu_written_resource"), + ("unavailable acceleration structure at the supplied address", "as_unaligned"), + ("unavailable acceleration structure at the supplied address", "as_not_placed"), + ("unavailable acceleration structure at the supplied address", "as_wrong_state"), ("unavailable buffer at the supplied address", "buffer_unavailable"), ("unavailable texture at the supplied base and layout", "texture_unavailable"), ("unavailable texture at the supplied base and layout", "partial_tile_xg_rows"), @@ -224,6 +227,15 @@ def check_every_slot70_reason_is_reported(failures: list[str]) -> None: reported = sorted(key[0] for key in refusals) if reported != sorted(reasons): failures.append(f"slot70 reasons reported as {reported}, expected {sorted(reasons)}") + # The acceleration-structure names come from the header, so a new one cannot be forgotten here. + as_header = (Path(__file__).resolve().parent.parent / "src" / "startup_stubs" / "memory_srv_as.h").read_text(encoding="utf-8") + body = as_header.split("as_srv_refusal_name", 1)[1].split("}", 1)[0] + as_names = re.findall(r'return "(as_\w+)";', body) + if len(as_names) < 3: + failures.append(f"as_srv_refusal_name names not found in memory_srv_as.h: {as_names}") + for name in as_names: + if name not in triage_run.SLOT70_REASONS: + failures.append(f"SLOT70_REASONS lacks acceleration-structure refusal {name}") def check_empty_and_missing_dirs(failures: list[str]) -> None: diff --git a/tools/startup/triage_run.py b/tools/startup/triage_run.py index 427d54cf78..5f1e9f4513 100644 --- a/tools/startup/triage_run.py +++ b/tools/startup/triage_run.py @@ -44,6 +44,10 @@ "unsupported_description", "destination_outside_view_heaps", "gpu_written_resource", + # the acceleration-structure holds of publish_as_srv (memory_srv_as.h, as_srv_refusal_name) + "as_unaligned", + "as_not_placed", + "as_wrong_state", "buffer_unavailable", "texture_unavailable", # the partial-tile holds of device_memory_srv