dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] drm/ttm,amdgpu: Introduce LRU bulk move functionality
@ 2018-08-13  9:58 Huang Rui
  2018-08-13  9:58 ` [PATCH v3 3/5] drm/ttm: add bulk move function on LRU Huang Rui
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Huang Rui @ 2018-08-13  9:58 UTC (permalink / raw)
  To: dri-devel, amd-gfx; +Cc: Huang Rui

The idea and proposal is originally from Christian, and I continue to work to
deliver it.

Background:
amdgpu driver will move all PD/PT and PerVM BOs into idle list. Then move all of
them on the end of LRU list one by one. Thus, that cause so many BOs moved to
the end of the LRU, and impact performance seriously.

Then Christian provided a workaround to not move PD/PT BOs on LRU with below
patch:
"drm/amdgpu: band aid validating VM PTs"
Commit 0bbf32026cf5ba41e9922b30e26e1bed1ecd38ae

However, the final solution should bulk move all PD/PT and PerVM BOs on the LRU
instead of one by one.

Whenever amdgpu_vm_validate_pt_bos() is called and we have BOs which need to be
validated we move all BOs together to the end of the LRU without dropping the
lock for the LRU.

While doing so we note the beginning and end of this block in the LRU list.

Now when amdgpu_vm_validate_pt_bos() is called and we don't have anything to do,
we don't move every BO one by one, but instead cut the LRU list into pieces so
that we bulk move everything to the end in just one operation.

Test data:
+--------------+-----------------+-----------+---------------------------------------+
|              |The Talos        |Clpeak(OCL)|BusSpeedReadback(OCL)                  |
|              |Principle(Vulkan)|           |                                       |
+------------------------------------------------------------------------------------+
|              |                 |           |0.319 ms(1k) 0.314 ms(2K) 0.308 ms(4K) |
| Original     |  147.7 FPS      |  76.86 us |0.307 ms(8K) 0.310 ms(16K)             |
+------------------------------------------------------------------------------------+
| Orignial + WA|                 |           |0.254 ms(1K) 0.241 ms(2K)              |
|(don't move   |  162.1 FPS      |  42.15 us |0.230 ms(4K) 0.223 ms(8K) 0.204 ms(16K)|
|PT BOs on LRU)|                 |           |                                       |
+------------------------------------------------------------------------------------+
| Bulk move    |  163.1 FPS      |  40.52 us |0.244 ms(1K) 0.252 ms(2K) 0.213 ms(4K) |
|              |                 |           |0.214 ms(8K) 0.225 ms(16K)             |
+--------------+-----------------+-----------+---------------------------------------+

After test them with above three benchmarks include vulkan and opencl. We can
see the visible improvement than original, and even better than original with
workaround.

Changes from V1 -> V2:
- Fix to missed the BOs in relocated/moved that should be also moved to the end
  of LRU.

Changes from V2 -> V3:
- Remove unused parameter and use list_for_each_entry instead of the one with
  save entry.

Thanks,
Rui

Christian König (2):
  drm/ttm: add helper structures for bulk moves on lru list
  drm/ttm: revise ttm_bo_move_to_lru_tail to support bulk moves

Huang Rui (3):
  drm/ttm: add bulk move function on LRU
  drm/amdgpu: use bulk moves for efficient VM LRU handling (v3)
  drm/amdgpu: move PD/PT bos on LRU again

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 75 ++++++++++++++++++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |  4 ++
 drivers/gpu/drm/ttm/ttm_bo.c           | 78 +++++++++++++++++++++++++++++++++-
 include/drm/ttm/ttm_bo_api.h           | 16 ++++++-
 include/drm/ttm/ttm_bo_driver.h        | 28 ++++++++++++
 5 files changed, 182 insertions(+), 19 deletions(-)

-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-08-17 10:06 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-13  9:58 [PATCH v3 0/5] drm/ttm,amdgpu: Introduce LRU bulk move functionality Huang Rui
2018-08-13  9:58 ` [PATCH v3 3/5] drm/ttm: add bulk move function on LRU Huang Rui
     [not found] ` <1534154331-11810-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2018-08-13  9:58   ` [PATCH v3 1/5] drm/ttm: add helper structures for bulk moves on lru list Huang Rui
     [not found]     ` <1534154331-11810-2-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2018-08-13 10:16       ` Christian König
     [not found]         ` <d0ebdd92-73a7-7959-4df0-391f3dd27526-5C7GfCeVMHo@public.gmane.org>
2018-08-14  2:02           ` zhoucm1
     [not found]             ` <b993176a-cf49-d3b7-9be1-feb7dc95456f-5C7GfCeVMHo@public.gmane.org>
2018-08-14  2:25               ` Huang Rui
2018-08-14  2:22           ` Zhang, Jerry (Junwei)
     [not found]             ` <5B723CEA.1070903-5C7GfCeVMHo@public.gmane.org>
2018-08-14  2:49               ` Huang Rui
2018-08-13  9:58   ` [PATCH v3 2/5] drm/ttm: revise ttm_bo_move_to_lru_tail to support bulk moves Huang Rui
2018-08-13  9:58   ` [PATCH v3 4/5] drm/amdgpu: use bulk moves for efficient VM LRU handling (v3) Huang Rui
2018-08-14  2:26     ` Zhang, Jerry (Junwei)
     [not found]       ` <5B723DE3.50005-5C7GfCeVMHo@public.gmane.org>
2018-08-14  3:05         ` Huang Rui
2018-08-14  6:45           ` Christian König
     [not found]             ` <4f7e6d61-0b4a-5c12-38a9-ea905b9f6234-5C7GfCeVMHo@public.gmane.org>
2018-08-14  7:24               ` Huang Rui
2018-08-14  7:35                 ` Christian König
     [not found]                   ` <e1635b5e-e5a1-c4cf-005c-1920c6fc86e0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-14  8:17                     ` Huang Rui
2018-08-13  9:58   ` [PATCH v3 5/5] drm/amdgpu: move PD/PT bos on LRU again Huang Rui
2018-08-16  0:41 ` [PATCH v3 0/5] drm/ttm,amdgpu: Introduce LRU bulk move functionality Dieter Nützel
     [not found]   ` <70f3ba4a773f5ee3d1c46bc63991702a-0hun7QTegEsDD4udEopG9Q@public.gmane.org>
2018-08-17 10:06     ` Huang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).