Skip to content

startup: count native slot 57 preparation outcomes - #3483

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
Leyukaka:runtime-mesh57-native-outcomes
Nov 30, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
Leyukaka:runtime-mesh57-native-outcomes

Conversation

@Leyukaka

@Leyukaka Leyukaka commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #3416.

In a long local run of the application, native slot 57 preparation produced no log line at all: most exits of prepare_native_mesh57 are bare returns, and the only lines are ready and refused: ... once a profile has been opened. It was not possible to tell which early return was taken.

Each slot 57 creation now adds one to the counter of the first exit it takes. No behaviour change: the same returns and throws, with the same messages.

Outcomes

  • disabled: built without X2W_NATIVE_SHADERS, render mode off, or the X2W_NATIVE_SHADERS variable unset or too long.
  • unsupported_stage_or_descriptor: no pipeline record, no fixed mesh stage, or a descriptor that is not 0x300 bytes.
  • ps_absent: no fixed pixel stage.
  • missing_creation_root_or_state: creation root signature not usable, state sizes differ, or no root blob recorded.
  • profile_absent: no cache path, or the cache listing has no .mesh57-state for the variant.
  • profile_open_failed.
  • profile_rejected_*, one per check on the profile: header, pixel_entry, version, constants, root_mapping, view_count, view_entries, view_mapping, heap_mapping, input_length, input_content, trailing_bytes, attachment_state, creation_root, and exception for any other std::exception before lowering.
  • lowering_refused: an exception from the mesh translation, the binding checks after it, or the pixel stage translation and its checks.
  • pipeline_refused: an exception from the DXIL compile, the root signature or the pipeline state.
  • ready.

lowering_reached is a milestone, not an exit: it is counted when a profile passed every check, so it overlaps lowering_refused, pipeline_refused and ready.

The combined !info || !fixed_ms || !fixed_ps || size != 0x300 return is split in two so that ps_absent has its own counter; the set of creations that return there is the same.

Output

One line in the existing render-totals block (every 300 presented frames in render mode), all counters, zeros included:

x2w-render native slot57 preparation: disabled 0 ps_absent 1 unsupported_stage_or_descriptor 0 missing_creation_root_or_state 0 profile_absent 64 ... lowering_reached 1 lowering_refused 0 pipeline_refused 0 ready 1

Counters are 64-bit, written with InterlockedIncrement64 and read with InterlockedCompareExchange64. A static_assert ties the printed names to the enum. The line holds counts only, no pipeline key.

Tests

Base c4b8a41b, preset dev.

native_mesh57_outcomes_warp and native_mesh57_outcomes_hardware (new, startup_indirect_draw_indexed <backend> mesh with X2W_TEST_NATIVE_MESH57_OUTCOMES=1): the fixture adds one creation without a pixel stage and compares the whole line. Both pass.

Mutations, each rebuilt and run on both backends:

Mutation Result
ps_absent counted as unsupported_stage_or_descriptor both fail
profile absent from the cache listing counted as profile_open_failed both fail
input content mismatch counted as profile_rejected_input_length both fail
lowering_reached not counted both fail
ready counted as lowering_refused both fail
periodic line not logged both fail

Merges cleanly with #3480 and #3481 (git merge-tree).

Not covered

  • Only the ps_absent, profile_absent, profile_rejected_input_content, lowering_reached and ready counters are non-zero in the test. The other exits are counted by the same call but no test reaches them.
  • The counters are process totals. They do not say which pipeline took which exit.
  • Exceptions that do not derive from std::exception are not caught, as on base.

@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 78693088 by reading the diff; not built or run.

Verdict: approve. Every exit of prepare_native_mesh57 now counts exactly once, with the same returns, throws and messages as before. No MUST.

  • SHOULD Document the new line. The sibling x2w-render indirect: totals have a format and an example in docs/startup-runtime.md (~1370, 1497). x2w-render native slot57 preparation: has none, and lowering_reached overlapping the terminal counts is easy to misread without a sentence.
  • NIT The disabled outcome for "render mode off" (d3d12_xs_device.cpp:7316-7322) can never show: the line is only logged inside if (render_mode() && frame % 300 == 0) (:7848-7858). In practice disabled means a non-native build or X2W_NATIVE_SHADERS unset or too long. The PR body could say so.
  • Checked, no finding:
    • Exit coverage: the only bare return left in the function (native_mesh57.inl:354) is inside the match lambda. Every early return ends in note_mesh57_outcome, and the catch counts refusal. refusal moves profile_exception → lowering_refused → pipeline_refused at the right points.
    • The ps_absent split keeps the same set of returning creations.
    • Build without native shaders: the counters, note_mesh57_outcome and mesh57_outcome_line sit outside the #ifdef X2W_NATIVE_SHADERS (:262), so the else branch in the placeholder still compiles.
    • Line length: about 750 characters, under both the 1536-byte buffer and log()'s own 1536. The static_assert ties the names to the enum.
    • Test: the extra PS-less creation is inserted before the existing ones and restores fields[5]/[6], so the later expectations are unchanged.

Tests: native_mesh57_outcomes_{warp,hardware} compare the whole line after one PS-less creation, 64 absent profiles, one content mismatch and one ready pipeline. The zeros are pinned too, but the other exits are never reached. CI did not run them: neither is in the pr preset filter.

@R0Y00
R0Y00 merged commit ee60702 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

priority: P0 Highest project priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants