[Mesa-dev] [PATCH 8/8] r600: add support for hw atomic counters. (v3)

Nicolai Hähnle nhaehnle at gmail.com
Tue Nov 7 21:54:39 UTC 2017


On 07.11.2017 19:38, Dave Airlie wrote:
> On 8 November 2017 at 03:26, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
>> On 07.11.2017 07:31, Dave Airlie wrote:
>>>
>>> From: Dave Airlie <airlied at redhat.com>
>>>
>>> This adds support for the evergreen/cayman atomic counters.
>>>
>>> These are implemented using GDS append/consume counters. The values
>>> for each counter are loaded before drawing and saved after each draw
>>> using special CP packets.
>>
>>
>> I admit I'm a bit confused by this at the hardware level.
>>
>> My understanding of GDS is that it's mostly another copy of LDS (but
>> global), and all GDS instructions are atomic by default. There is extra
>> append-consume hardware, but it's main point is to support use cases where
>> operations have to be ordered by wave, or where a wave return is supposed to
>> be blocked (for producer/consumer kernels and ring buffer management).
>>
>> So this should really work without the append/consume counters as well, just
>> with regular GDS memory. Is there a particular reason why you haven't done
>> that? I suppose it might require more stuff to manage GDS allocations in the
>> kernel, and if it works with this approach...
> 
> Because this is what the closed source driver did. I've pretty much
> had to program
> this from traces I took from it.
> 
> I don't want to diverge too much from what it did as debugging gets harder.
> 
> The append/consume counters should be faster than GDS, and it looks to be why
> this extension was created in the first place.

The append/consume counters are physically part of the GDS block :)

But it's possible that they're better optimized for the case where all 
threads in a "wave" attempt to access the same counter. In GDS memory 
you'd quite likely get slowed down by non-stop bank conflicts, while the 
append counters might have special hardware to deal with the issue.

Cheers,
Nicolai

> 
>> Acked-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> Thanks.
> Dave.
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list