<div dir="ltr"><div>Will the kernel keep all discardable buffers in VRAM if VRAM is not overcommitted by discardable buffers, or will other buffers also affect the placement of discardable buffers?</div><div><br></div><div>Do evictions deallocate the buffer, or do they keep an allocation in GTT and only the copy is skipped?</div><div><br></div><div>Thanks,</div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 11, 2022 at 3:08 AM Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>OK that sounds good.</div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 11, 2022 at 2:04 AM Christian König <<a href="mailto:ckoenig.leichtzumerken@gmail.com" target="_blank">ckoenig.leichtzumerken@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Hi Marek,<br>
<br>
<div>Am 10.05.22 um 22:43 schrieb Marek
Olšák:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>A better flag name would be:</div>
<div>AMDGPU_GEM_CREATE_BEST_PLACEMENT_OR_DISCARD</div>
</div>
</blockquote>
<br>
A bit long for my taste and I think the best placement is just a
side effect.<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Marek<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, May 10, 2022 at 4:13
PM Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Does this really guarantee VRAM placement? The code
doesn't say anything about that.</div>
</div>
</blockquote>
</div>
</blockquote>
<br>
Yes, see the code here:<br>
<br>
<blockquote type="cite">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
index 8b7ee1142d9a..1944ef37a61e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
@@ -567,6 +567,7 @@ int amdgpu_bo_create(struct
amdgpu_device *adev,<br>
bp->domain;<br>
bo->allowed_domains = bo->preferred_domains;<br>
if (bp->type != ttm_bo_type_kernel &&<br>
+ !(bp->flags &
AMDGPU_GEM_CREATE_DISCARDABLE) &&<br>
bo->allowed_domains ==
AMDGPU_GEM_DOMAIN_VRAM)<br>
bo->allowed_domains |=
AMDGPU_GEM_DOMAIN_GTT;<br>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
<br>
The only case where this could be circumvented is when you try to
allocate more than physically available on an APU.<br>
<br>
E.g. you only have something like 32 MiB VRAM and request 64 MiB,
then the GEM code will catch the error and fallback to GTT (IIRC).<br>
<br>
Regards,<br>
Christian.<br>
</div>
</blockquote></div>
</blockquote></div>