handle clusters - #206
Conversation
5b5bb47 to
5af76b9
Compare
|
Here is a sample output of "info threads" with clusters: And "info dispatches": |
The function 'amdgpu_used_lanes_count' in amdgpu-tdep.c and the function 'lane_workgroup_pos' in amd-dbgapi-target.c both compute partial workgroup sizes the same way. Extract the common code into a function named 'partial_workgroup_sizes' and reuse. This is a refactoring with no behavioral change.
5af76b9 to
4c9d135
Compare
|
Test is updated. It now includes synchronization and checks blockIdx dimensions as obtained from the program to those calculated based on cluster&wg coordinates. |
|
|
||
| @smallexample | ||
| AMDGPU Wave @var{agent-id}:@var{queue-id}:@var{dispatch-id}:@var{wave-id} (@var{work-group-x},@var{work-group-y},@var{work-group-z})/@var{work-group-thread-index} | ||
| AMDGPU Wave @var{agent-id}:@var{queue-id}:@var{dispatch-id}:@var{wave-id} (@var{cluster-x},@var{cluster-y},@var{cluster-z})/(@var{work-group-x},@var{work-group-y},@var{work-group-z})/@var{work-group-thread-index} |
There was a problem hiding this comment.
just random thought.
When imagining this initially, I kind of assumed we would use something like {cx,cy,cz}(x,y,z)/n with cluster dimensions in another set of brackets ({}). Not to say I mind the cluster/wg/wave approach, I am not sure I have a strong opinion at this point, but wanted to drop this as a note.
There was a problem hiding this comment.
just random thought.
When imagining this initially, I kind of assumed we would use something like
{cx,cy,cz}(x,y,z)/nwith cluster dimensions in another set of brackets ({}). Not to say I mind thecluster/wg/waveapproach, I am not sure I have a strong opinion at this point, but wanted to drop this as a note.
I have no objections to using braces.
| int bz = blockIdx.z; | ||
|
|
||
| /* Define a barrier to also test debuggability in the existence of | ||
| synchronization. */ |
There was a problem hiding this comment.
the interesting debugability part here would be if some waves / workgroups reached the barrier when some other have not. Seems that in this case, breaking everyone after the barrier limits the probabilities of having some waves before and some after the barrier.
There was a problem hiding this comment.
the interesting debugability part here would be if some waves / workgroups reached the barrier when some other have not. Seems that in this case, breaking everyone after the barrier limits the probabilities of having some waves before and some after the barrier.
I don't fully follow. In principle, when we break at or before the barrier, there is always a possibility that some waves are behind. Only after the barrier we have the guarantee that all waves are now beyond the barrier. That's the purpose of having a barrier, no?
I mean, if I break before the barrier and not all waves are there, why should that be a bug? It would be just a timing issue.
There was a problem hiding this comment.
The isa has a split barrier model, where waves need to notify when they arrive at the barrier, then wait on it. The barrier has an internal state counting how many waves have signaled (s_barrier_signal), and will keep signaled waves from continuing (s_barrier_wait) until all have signaled. During debug events, we trigger context save. The main thing (which has had issues in the past) which could get wrong during context save is not saving / restoring the barrier state correctly. This is what is tested by gdb.rocm/device-barrier.exp at the workgroup level. I think my point is that while at introducing cluster concepts, it might be worth introducing a similar test exercising cluster barrier save and restore.
There was a problem hiding this comment.
Ok, thanks for the clarification. The cluster API has barrier_arrive and barrier_wait separately, for which there is a comment for sync:
// Sync the cluster, equivalent to c.barrier_wait(c.barrier_arrive());
How about having barrier_arrive and barrier_wait, with a breakpoint in-between? That sounds like it should satisfy the previously problematic scenario.
There was a problem hiding this comment.
A good test would probably test the following cases:
- some of the waves have called arrived, and are now waiting (or about to)
- all the waves have called arrived, but none have called wait
- all have called arrived, some have called wait (so might be past the barrier)
but maybe it feels this particular matrix would be in a different test as checking the workgroup cluster dimensions.
There was a problem hiding this comment.
but maybe it feels this particular matrix would be in a different test as checking the workgroup cluster dimensions.
Agree.
lancesix
left a comment
There was a problem hiding this comment.
also, shouldn't we have some configury stuff to check dbgapi's version to be sure AMD_DBGAPI_DISPATCH_INFO_CLUSTER_SIZES is provided?
In nowhere else we have a similar check. I thought we'd first merge dbgapi PR, which bumps the version, and then build ROCgdb with that version, which brings us the guard here: |
We have https://github.com/ROCm/ROCgdb/blob/amd-staging/gdb/configure.ac#L330-L331 which currently guards building GDB with 0.80 or more. Either we wait for dbgapi to land, and when we have the right version bump configure.ac in this PR, or have something more dynamic (we do not have this yet) where configure can test dbgapi for this feature (use |
Ok, gotcha. I'll go with incrementing the configure version in this PR and leave the dynamic detection to a separate feature task. |
4c9d135 to
2d1a559
Compare
|
The last push updates the document, removes |
Starting with gfx1250, workgroups may be organized into clusters, giving a workitem -> wave -> workgroup -> cluster -> grid hierarchy. Handle clusters by taking them into account when calculating workitem/lane coordinates, when showing wave target ids, and in the "info dispatches" command.
2d1a559 to
1c0dea6
Compare
|
The last push converts in-grid group ids to in-cluster group ids. |
Motivation
New feature: workgroup clusters
Technical Details
Workgroups can be organized in clusters. dbgapi provides new query functions. Use these queries to show cluster information.
Test Plan
A basic test is included.