Skip to content

metal2 bridge: record the instance-split counters + telemetry the bundles' libnative_metal_bridge.a was built with - #366

Merged
claudiusthebot merged 1 commit into
mainfrom
agent/scion-swipe2/bridge-source
Nov 17, 2026
Merged

claudiusthebot merged 1 commit into
mainfrom
agent/scion-swipe2/bridge-source

Conversation

@claudiusthebot

Copy link
Copy Markdown
Collaborator

Since 12 Nov, every Metal bundle has linked a libnative_metal_bridge.a that the repository could not rebuild: metal-perf built it on the mini on 12 Nov 17:45 from a tree whose changes were never committed. This records those changes, following #353's pattern for PanVK.

  • patches/0103-sweet-instance-split-counters.patch (metal2vulkan runtime): INSTANCE_SPLITS[12] in lib.rs, and in render.rs a count of why a draw could not record in the current render-pass instance. The reasons are stand-in, storage, locations, reformats, shadow, shader tests, views, dispatched, barrier and ordered, plus totals for all splits and for splits that already had draws. The cost is one relaxed atomic add per new instance.
  • NativeMetalTelemetry.rs (new; include!d by NativeMetalObjects.rs, code unchanged): kept runtime messages (nmb_take_message) and the work counts as text with new_instance_<reason>=N (nmb_device_work_counts_text). HotMetal2.mm's telemetry (touch /var/local/mtl2-telemetry) already calls both. NativeMetalObjects.h gains the two declarations.
  • NativeMetalObjects.rs allowance: 2396 → 2399 (the include and the keep_message call).
  • METAL.md: a section on this, and the patch range is now 0100-0103.

Checked: metal2vulkan 720ef1ce plus patches 0001-0016 and 0100-0103 reproduces the 12 Nov tree's metal2vulkan sources file for file (every modified file compared with cmp, none differ). The bridge's .rs/.h match that tree, except that the telemetry block has moved to its own file.
Not done: the library was not rebuilt from the repository and its symbols were not compared. Not run on a phone (it is the code phone 1 already runs).

🤖 Generated with Claude Code

…he bundles' bridge library was built with

Every Metal bundle since 12 Nov links libnative_metal_bridge.a as built on the Mac mini on 12 Nov from a tree whose changes
were not all here: metal2vulkan's runtime counted why a draw began a new render pass instance (INSTANCE_SPLITS in lib.rs,
render.rs), and the bridge kept the runtime's first distinct messages and gave the device's work counts as text with those
counters (nmb_take_message, nmb_device_work_counts_text), which the plug-in prints when /var/local/mtl2-telemetry exists.
They are now patch 0103 and NativeMetalTelemetry.rs (include!d by NativeMetalObjects.rs, the code unchanged and moved to a
file of its own for the size rule; NativeMetalObjects.rs's allowance goes from 2396 to 2399 for the include and the call),
with the two declarations in NativeMetalObjects.h. Checked: 720ef1ce plus patches 0001-0016 and 0100-0103 gives the 12 Nov
tree's metal2vulkan sources file for file. The library was not rebuilt from the repository. NOT run on a phone (the same
code is on phone 1 now).
@claudiusthebot
claudiusthebot marked this pull request as ready for review November 17, 2026 23:50
@claudiusthebot
claudiusthebot merged commit a521a09 into main Nov 17, 2026
3 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.

1 participant