<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 11, 2017 at 11:03 AM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Apr 11, 2017 at 1:58 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> Cc: "Juan A. Suárez" <<a href="mailto:jasuarez@igalia.com">jasuarez@igalia.com</a>><br>
> ---<br>
>  src/intel/vulkan/anv_device.c | 17 +++++++++++++++++<br>
>  1 file changed, 17 insertions(+)<br>
><br>
> diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
> index 35ef4c4..b24c739 100644<br>
> --- a/src/intel/vulkan/anv_device.<wbr>c<br>
> +++ b/src/intel/vulkan/anv_device.<wbr>c<br>
> @@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(<br>
>     assert(pAllocateInfo-><wbr>memoryTypeIndex == 0 ||<br>
>            (!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));<br>
><br>
> +   /* The kernel relocation API has a limitation of a 32-bit delta value<br>
> +    * applied to the address before it is written which, in spite of it being<br>
> +    * unsigned, is treated as signed .  Because of the way that this maps to<br>
> +    * the Vulkan API, we cannot handle an offset into a buffer that does not<br>
> +    * fit into a signed 31 bits.  The only mechanism we have for dealing with<br>
<br>
</span>32 bits?<span class=""><br></span></blockquote><div><br></div><div>Yup.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> +    * this at the moment is to limit all VkDeviceMemory objects to a maximum<br>
> +    * of 2GB each.  The Vulkan spec allows us to do this:<br>
> +    *<br>
> +    *    "Some platforms may have a limit on the maximum size of a single<br>
> +    *    allocation. For example, certain systems may fail to create<br>
> +    *    allocations with a size greater than or equal to 4GB. Such a limit is<br>
> +    *    implementation-dependent, and if such a failure occurs then the error<br>
> +    *    VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."<br>
> +    */<br>
> +   if (pAllocationInfo-><wbr>allocationSize > (1ull << 31))<br>
<br>
</span>1<<31 is not representable in a 32-bit signed int. did you mean >= ?<br></blockquote><div><br></div><div>No.  You can't validly have a 2GB offset into a 2GB buffer because you nee some space after it to put the thing you're binding.  Anything over 2GB, on the other hand, has a potential problem.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> +      return VK_ERROR_OUT_OF_HOST_MEMORY;<br>
<br>
The comment above would suggest OUT_OF_DEVICE_MEMORY...<span class=""><br></span></blockquote><div><br></div><div>Bah!  Thanks!  I'll send a v3.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> +<br>
>     /* FINISHME: Fail if allocation request exceeds heap size. */<br>
><br>
>     mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>