Skip to content

ui: fix ts/dur deep-link selection for GPU slices - #7022

Open
suo wants to merge 1 commit into
google:mainfrom
suo:fix-deeplink-multitrack-selection
Open

ui: fix ts/dur deep-link selection for GPU slices#7022
suo wants to merge 1 commit into
google:mainfrom
suo:fix-deeplink-multitrack-selection

Conversation

@suo

@suo suo commented Aug 7, 2026

Copy link
Copy Markdown

Deep links carrying ts/dur query params (dev.perfetto.DeeplinkQuerystring) zoom to the right viewport but silently fail to select the target slice on GPU traces. Two independent causes:

1. UnionDataset.query() merges datasets whose joins differ.
Datasets are grouped for merging by source table and join alias only (getJoinSignature). The UI tracks created for grouped/split trace-processor tracks (e.g. GPU hardware queues whose overlapping slices TrackCompressor splits into parallel tracks) each join their own experimental_slice_layout depth table under the shared depth alias. The merge keeps only one of those join definitions (Object.assign), so the merged branch inner-joins every row through a single depth table and silently drops all rows that only exist in the other groups. resolveSqlEvents() then finds no track for the slice and selectSqlEvent() drops the selection without feedback. Any trace with two or more split tracks is affected.

Fix: include the join definition (from clause + unique flag) in the signature so only datasets with identical joins are merged. Refining the key can only prevent merges, so identically-joined datasets keep merging exactly as before; only the previously-corrupted case changes (each dataset becomes its own UNION branch, which is the definitional semantics).

2. dev.perfetto.GpuByProcess tracks are invisible to SQL-event resolution.
The plugin registers its per-process leaf tracks without rootTableName, so even a successfully found slice cannot resolve to them. Fix: pass rootTableName: 'slice', matching the id namespace the track's details panel (ThreadSliceDetailsPanel) already assumes for these datasets (gpu_slice ids are slice ids).

Testing

  • New unit test (union dataset does not merge datasets whose joins differ) fails without the dataset.ts fix and passes with it; the other union-merge tests pass in both states (no behavior change for legitimate merges).
  • ui/run-unittests: 148 files, 2537 passed / 1 skipped.
  • ui/prettier --check and ui/eslint clean on touched files.
  • End-to-end: on a real GPU trace (GpuRenderStageEvent kernels, one hardware queue split into 4 tracks by TrackCompressor), a deep link with visStart/visEnd/ts/dur previously zoomed correctly but selected nothing; with this change the slice is selected, the track auto-reveals, and the details panel shows the target kernel.

Deep links carrying ts/dur query params (dev.perfetto.DeeplinkQuerystring)
zoom to the right viewport but silently fail to select the target slice on
GPU traces. Two independent causes:

1. UnionDataset.query() groups datasets for merging by source table and
   join *alias* only (getJoinSignature). The UI tracks created for
   grouped/split trace-processor tracks (e.g. GPU hardware queues whose
   overlapping slices TrackCompressor splits into parallel tracks) each
   join their own experimental_slice_layout depth table under the shared
   'depth' alias. The merge keeps only one of those join definitions, so
   the merged branch inner-joins every row through a single depth table
   and silently drops all rows that only exist in the other groups.
   resolveSqlEvents() then finds no track for the slice and the selection
   is dropped without feedback. Any trace with two or more split tracks
   is affected.

   Fix: include the join definition (from clause + unique flag) in the
   signature so only datasets with identical joins are merged. Refining
   the key only prevents merges, so identically-joined datasets are
   unaffected. Adds a regression test that fails without the fix.

2. dev.perfetto.GpuByProcess registers its per-process leaf tracks
   without rootTableName, so they are invisible to SQL-event resolution
   even when the slice is found. Fix: pass rootTableName 'slice',
   matching the id namespace the track's details panel already assumes.

Validated on a real GPU trace (GpuRenderStageEvent kernels, one hardware
queue split into 4 tracks): before, a ts/dur deep link zoomed but
selected nothing; after, the slice is selected and revealed on the
visible track.
@suo
suo requested a review from a team as a code owner August 7, 2026 02:52
@google-cla

google-cla Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dreveman
dreveman self-requested a review August 7, 2026 12:35
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