<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 4, 2023 at 9:19 AM Lazar, Lijo <<a href="mailto:lijo.lazar@amd.com">lijo.lazar@amd.com</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"><br>
<br>
On 1/4/2023 7:43 PM, Marek Olšák wrote:<br>
> On Wed, Jan 4, 2023 at 6:50 AM Lazar, Lijo <<a href="mailto:lijo.lazar@amd.com" target="_blank">lijo.lazar@amd.com</a> <br>
> <mailto:<a href="mailto:lijo.lazar@amd.com" target="_blank">lijo.lazar@amd.com</a>>> wrote:<br>
> <br>
> <br>
> <br>
> On 1/4/2023 4:11 AM, Marek Olšák wrote:<br>
> > I see. Well, those sysfs files are not usable, and I don't think it<br>
> > would be important even if they were usable, but for completeness:<br>
> ><br>
> > The ioctl returns:<br>
> > pcie_gen = 1<br>
> > pcie_num_lanes = 16<br>
> ><br>
> > Theoretical bandwidth from those values: 4.0 GB/s<br>
> > My DMA test shows this write bandwidth: 3.5 GB/s<br>
> > It matches the expectation.<br>
> ><br>
> > Let's see the devices (there is only 1 GPU Navi21 in the system):<br>
> > $ lspci |egrep '(PCI|VGA).*Navi'<br>
> > 0a:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi<br>
> 10 XL<br>
> > Upstream Port of PCI Express Switch (rev c3)<br>
> > 0b:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi<br>
> 10 XL<br>
> > Downstream Port of PCI Express Switch<br>
> > 0c:00.0 VGA compatible controller: Advanced Micro Devices, Inc.<br>
> > [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] (rev c3)<br>
> ><br>
> > Let's read sysfs:<br>
> ><br>
> > $ cat /sys/bus/pci/devices/0000:0a:00.0/current_link_width<br>
> > 16<br>
> > $ cat /sys/bus/pci/devices/0000:0b:00.0/current_link_width<br>
> > 16<br>
> > $ cat /sys/bus/pci/devices/0000:0c:00.0/current_link_width<br>
> > 16<br>
> > $ cat /sys/bus/pci/devices/0000:0a:00.0/current_link_speed<br>
> > 2.5 GT/s PCIe<br>
> > $ cat /sys/bus/pci/devices/0000:0b:00.0/current_link_speed<br>
> > 16.0 GT/s PCIe<br>
> > $ cat /sys/bus/pci/devices/0000:0c:00.0/current_link_speed<br>
> > 16.0 GT/s PCIe<br>
> ><br>
> > Problem 1: None of the speed numbers match 4 GB/s.<br>
> <br>
> US bridge = 2.5GT/s means operating at PCIe Gen 1 speed. Total<br>
> theoretical bandwidth is then derived based on encoding and total<br>
> number<br>
> of lanes.<br>
> <br>
> > Problem 2: Userspace doesn't know the bus index of the bridges,<br>
> and it's<br>
> > not clear which bridge should be used.<br>
> <br>
> In general, modern ones have this arch= US->DS->EP. US is the one<br>
> connected to physical link.<br>
> <br>
> > Problem 3: The PCIe gen number is missing.<br>
> <br>
> Current link speed is based on whether it's Gen1/2/3/4/5.<br>
> <br>
> BTW, your patch makes use of capabilities flags which gives the maximum<br>
> supported speed/width by the device. It may not necessarily reflect the<br>
> current speed/width negotiated. I guess in NV, this info is already<br>
> obtained from PMFW and made available through metrics table.<br>
> <br>
> <br>
> It computes the minimum of the device PCIe gen and the motherboard/slot <br>
> PCIe gen to get the final value. These 2 lines do that. The low 16 bits <br>
> of the mask contain the device PCIe gen mask. The high 16 bits of the <br>
> mask contain the slot PCIe gen mask.<br>
> + pcie_gen_mask = adev->pm.pcie_gen_mask & (adev->pm.pcie_gen_mask >> 16);<br>
> + dev_info->pcie_gen = fls(pcie_gen_mask);<br>
> <br>
<br>
With DPM in place on some ASICs, how much does this static info help for <br>
upper level apps?<br></blockquote><div><br></div>It helps UMDs make better decisions if they know the maximum achievable bandwidth. UMDs also compute the maximum memory bandwidth and compute performance (FLOPS). Right now it's printed by Mesa to give users detailed information about their GPU. For example:<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">$ AMD_DEBUG=info glxgears<br>Device info:<br> name = NAVI21<br> marketing_name = AMD Radeon RX 6800<br> num_se = 3<br> num_rb = 12<br> num_cu = 60<br> max_gpu_freq = 2475 MHz<br> max_gflops = 19008 GFLOPS<br> l0_cache_size = 16 KB<br> l1_cache_size = 128 KB<br> l2_cache_size = 4096 KB<br> l3_cache_size = 128 MB<br> memory_channels = 16 (TCC blocks)<br> memory_size = 16 GB (16384 MB)<br> memory_freq = 16 GHz<br> memory_bus_width = 256 bits<br> memory_bandwidth = 512 GB/s<br> pcie_gen = 1<br> pcie_num_lanes = 16<br> pcie_bandwidth = 4.0 GB/s</div><div class="gmail_quote"><br></div><div class="gmail_quote">Marek<br></div></div>