drm/amdgpu: always allocate cleared VRAM for GEM allocations
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu: always allocate cleared VRAM for GEM allocations
This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.
In addition this fixes the high CPU spikes seen when doing wipe on release.
v2: always set AMDGPU_GEM_CREATE_VRAM_CLEARED (Christian)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -0
@@ -349,6 +349,9 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } +/* always clear VRAM */ + flags |=AMDGPU_GEM_CREATE_VRAM_CLEARED ; +/* create a gem object to contain this object in */ if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA )) {
Signature · 1 line
2.46.0
this will fix performance issues,
Quoted 33 lines · Alex Deucher
This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.
In addition this fixes the high CPU spikes seen when doing wipe on release.
v2: always set
AMDGPU_GEM_CREATE_VRAM_CLEARED(Christian)Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")Reviewed-by Michel Dänzer<[email protected]> (v1)Signed-off-by Alex Deucher<[email protected]>Cc Arunpravin Paneer Selvam<[email protected]>Cc Christian König<[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-0@@ -349,6 +349,9 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } +/* always clear VRAM */ + flags |=AMDGPU_GEM_CREATE_VRAM_CLEARED ; +/* create a gem object to contain this object in */ if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA )) {
Can you also bump the DRM version, so that userspace knows when to skip its own clear?
Also, clearing with SDMA takes up to 33 times more time (= is up to 97% slower) than clearing with compute.
Marek
Quoted 41 lines · Arunpravin
this will fix performance issues,
On 8/29/2024 10:56 PM, Alex Deucher wrote:
This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.
In addition this fixes the high CPU spikes seen when doing wipe on release.
v2: always set
AMDGPU_GEM_CREATE_VRAM_CLEARED(Christian)Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")Reviewed-by Michel Dänzer <[email protected]> (v1)Signed-off-by Alex Deucher <[email protected]>Cc Arunpravin Paneer Selvam <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-0@@ -349,6 +349,9 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } +/* always clear VRAM */ + flags |=AMDGPU_GEM_CREATE_VRAM_CLEARED ; +/* create a gem object to contain this object in */ if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA )) {
Quoted 3 lines · Marek Olšák
Can you also bump the DRM version, so that userspace knows when to skip its own clear?
Sure, although going forward, it might be better to migrate to a generic flags query in the INFO ioctl so we can just check for various feature bits so we can backport functionality to older kernels more easily.
Alex
Quoted 49 lines
Also, clearing with SDMA takes up to 33 times more time (= is up to 97% slower) than clearing with compute.
Marek
Quoted 41 lines · Arunpravin
this will fix performance issues,
On 8/29/2024 10:56 PM, Alex Deucher wrote:
This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.
In addition this fixes the high CPU spikes seen when doing wipe on release.
v2: always set
AMDGPU_GEM_CREATE_VRAM_CLEARED(Christian)Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")Reviewed-by Michel Dänzer <[email protected]> (v1)Signed-off-by Alex Deucher <[email protected]>Cc Arunpravin Paneer Selvam <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-0@@ -349,6 +349,9 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } +/* always clear VRAM */ + flags |=AMDGPU_GEM_CREATE_VRAM_CLEARED ; +/* create a gem object to contain this object in */ if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA )) {
Quoted 10 lines · Alex Deucher
Quoted 3 lines · Marek Olšák
Can you also bump the DRM version, so that userspace knows when to skip its own clear?
Sure, although going forward, it might be better to migrate to a generic flags query in the INFO ioctl so we can just check for various feature bits so we can backport functionality to older kernels more easily.
How it's exposed is up to you.
Marek
Thanks, I will try clearing with compute and check the performance.
Regards,
Arun.
Quoted 50 lines · Marek Olšák
Can you also bump the DRM version, so that userspace knows when to skip its own clear?
Also, clearing with SDMA takes up to 33 times more time (= is up to 97% slower) than clearing with compute.
Marek
Quoted 40 lines · Arunpravin
this will fix performance issues,
On 8/29/2024 10:56 PM, Alex Deucher wrote:
This adds allocation latency, but aligns better with user expectations. The latency should improve with the drm buddy clearing patches that Arun has been working on.
In addition this fixes the high CPU spikes seen when doing wipe on release.
v2: always set
AMDGPU_GEM_CREATE_VRAM_CLEARED(Christian)Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")Reviewed-by Michel Dänzer <[email protected]> (v1)Signed-off-by Alex Deucher <[email protected]>Cc Arunpravin Paneer Selvam <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-0@@ -349,6 +349,9 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } +/* always clear VRAM */ + flags |=AMDGPU_GEM_CREATE_VRAM_CLEARED ; +/* create a gem object to contain this object in */ if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |AMDGPU_GEM_DOMAIN_GWS |AMDGPU_GEM_DOMAIN_OA )) {