From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Tvrtko Ursulin <tursulin@ursulin.net>, friedrich.vock@gmx.de
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/6] drm/amdgpu: always enable move threshold for BOs
Date: Fri, 14 Jun 2024 11:53:36 +0200 [thread overview]
Message-ID: <2ccb8b25-2351-4107-bd30-3ceee1e11645@gmail.com> (raw)
In-Reply-To: <b2c68930-b165-4d78-84d5-52415923e648@ursulin.net>
>> if (domain & abo->preferred_domains &
>> AMDGPU_GEM_DOMAIN_VRAM &&
>> - !(adev->flags & AMD_IS_APU))
>> - places[c].flags |= TTM_PL_FLAG_FALLBACK;
>> + !(adev->flags & AMD_IS_APU)) {
>> + /*
>> + * When GTT is just an alternative to VRAM make sure
>> that we
>> + * only use it as fallback and still try to fill up VRAM
>> first.
>> + */
>> + if (abo->preferred_domains & AMDGPU_GEM_DOMAIN_GTT)
>> + places[c].flags |= TTM_PL_FLAG_FALLBACK;
>> +
>> + /*
>> + * Enable GTT when the threshold of moved bytes is
>> + * reached. This prevents any non essential buffer move
>> + * when the links are already saturated.
>> + */
>> + places[c].flags |= TTM_PL_FLAG_MOVE_THRESHOLD;
>> + }
>
> For the APU case I *think* this works, but for discrete I am not sure
> yet.
Agree, APUs are basically already fine as they are. VRAM is just used so
that it isn't wasted there.
>
> As a side note and disclaimer, the TTM "resource compatible" logic has
> a half-life of about one week in my brain until I need to almost
> re-figure it all out. I don't know if it just me, but I find it really
> non-intuitive and almost like double, triple, or even quadruple
> negation way of thinking about things.
Yeah I was also going back and forth between the different approaches
multiple times and just ended up in this implementation because it
seemed to do what I wanted to have.
It's certainly not very intuitive what's going on here.
>
> It is not helping that with this proposal you set threshold on just
> one of the possible object placements which further increases the
> asymmetry. For me intuitive thing would be that thresholds apply to
> the act of changing the current placement directly. Not indirectly via
> playing with one of the placement flags dynamically.
Interesting idea, how would the handling then be? Currently we have only
the stages - 'don't evict' and 'evict'. Should we make it something more
like 'don't move', 'move', 'evict' ?
>
>
> Anyway, lets see.. So you set TTM_PL_FLAG_MOVE_THRESHOLD and
> TTM_PL_FLAG_FALLBACK on the GTT placement, with the logic that it will
> be considered compatible while under the migration budget?
>
> (Side note, the fact both flags are set I also find very difficult to
> mentally model.)
>
> Say a buffer was evicted to GTT already. What then brings it back to
> VRAM?
>
> The first subsequent ttm_bo_validate pass (!evicting) says GTT is fine
> (applicable) while ctx->bytes_moved < ctx->move_threshold, no? Isn't
> that the opposite of what would be required and causes nothing to be
> migrated back in? What am I missing?
The flag says that GTT is fine when ctx->bytes_moved >=
ctx->move_threshold. The logic is exactly inverted to what you described.
This way a BO will be moved back into VRAM as long as bytes moved
doesn't exceed the threshold.
Setting both flags has the effect of saying: It's ok that the BO stays
in GTT when you either above the move threshold or would have to evict
something.
Regards,
Christian.
>
> Regards,
>
> Tvrtko
next prev parent reply other threads:[~2024-06-14 9:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 16:04 Rate limit improvements for TTM Christian König
2024-06-04 16:04 ` [PATCH 1/6] drm/amdgpu: cleanup MES command submission Christian König
2024-06-04 16:04 ` [PATCH 2/6] drm/ttm: add TTM_PL_FLAG_TRESHOLD Christian König
2024-06-05 1:12 ` kernel test robot
2024-06-04 16:05 ` [PATCH 3/6] drm/amdgpu: enable GTT fallback handling for dGPUs only Christian König
2024-11-12 15:12 ` Alex Deucher
2024-06-04 16:05 ` [PATCH 4/6] drm/amdgpu: re-order AMDGPU_GEM_DOMAIN_DOORBELL handling Christian König
2024-06-04 16:05 ` [PATCH 5/6] drm/amdgpu: always enable move threshold for BOs Christian König
2024-06-11 16:24 ` Tvrtko Ursulin
2024-06-14 9:53 ` Christian König [this message]
2024-06-14 16:06 ` Tvrtko Ursulin
2024-06-28 8:13 ` Tvrtko Ursulin
2024-06-04 16:05 ` [PATCH 6/6] drm/amdgpu: Re-validate evicted buffers v2 Christian König
2024-08-13 15:07 ` Tvrtko Ursulin
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=2ccb8b25-2351-4107-bd30-3ceee1e11645@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=friedrich.vock@gmx.de \
--cc=tursulin@ursulin.net \
/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