feat(rocprofiler-sdk): share per-agent ATT resources across contexts - #8644
feat(rocprofiler-sdk): share per-agent ATT resources across contexts#8644minseobshin11 wants to merge 14 commits into
Conversation
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
| } | ||
|
|
||
| void | ||
| DispatchThreadTracer::register_shared_queue_sizes() |
There was a problem hiding this comment.
This is duplicated. Maybe join with above function?
| } | ||
|
|
||
| void | ||
| DeviceThreadTracer::register_shared_queue_sizes() |
| { | ||
| if(ctx->device_thread_trace) ctx->device_thread_trace->register_shared_buffer_sizes(); | ||
| if(ctx->dispatch_thread_trace) ctx->dispatch_thread_trace->register_shared_buffer_sizes(); | ||
| if(ctx->device_thread_trace) |
There was a problem hiding this comment.
You can revert this change if they are joined
There was a problem hiding this comment.
true-- changed
| // Max triple-buffer staging size requested by any context on this agent; the | ||
| // shared queue is created with this size so every context's flips fit. | ||
| uint64_t max_triple_buffer_size = 0; | ||
| att_queue_ptr_t queue = {}; |
There was a problem hiding this comment.
Maybe join with the buffer struct? They have the same semantics.
(not mandatory)
There was a problem hiding this comment.
left them separate because their contents diverged after changes
| // Keep each context active across a few dispatches so it reliably captures one. | ||
| constexpr uint64_t CAPTURE_WINDOW = 2; | ||
|
|
||
| // Repro mode for the AILIKFD-39 teardown hang: start one context and never stop it, |
There was a problem hiding this comment.
Why are we reproing it here?
| if(leave_active()) | ||
| { | ||
| // Deliberately do NOT stop the trace context: leave SQTT active so rocprofiler | ||
| // teardown destroys the still-active per-agent tracers one-by-one (AILIKFD-39). |
There was a problem hiding this comment.
same comment
Also, this is unlikely to work in dispatch mode
|
|
||
| // Not every target_cu is guaranteed to have active waves, so require that MOST | ||
| // configs produced data rather than all. | ||
| assert(captured * 4 >= configured * 3 && "most configs should capture data"); |
There was a problem hiding this comment.
This is not not going to fail even if the profiler gave you the same header-only buffer every time. You need to verify the waves are (mostly) valid in the capture window and that they are all in the correct SIMD/CUs you selected in the configuration.
There was a problem hiding this comment.
Note that SIMD selection is different for gfx >= 10, you need to take SEL%4 while for gfx9 you take the bitmask.
Then in the validation: Verify you don't get wave_t from simd/cus you didnt ask for, and that you do get (most) of them for the ones you did. To verify waves are valid, you can check the instructions have a valid PC address (except for TRAP and for the first few in case of gfx1250).
There was a problem hiding this comment.
fixed so that the test now decodes every captured trace and asserts real content
There was a problem hiding this comment.
I believe gfx9 emits all the wave records for all four SIMDs regardless of the requested simd_select - is there a way to validate on gfx10+
There was a problem hiding this comment.
We also need to cover device thread trace
There was a problem hiding this comment.
added more tests to cover
6fd101b to
00a0b6f
Compare
6a85b04 to
a442878
Compare
00a0b6f to
7178390
Compare
8d51e5a to
3ae7f3c
Compare
3ae7f3c to
eacd73b
Compare
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |



Motivation
ATT allocates heavyweight resources per context and per agent, even though only one thread trace can use an agent at a time:
HSA_AGENT_INFO_QUEUES_MAXis 128 ongfx942and is shared with the application's own queues; exceeding it aborts.This PR gives each GPU agent a single resource owner. Contexts targeting the same agent reuse its output slots, submission queue, and CPU staging buffers.
Technical Details
shared_trace_resources.{hpp,cpp}with oneAgentTraceResourcesper agent, owning the submission queue, CPU staging buffers, and GPU output slots.shared_ptr, so a buffer cannot be released while anything still references it.iresolves to the same buffer for every context on an agent. Host-visible allocations stay per packet.JIRA ID
AIPROFSDK-102
Test Plan
gfx942).Test Result
thread-trace-packet-test: 9/9 passed.thread-trace-producer-consumer-test: 10/10 passed.Submission Checklist