Skip to content

device_memory_report: Switch traces to vulkan.memory_tracker event stream - #59

Merged
jimblacklercorp merged 4 commits into
mainfrom
push-unwsmznntkoy
Nov 30, 2026
Merged

jimblacklercorp merged 4 commits into
mainfrom
push-unwsmznntkoy

Conversation

@jimblacklercorp

@jimblacklercorp jimblacklercorp commented Nov 29, 2026 •

Copy link
Copy Markdown

Moves VK_LAYER_GOOGLE_DeviceMemoryReport to native vulkan.memory_tracker packets to trace Vulkan allocations directly in Perfetto without duplicating derived counters or object names.

Changes

  • Switch trace output to vulkan.memory_tracker: Emit native VulkanMemoryEvent packets with cluster annotations and per-sequence interned strings, and replay live state at session start.
  • Include thread names on recorded events: Attach cached thread_name annotations to preserve thread context without ftrace overhead.
  • Stop emitting derived usage counters: Remove counter tracks, interval union tracking, and legacy categories now that totals are derived from the event stream.
  • Stop duplicating Vulkan object names: Remove debug naming intercepts so DebugMarker serves as the single source for object names.
  • Replay placeholder bindings at session start: Emit OP_CREATE on size-0 placeholder blocks only when total_size > 0 so mid-run attach replays do not overwrite bound resource records.

Testing

  • Passed all 9 Linux tests in ctest (test_DeviceMemoryReport_layer, test_DeviceMemoryReport_dispatch, test_DebugMarker_layer, etc.).
  • Verified end-to-end on Pixel 10 (VkCube, cold start and mid-run attach) with Sherlock and vulkan-memory-report.

Bug: b/564416621

The DebugMarker layer now records object names with process IDs and
lifetime tracking, and trace consumers read them directly alongside
allocation events. Publishing names here as well adds trace overhead and
leaves two naming paths to maintain.

Drop the debug naming intercepts, naming extension advertisement, and
session-start name replay so DebugMarker acts as the sole producer. Keep
the memory report extension advertisement and its device-creation
fallback guard intact so drivers without that extension do not fail.

Bug: b/564416621
@jimblacklercorp jimblacklercorp changed the title push unwsmznntkoy device_memory_report: Switch traces to vulkan.memory_tracker event stream Nov 29, 2026
Track events write annotation keys and string values in full on every
packet, inflating trace size. Perfetto imports vulkan.memory_tracker
packets directly into its standard allocation table with interned
strings.

Register that data source, emit one native packet per allocation or
binding event, and intern keys and clusters per sequence. Replay live
allocations at one shared timestamp on session start while holding back
racing live events. Usage counter removal follows in the next change.

Bug: b/564416621
Trace consumers can compute per-cluster application, unbound, and
driver totals directly from the allocation stream. Maintaining running
counter tracks in the layer duplicates that work and adds trace volume.

Delete the usage counter tracks, interval-union bookkeeping, counter
replay at session start, and the remaining track-event category so
the layer writes only allocation events. Keep suballocation tracking,
binding clamping, and driver cluster resolution needed for those
events.

Bug: b/564416621

@olehkuznetsov olehkuznetsov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

device_memory_report: Include thread names on recorded events
Native memory events carry only thread IDs, unlike track events which
emitted full thread descriptors. Without CPU scheduling options enabled,
recordings lacked the thread names users rely on to distinguish
application allocations from driver work.

Bindings recorded against a placeholder allocation (before its
VkDeviceMemory size is known) emit OP_BIND live, and derived usage
series rely on those bindings being present at session start.
ReplayLiveAllocations skipped the entire entry when total_size == 0,
dropping those live bindings.

Keep skipping OP_CREATE for size-0 placeholders while still replaying
their OP_BIND suballocations.

Bug: b/564416621
@jimblacklercorp
jimblacklercorp merged commit 734fdb7 into main Nov 30, 2026
23 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.

2 participants