drm/amdgpu: Let BO created in its allowed_domain
Subsystems (2)
PATCH 1/1 drm/amdgpu: Let BO created in its allowed_domain
For any user BO, it is allowed to alloc memory in both GTT and VRAM domain. That means one VRAM BO could be eviced to GTT.
Now if device is already lack of VRAM, this BO could alloc memory from GTT directly without evicting other VRAM BO. In this way we can reduce memory evictions.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
@@ -579,7 +579,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, AMDGPU_GEM_DOMAIN_GDS))amdgpu_bo_placement_from_domain (bo ,AMDGPU_GEM_DOMAIN_CPU ); else - amdgpu_bo_placement_from_domain(bo, bp->domain); + amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);if (bp->type == ttm_bo_type_kernel) bo->tbo.priority =1 ;
Signature · 1 line
2.25.1
Am 17.09.21 um 09:04 schrieb xinhui pan:
Quoted 6 lines
For any user BO, it is allowed to alloc memory in both GTT and VRAM domain. That means one VRAM BO could be eviced to GTT.
Now if device is already lack of VRAM, this BO could alloc memory from GTT directly without evicting other VRAM BO. In this way we can reduce memory evictions.
NAK, that is intentional pressure on VRAM during allocation of new memory.
Christian.
Quoted 19 lines
Signed-off-by xinhui pan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -579,7 +579,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, AMDGPU_GEM_DOMAIN_GDS))amdgpu_bo_placement_from_domain (bo ,AMDGPU_GEM_DOMAIN_CPU ); else - amdgpu_bo_placement_from_domain(bo, bp->domain); + amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);if (bp->type == ttm_bo_type_kernel) bo->tbo.priority =1 ;
Pan, Xinhui
NAK[AMD Official Use Only]
Why? just to evict some inactive vram BOs?
________________________________
From: Koenig, Christian <[email protected]>
Sent: Friday, September 17, 2021 3:06:16 PM
To: Pan, Xinhui <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Let BO created in its allowed_domain
Am 17.09.21 um 09:04 schrieb xinhui pan:
Quoted 6 lines
For any user BO, it is allowed to alloc memory in both GTT and VRAM domain. That means one VRAM BO could be eviced to GTT.
Now if device is already lack of VRAM, this BO could alloc memory from GTT directly without evicting other VRAM BO. In this way we can reduce memory evictions.
NAK, that is intentional pressure on VRAM during allocation of new memory.
Christian.
Quoted 19 lines
Signed-off-by xinhui pan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -579,7 +579,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, AMDGPU_GEM_DOMAIN_GDS))amdgpu_bo_placement_from_domain (bo ,AMDGPU_GEM_DOMAIN_CPU ); else - amdgpu_bo_placement_from_domain(bo, bp->domain); + amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);if (bp->type == ttm_bo_type_kernel) bo->tbo.priority =1 ;
Christian König
maintainerExactly that, yes. The idea is that we want to create at least some pressure on VRAM when VRAM|GTT is specified.
Essentially we would like to have that for CS as well, but it's just hard to find the right balance between no pressure and the full pressure of VRAM placement for VRAM|GTT BOs.
It's on my todo list to tackle that and I'm currently working on an userspace tool to better simulate those setups, but it's just a side project.
Christian.
Am 17.09.21 um 09:35 schrieb Pan, Xinhui:
Quoted 45 lines
[AMD Official Use Only]
Why? just to evict some inactive vram BOs?
------------------------------------------------------------------------
*From:* Koenig, Christian <[email protected]>
*Sent:* Friday, September 17, 2021 3:06:16 PM
*To:* Pan, Xinhui <[email protected]>; [email protected] <[email protected]> *Cc:* Deucher, Alexander <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu: Let BO created in itsallowed_domain
Am 17.09.21 um 09:04 schrieb xinhui pan:Quoted 6 lines
For any user BO, it is allowed to alloc memory in both GTT and VRAM domain. That means one VRAM BO could be eviced to GTT.
Now if device is already lack of VRAM, this BO could alloc memory from GTT directly without evicting other VRAM BO. In this way we can reduce memory evictions.
NAK, that is intentional pressure on VRAM during allocation of new memory.
Christian.
Review
Quoted 7 lines
Signed-off-by xinhui pan <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.cdrivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create(struct amdgpu_device *adev, · line 580
Quoted 6 lines
index
66bb8a53bb20..9a547bb38cda100644drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0@@ -579,7 +579,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, AMDGPU_GEM_DOMAIN_GDS)) amdgpu_bo_placement_from_domain(bo,
AMDGPU_GEM_DOMAIN_CPU);Quoted 6 lines
else
-amdgpu_bo_placement_from_domain(bo, bp->domain); +amdgpu_bo_placement_from_domain(bo, bo->allowed_domains); if (bp->type==ttm_bo_type_kernel)
bo->tbo.priority= 1;