From: "Pierre-Loup A. Griffais" Subject: =?UTF-8?B?UmU6IFJl77yaW1BBVENIXSBkcm0vYW1kZ3B1OiByZXN2ZXJ0ICJkaXNh?= =?UTF-8?Q?ble_bulk_moves_for_now=22?= Date: Tue, 17 Sep 2019 14:56:44 -0700 Message-ID: References: <20190912101535.71686-1-christian.koenig@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0260363629==" Return-path: In-Reply-To: Content-Language: en-US List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: "Zhou, David(ChunMing)" , "Koenig, Christian" , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" --===============0260363629== Content-Language: en-US Content-Type: multipart/alternative; boundary="------------10F568794A1E5406AEBAF53B" --------------10F568794A1E5406AEBAF53B Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hello, Applying this locally, the issue we were seeing with very high submit=20 times in high-end workloads seems largely gone. My methodology is to=20 measure the total time spent in DRM_IOCTL_AMDGPU_CS with `strace -T` for=20 the whole first scene of the Shadow of the Tomb Raider benchmark, and=20 divide by the frame count in that scene to get an idea of how much CPU=20 time is spent in submissions per frame. More details below. On a Vega20 system with a 3900X, at High settings (~6 gigs of VRAM usage=20 according to UMR, no contention): =C2=A0- 5.2.14: 1.1ms per frame in CS =C2=A0- 5.2.14 + LRU bulk moves: 0.6ms per frame in CS On a Polaris10 system with a i7-7820X, at Very High Settings (7.7G/8G=20 VRAM used, no contention): =C2=A0- 5.2.15: 12.03ms per frame in CS (!) =C2=A0- 5.2.15 + LRU bulk moves:=C2=A0 1.35ms per frame in CS The issue is largely addressed. 1.35ms is still higher than I'd expect,=20 but it's still pretty reasonable. Note that on many of our usecases,=20 submission happens in a separate thread and doesn't typically impact=20 overall frame time/latency if you have extra CPU cores to work with.=20 However it very negatively affects performance as soon as the CPU gets=20 saturated, and burns a ton of power. Thanks! =C2=A0- Pierre-Loup Methodology details: # Mesa patched to kill() itself with SIGCONT in vkQueuePresent to act as=20 a frame marker in-band with the strace data. # strace collection: strace -f -p 13113 -e ioctl,kill -o sottr_first_scene_vanilla -T # frame count: cat sottr_first_scene_vanilla | grep kill\( | wc -l 616 # total time spent in _CS: cat sottr_first_scene_vanilla | grep AMDGPU_CS | grep -v unfinished | tr=20 -s ' '=C2=A0 | cut -d ' ' -f7 | tr -d \< | tr -d \> | xargs=C2=A0 | tr ' ' = '+' | bc 7.411782 # seconds to milliseconds, then divide by frame count (gdb) p 7.41 * 1000.0 / 616.0 $1 =3D 12.029220779220779 On 9/12/19 8:18 AM, Zhou, David(ChunMing) wrote: > I dont know dkms status=EF=BC=8Canyway, we should submit this one as earl= y as=20 > possible. > > -------- =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 -------- > =E4=B8=BB=E9=A2=98=EF=BC=9ARe: [PATCH] drm/amdgpu: resvert "disable bulk = moves for now" > =E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=9AChristian K=C3=B6nig > =E6=94=B6=E4=BB=B6=E4=BA=BA=EF=BC=9A"Zhou, David(ChunMing)" ,amd-gfx@list= s.freedesktop.org > =E6=8A=84=E9=80=81=EF=BC=9A > > Just to double check: We do have that enabled in the DKMS package for a > while and doesn't encounter any more problems with it, correct? > > Thanks, > Christian. > > Am 12.09.19 um 16:02 schrieb Chunming Zhou: > > RB on it to go ahead. > > > > -David > > > > =E5=9C=A8 2019/9/12 18:15, Christian K=C3=B6nig =E5=86=99=E9=81=93: > >> This reverts commit a213c2c7e235cfc0e0a161a558f7fdf2fb3a624a. > >> > >> The changes to fix this should have landed in 5.1. > >> > >> Signed-off-by: Christian K=C3=B6nig > >> --- > >>=C2=A0=C2=A0=C2=A0 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 -- > >>=C2=A0=C2=A0=C2=A0 1 file changed, 2 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c=20 > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > >> index 48349e4f0701..fd3fbaa73fa3 100644 > >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > >> @@ -603,14 +603,12 @@ void amdgpu_vm_move_to_lru_tail(struct=20 > amdgpu_device *adev, > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct ttm_bo_global *glob =3D ade= v->mman.bdev.glob; > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct amdgpu_vm_bo_base *bo_base; > >> > >> -#if 0 > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (vm->bulk_moveable) { > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 spin_lock(&glob->lru_lock); > >> ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 spin_unlock(&glob->lru_lock); > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 return; > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > >> -#endif > >> > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 memset(&vm->lru_bulk_move, 0, size= of(vm->lru_bulk_move)); > >> > > > _______________________________________________ > amd-gfx mailing list > amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx --------------10F568794A1E5406AEBAF53B Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hello,

Applying this locally, the issue we were seeing with very high submit times in high-end workloads seems largely gone. My methodology is to measure the total time spent in DRM_IOCTL_AMDGPU_CS with `strace -T` for the whole first scene of the Shadow of the Tomb Raider benchmark, and divide by the frame count in that scene to get an idea of how much CPU time is spent in submissions per frame. More details below.

On a Vega20 system with a 3900X, at High settings (~6 gigs of VRAM usage according to UMR, no contention):

=C2=A0- 5.2.14: 1.1ms per frame in CS

=C2=A0- 5.2.14 + LRU bulk moves: 0.6ms per frame in CS

On a Polaris10 system with a i7-7820X, at Very High Settings (7.7G/8G VRAM used, no contention):

=C2=A0- 5.2.15: 12.03ms per frame in CS (!)

=C2=A0- 5.2.15 + LRU bulk moves:=C2=A0 1.35ms per frame in CS

The issue is largely addressed. 1.35ms is still higher than I'd expect, but it's still pretty reasonable. Note that on many of our usecases, submission happens in a separate thread and doesn't typically impact overall frame time/latency if you have extra CPU cores to work with. However it very negatively affects performance as soon as the CPU gets saturated, and burns a ton of power.

Thanks!

=C2=A0- Pierre-Loup

Methodology details:

# Mesa patched to kill() itself with SIGCONT in vkQueuePresent to act as a frame marker in-band with the strace data.

# strace collection:

strace -f -p 13113 -e ioctl,kill -o sottr_first_scene_vanilla -T

# frame count:

cat sottr_first_scene_vanilla | grep kill\( | wc -l
616

# total time spent in _CS:

cat sottr_first_scene_vanilla | grep AMDGPU_CS | grep -v unfinished | tr -s ' '=C2=A0 | cut -d ' ' -f7 | tr -d \< | tr -d \> | xargs=C2=A0 | tr ' ' '+' | bc
7.411782

# seconds to milliseconds, then divide by frame count

(gdb) p 7.41 * 1000.0 / 616.0
$1 =3D 12.029220779220779

On 9/12/19 8:18 AM, Zhou, David(ChunMing) wrote:
I dont know dkms status=EF=BC=8Canyway, we should submit this on= e as early as possible.

-------- =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 --------
=E4=B8=BB=E9=A2=98=EF=BC=9ARe: [PATCH] drm/amdgpu: resvert "disable= bulk moves for now"
=E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=9AChristian K=C3=B6nig
=E6=94=B6=E4=BB=B6=E4=BA=BA=EF=BC=9A"Zhou, David(ChunMing)" ,amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
=E6=8A=84=E9=80=81=EF=BC=9A

Just to double check: We do have that enabled in the DKMS package for a
while and doesn't encounter any more problems with it, correct?

Thanks,
Christian.

Am 12.09.19 um 16:02 schrieb Chunming Zhou:
> RB on it to go ahead.
>
> -David
>
> =E5=9C=A8 2019/9/12 18:15, Christian K=C3=B6nig =E5=86=99= =E9=81=93:
>> This reverts commit a213c2c7e235cfc0e0a161a558f7fdf2fb3a624a.
>>
>> The changes to fix this should have landed in 5.1.
>>
>> Signed-off-by: Christian K=C3=B6nig <christian.koenig-5C7GfCeVMHo@public.gmane.org>
>> ---
>>=C2=A0=C2=A0=C2=A0 drivers/gpu/drm/amd/amdgpu/amdgpu_vm= .c | 2 --
>>=C2=A0=C2=A0=C2=A0 1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 48349e4f0701..fd3fbaa73fa3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -603,14 +603,12 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev,
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct ttm_bo_glob= al *glob =3D adev->mman.bdev.glob;
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct amdgpu_vm_b= o_base *bo_base;
>>=C2=A0=C2=A0=C2=A0
>> -#if 0
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (vm->bulk_mo= veable) {
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 spin_lock(&glob->lru_lock);
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move);
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 spin_unlock(&glob->lru_lock);
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return;
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
>> -#endif
>>=C2=A0=C2=A0=C2=A0
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 memset(&vm->= ;lru_bulk_move, 0, sizeof(vm->lru_bulk_move));
>>=C2=A0=C2=A0=C2=A0


______________________________=
_________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-=
gfx
--------------10F568794A1E5406AEBAF53B-- --===============0260363629== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4 --===============0260363629==--