ze: resolve command-queue ordinal to its engine type (fixes #506) - #526
Merged
TApplencourt merged 3 commits intoAug 5, 2026
Merged
Conversation
DonAurelio
force-pushed
the
fix-506-command-queue-ordinal-type
branch
from
August 4, 2026 18:58
8f46a52 to
58d2935
Compare
…cf#506) Level Zero device operations are labelled with the command queue they ran on as {ordinal, index}. The ordinal alone does not indicate whether the queue is a compute or a copy engine; that mapping lives in the device's command-queue-group properties, which THAPI did not record. Record a new curated event, lttng_ust_ze_properties:command_queue_group, carrying the per-device group-properties array, and in the ze interval analysis join each op's ordinal to that array. The group's capability flags field is a bitmask (COMPUTE|COPY|COOPERATIVE_KERNELS|METRICS, often several bits set at once), so decode every set bit into a list rather than collapse to a single type; unrecognised bits are reported as UNKNOWN. Device ops now print e.g. zeCommandListAppendMemoryCopy(H2D)[{ordinal: 1, index: 0, flags: [COPY]}] zeCommandListAppendMemoryCopy(H2D)[{ordinal: 0, index: 0, flags: [COMPUTE, COPY, COOPERATIVE_KERNELS]}] A missing table or out-of-range ordinal appends no flags, preserving the pre-fix output. Timings and byte counts are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
DonAurelio
force-pushed
the
fix-506-command-queue-ordinal-type
branch
from
August 4, 2026 19:31
58d2935 to
5f69443
Compare
The lint CI runs yamlfmt (go install ...@latest) on any changed YAML file. Current yamlfmt strips intra-bracket spaces ([ x ] -> [x]) and the leading document marker, but ze_events.yaml predates that default and carried 137 such violations across the whole file. Since the yamlfmt job only runs when a PR touches a .yaml file, the debt stayed latent until this change. This commit is a pure reformat (whitespace only, no semantic change, verified by comparing space-stripped content) so the yamlfmt check passes. Kept separate from the functional fix so it can be reverted independently. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
|
Can you rebase? The CI should pass now. |
Collaborator
Author
|
It seems the CI is failing now becasue I am adding a new trace point. |
Collaborator
|
Yep, no problem. Will review and merge! |
TApplencourt
approved these changes
Aug 5, 2026
Collaborator
|
I guess at some point we may want to refactor to have always some |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Level Zero device operations are tagged with the command queue they ran on as
{ordinal, index}. The ordinal alone does not say whether the queue is a compute engine or a copy engine — that mapping lives in the device's command-queue-group properties (zeDeviceGetCommandQueueGroupProperties), which THAPI did not record. So a trace could show:with no way to tell it ran on the copy engine. This is #506.
Fix
lttng_ust_ze_properties:command_queue_group, carrying the per-device group-properties array (queried in the existing per-device property dump, reusing the already-dlsym'd entry point).ordinalto that array and append the engine capability flags.The group
flagsfield is a bitmask (COMPUTE | COPY | COOPERATIVE_KERNELS | METRICS), and several bits are typically set at once (e.g. ordinal 0 =0x7), so every set bit is decoded into a list rather than collapsed to one type; unrecognised bits are reported asUNKNOWN.After the fix:
Validation
Recorded two raw traces (compute ordinal 0, copy ordinal 1) on an Intel Data Center GPU Max 1550 (Aurora), then replayed the same trace files through an unmodified baseline build (before) and the patched build (after). Only the analyzer differs, so every difference is attributable to this change:
{ordinal: 0, index: 0}{ordinal: 0, index: 0, flags: [COMPUTE, COPY, COOPERATIVE_KERNELS]}{ordinal: 1, index: 0}{ordinal: 1, index: 0, flags: [COPY]}Timings and byte counts are byte-identical before vs after (
2.96us/5.44us,4.10kB) — the change adds a label without perturbing measurement.Changes
5 edits, all in
backends/ze/:ze_events.yaml— declare the new eventtracer_ze_helpers.include.c— emit itbtx_zeinterval_callbacks.hpp— analysis-state map (device → ordinal-indexed group vector)btx_zeinterval_callbacks.cpp— populate/register callback + decode flags at the emit siteFixes #506
🤖 Generated with Claude Code