drm/amdgpu: always allocate cleared VRAM for KFD allocations
Subsystems (3)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu: always allocate cleared VRAM for KFD 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2 -1
@@ -1709,7 +1709,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( alloc_domain =AMDGPU_GEM_DOMAIN_GTT ; alloc_flags =0 ; }else { - alloc_flags =AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE ; + alloc_flags =AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE | +AMDGPU_GEM_CREATE_VRAM_CLEARED ; alloc_flags |= (flags &KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC ) ?AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED :0 ; }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 2/2 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
@@ -346,6 +346,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } +/* always clear VRAM */ +if (args->in.domains &AMDGPU_GEM_DOMAIN_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.44.0
Felix Kuehling
maintainerQuoted 3 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.
If we submit this before the clear-page-tracking patches are in, this will cause unacceptable performance regressions for ROCm applications.
Regards,
Felix
Quoted 20 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2
-1@@ -1709,7 +1709,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( alloc_domain =AMDGPU_GEM_DOMAIN_GTT ; alloc_flags =0 ; }else { - alloc_flags =AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE ; + alloc_flags =AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE | +AMDGPU_GEM_CREATE_VRAM_CLEARED ; alloc_flags |= (flags &KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC ) ?AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED :0 ; }
Quoted 7 lines · Felix Kuehling
Quoted 3 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.
If we submit this before the clear-page-tracking patches are in, this will cause unacceptable performance regressions for ROCm applications.
I agree this probably shouldn't land earlier than that, ideally together or shortly after though.
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer