<div dir="ltr"><div>You can run:</div><div>AMD_DEBUG=testdmaperf glxgears</div><div><br></div><div>It tests transfer sizes of up to 128 MB, and it tests ~60 slightly different methods of transfering data.<br></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 4:07 AM Michel Dänzer <<a href="mailto:michel@daenzer.net" target="_blank">michel@daenzer.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2019-07-02 11:49 a.m., Timur Kristóf wrote:<br>
> On Tue, 2019-07-02 at 10:09 +0200, Michel Dänzer wrote:<br>
>> On 2019-07-01 6:01 p.m., Timur Kristóf wrote:<br>
>>> On Mon, 2019-07-01 at 16:54 +0200, Michel Dänzer wrote:<br>
>>>> On 2019-06-28 2:21 p.m., Timur Kristóf wrote:<br>
>>>>> I haven't found a good way to measure the maximum PCIe<br>
>>>>> throughput<br>
>>>>> between the CPU and GPU,<br>
>>>><br>
>>>> amdgpu.benchmark=3<br>
>>>><br>
>>>> on the kernel command line will measure throughput for various<br>
>>>> transfer<br>
>>>> sizes during driver initialization.<br>
>>><br>
>>> Thanks, I will definitely try that.<br>
>>> Is this the only way to do this, or is there a way to benchmark it<br>
>>> after it already booted?<br>
>><br>
>> The former. At least in theory, it's possible to unload the amdgpu<br>
>> module while nothing is using it, then load it again.<br>
> <br>
> Okay, so I booted my system with amdgpu.benchmark=3<br>
> You can find the full dmesg log here: <a href="https://pastebin.com/zN9FYGw4" rel="noreferrer" target="_blank">https://pastebin.com/zN9FYGw4</a><br>
> <br>
> The result is between 1-5 Gbit / sec depending on the transfer size<br>
> (the higher the better), which corresponds to neither the 8 Gbit / sec<br>
> that the kernel thinks it is limited to, nor the 20 Gbit / sec which I<br>
> measured earlier with pcie_bw.<br>
<br>
5 Gbit/s throughput could be consistent with 8 Gbit/s theoretical<br>
bandwidth, due to various overhead.<br>
<br>
<br>
> Since pcie_bw only shows the maximum PCIe packet size (and not the<br>
> actual size), could it be that it's so inaccurate that the 20 Gbit /<br>
> sec is a fluke?<br>
<br>
Seems likely or at least plausible.<br>
<br>
<br>
>>>>> but I did take a look at AMD's sysfs interface at<br>
>>>>> /sys/class/drm/card1/device/pcie_bw which while running the<br>
>>>>> bottlenecked<br>
>>>>> game. The highest throughput I saw there was only 2.43 Gbit<br>
>>>>> /sec.<br>
>>>><br>
>>>> PCIe bandwidth generally isn't a bottleneck for games, since they<br>
>>>> don't<br>
>>>> constantly transfer large data volumes across PCIe, but store<br>
>>>> them in<br>
>>>> the GPU's local VRAM, which is connected at much higher<br>
>>>> bandwidth.<br>
>>><br>
>>> There are reasons why I think the problem is the bandwidth:<br>
>>> 1. The same issues don't happen when the GPU is not used with a TB3<br>
>>> enclosure.<br>
>>> 2. In case of radeonsi, the problem was mitigated once Marek's SDMA<br>
>>> patch was merged, which hugely reduces the PCIe bandwidth use.<br>
>>> 3. In less optimized cases (for example D9VK), the problem is still<br>
>>> very noticable.<br>
>><br>
>> However, since you saw as much as ~20 Gbit/s under different<br>
>> circumstances, the 2.43 Gbit/s used by this game clearly isn't a hard<br>
>> limit; there must be other limiting factors.<br>
> <br>
> There may be other factors, yes. I can't offer a good explanation on<br>
> what exactly is happening, but it's pretty clear that amdgpu can't take<br>
> full advantage of the TB3 link, so it seemed like a good idea to start<br>
> investigating this first.<br>
<br>
Yeah, actually it would be consistent with ~16-32 KB granularity<br>
transfers based on your measurements above, which is plausible. So<br>
making sure that the driver doesn't artificially limit the PCIe<br>
bandwidth might indeed help.<br>
<br>
OTOH this also indicates a similar potential for improvement by using<br>
larger transfers in Mesa and/or the kernel.<br>
<br>
<br>
-- <br>
Earthling Michel Dänzer               |              <a href="https://www.amd.com" rel="noreferrer" target="_blank">https://www.amd.com</a><br>
Libre software enthusiast             |             Mesa and X developer<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank">dri-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a></blockquote></div>