From: Felix Kuehling <felix.kuehling@amd.com>
To: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: philip.yang@amd.com, lijo.lazar@amd.com, christian.koenig@amd.com
Subject: Re: [PATCH 1/3] drm/amdgpu: Rework KFD memory max limits
Date: Fri, 29 Sep 2023 16:54:25 -0400 [thread overview]
Message-ID: <2bb14825-e0fe-83a8-bbf1-143529490408@amd.com> (raw)
In-Reply-To: <20230929181856.2311515-1-rajneesh.bhardwaj@amd.com>
On 2023-09-29 14:18, Rajneesh Bhardwaj wrote:
> To allow bigger allocations specially on systems such as GFXIP 9.4.3
> that use GTT memory for VRAM allocations, relax the limits to
> maximize ROCm allocations.
>
> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
If the new heuristic in patch 1 causes regressions, we can change
AMDGPU_RESERVE_MEM_LIMIT to something larger, e.g. 1.5 GB (3UL << 29).
Maybe we should start with that more conservative value to minimize the
risk on 16GB system memory systems that have proven problematic in the past.
Other than that, patches 1 and 3 are
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index b5b940485059..b1c4e9c0e036 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -42,6 +42,7 @@
> * changes to accumulate
> */
> #define AMDGPU_USERPTR_RESTORE_DELAY_MS 1
> +#define AMDGPU_RESERVE_MEM_LIMIT (1UL << 30)
>
> /*
> * Align VRAM availability to 2MB to avoid fragmentation caused by 4K allocations in the tail 2MB
> @@ -115,11 +116,16 @@ void amdgpu_amdkfd_gpuvm_init_mem_limits(void)
> return;
>
> si_meminfo(&si);
> - mem = si.freeram - si.freehigh;
> + mem = si.totalram - si.totalhigh;
> mem *= si.mem_unit;
>
> spin_lock_init(&kfd_mem_limit.mem_limit_lock);
> - kfd_mem_limit.max_system_mem_limit = mem - (mem >> 4);
> + kfd_mem_limit.max_system_mem_limit = mem - (mem >> 6);
> + if (kfd_mem_limit.max_system_mem_limit < 2 * AMDGPU_RESERVE_MEM_LIMIT)
> + kfd_mem_limit.max_system_mem_limit >>= 1;
> + else
> + kfd_mem_limit.max_system_mem_limit -= AMDGPU_RESERVE_MEM_LIMIT;
> +
> kfd_mem_limit.max_ttm_mem_limit = ttm_tt_pages_limit() << PAGE_SHIFT;
> pr_debug("Kernel memory limit %lluM, TTM limit %lluM\n",
> (kfd_mem_limit.max_system_mem_limit >> 20),
prev parent reply other threads:[~2023-09-29 20:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 18:18 [PATCH 1/3] drm/amdgpu: Rework KFD memory max limits Rajneesh Bhardwaj
2023-09-29 18:18 ` [PATCH 2/3] drm/amdgpu: Initialize acpi mem ranges after TTM Rajneesh Bhardwaj
2023-10-02 15:44 ` Bhardwaj, Rajneesh
2023-09-29 18:18 ` [PATCH 3/3] drm/amdgpu: Use ttm_pages_limit to override vram reporting Rajneesh Bhardwaj
2023-09-29 20:54 ` Felix Kuehling [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2bb14825-e0fe-83a8-bbf1-143529490408@amd.com \
--to=felix.kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=lijo.lazar@amd.com \
--cc=philip.yang@amd.com \
--cc=rajneesh.bhardwaj@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox