Skip to content

trace_processor: Parse adreno_cmdbatch_retired/sync events#5817

Open
rossning92 wants to merge 1 commit into
google:mainfrom
rossning92:tp-adreno-cmdbatch
Open

trace_processor: Parse adreno_cmdbatch_retired/sync events#5817
rossning92 wants to merge 1 commit into
google:mainfrom
rossning92:tp-adreno-cmdbatch

Conversation

@rossning92
Copy link
Copy Markdown
Contributor

@rossning92 rossning92 commented May 12, 2026

Add custom parsing for kgsl adreno_cmdbatch_sync and adreno_cmdbatch_retired ftrace events to produce GPU timeline slices in the trace processor.
image

This is a rework of #5519 (reverted in #5793) which fixes the GPU event drift in the timeline by using per-cmdbatch sync points instead of a single global clock snapshot.
TODO: Pending validation if this PR fixes all drift issues that @batesj has observed on his end.

Test run result:

$ tools/ninja -C out/host
[16/16] stamp obj/default.stamp

$ .venv/bin/python3 tools/diff_test_trace_processor.py out/host/trace_processor_shell --name-filter '.*adreno.*'
[==========] Running 1 tests.
[ RUN      ] AdrenoCmdbatch:adreno_cmdbatch_retired_slice
[       OK ] AdrenoCmdbatch:adreno_cmdbatch_retired_slice (ingest: 738.62 ms query: 0.44 ms)
[==========] Name filter selected 1 tests out of 1357.
[==========] 1 tests ran out of 1 total. (1115 ms total)
[  PASSED  ] 1 tests.

@batesj
Copy link
Copy Markdown
Contributor

batesj commented May 14, 2026

I'll try this out shortly. Give me a few days though - hopefully this is not in a rush.

@rossning92
Copy link
Copy Markdown
Contributor Author

@batesj no rush many thanks for the help!

@batesj
Copy link
Copy Markdown
Contributor

batesj commented May 15, 2026

@rossning92 I'm getting a build error:

../../src/trace_processor/importers/ftrace/ftrace_tokenizer.cc:551:24: error: no viable conversion from 'TracePacketData' to 'FtraceData'

@rossning92 rossning92 force-pushed the tp-adreno-cmdbatch branch from fbe508d to cae15ed Compare May 16, 2026 19:51
@rossning92
Copy link
Copy Markdown
Contributor Author

@batesj My bad. I did a rebase on to main branch, but apparently some structure name changed.
I just fixed it and retested. All GPU trace event is still fully aligned with the sql query you have shared earlier.

@batesj
Copy link
Copy Markdown
Contributor

batesj commented May 18, 2026

@rossning92 This is working much better! I think there's only one remaining issue where initial clipped events are interpreted wrong. Looks like if an event was clipped at the start of ftrace events (like there's only an end event with no begin event), this CL will turn it into an even that starts at the end time instead. You can see in this screenshot the start of ftrace events there's an offset GPU event in Ctx=25. In my kgsl query I get no event for that:

image

Is there a way to drop that instead when there's no begin event?

@batesj
Copy link
Copy Markdown
Contributor

batesj commented May 18, 2026

Other examples of additional events showing at the start of the trace that don't all appear to be related to clipped events. Is it possible that this CL is being a bit too flexible in interpreting events with partial data or something like that?

image

The red square above is zoomed in below:

image

Add custom parsing for kgsl adreno_cmdbatch_queue, adreno_cmdbatch_sync
and adreno_cmdbatch_retired ftrace events to produce GPU timeline slices
in the trace processor.
@rossning92 rossning92 force-pushed the tp-adreno-cmdbatch branch from cae15ed to 5d0c9a9 Compare May 19, 2026 00:38
@rossning92
Copy link
Copy Markdown
Contributor Author

rossning92 commented May 19, 2026

@batesj thanks for trying it! Indeed, the initial clipped/drifted events are because they are not paired with adreno_cmdbatch_sync (the trace misses a few initial sync event). For such cases, we should simply skip generating GPU slices to avoid confusion.

I updated the PR and I'm pretty confident that it should now match the parity of your SQL query. On top of that, I also attached the process name to the track name (whenever adreno_cmdbatch_queue events are available)
image

Thanks so much again for such helpful feedback!

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