Skip to content

[XPTI][SYCL] Add APIs to control stream detail level#21680

Draft
againull wants to merge 5 commits intointel:syclfrom
againull:stream_detail_level
Draft

[XPTI][SYCL] Add APIs to control stream detail level#21680
againull wants to merge 5 commits intointel:syclfrom
againull:stream_detail_level

Conversation

@againull
Copy link
Copy Markdown
Contributor

@againull againull commented Apr 2, 2026

  • Add xptiSubscriberInit and xptiSubscriberFinish callback APIs
  • Add xptiSetSubscriberStreamDetailLevel and xptiGetEffectiveStreamDetailLevel APIS for subscribers to set their desired detail level for a specific stream and for producers query the effective detail level to determine what optional data to emit
  • Update sycl runtime to use those levels of control for "sycl" stream.

againull added 5 commits April 2, 2026 07:20
Implement optional subscriber lifecycle callbacks that are invoked once
per subscriber instance (when loaded/unloaded), distinct from the
per-stream xptiTraceInit/xptiTraceFinish callbacks.

Changes:
- Add xpti_subscriber_handle_t opaque handle type
- Add xptiSubscriberInit(handle) called when subscriber is loaded
- Add xptiSubscriberFinish(handle) called when subscriber is unloaded
- Update framework to invoke callbacks if present
- Add example implementations to basic_collector
- Update documentation with usage information

These callbacks are optional and backward compatible with existing
subscribers that do not implement them.
This commit introduces two new APIs that allow subscribers to request
different levels of optional data emission from producers on a per-stream
basis:

- xptiSetSubscriberStreamDetailLevel: Subscribers set their desired detail
  level for a specific stream
- xptiGetEffectiveStreamDetailLevel: Producers query the effective detail
  level to determine what optional data to emit

Key features:
- Four ordered detail levels: NONE, BASIC, NORMAL (default), VERBOSE
- Aggregation rule: effective level is the maximum across all subscribers
- Lock-free atomic reads for the get API (optimized for hot path)
- Recalculation only on set (cold path during initialization)
- Backward compatible: defaults to NORMAL level

Implementation details:
- Uses fixed-size atomic array indexed by stream_id for O(1) lock-free reads
- Effective levels cached per stream and updated only when subscribers
  change their requests
- Comprehensive documentation in XPTI_Framework.md with usage examples
Apply stream detail level control to SYCL RT while preserving full
backward compatibility with existing sycl.debug stream subscribers.

Changes:
- Use dual-path checks (Level >= VERBOSE || isDebugStream()) for
  verbose metadata emission in commands.cpp and queue_impl.cpp
- This ensures verbose metadata is emitted when either:
  * A subscriber requests VERBOSE on sycl stream (new approach), OR
  * A subscriber registers for sycl.debug stream (old approach)
- Update documentation to describe detail level control feature
- Add metadata table showing which detail level provides each field

Backward compatibility:
- Existing tools using sycl.debug continue to work unchanged
- New tools can request BASIC level for minimal overhead (PTI use case)
- Both approaches can coexist during migration period
@againull againull force-pushed the stream_detail_level branch from 4c335c6 to ac9c6bc Compare April 3, 2026 22:13
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