<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 5, 2017, 3:08 PM Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Aaron,<br>
<br>
Can you make the change in radeon_drm_winsys.c instead?<br></blockquote></div><div><br></div><div>I'll give it a shot.</div><div><br></div><div>--Aaron</div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
Marek<br>
<br>
On Mon, Jun 5, 2017 at 2:32 AM, Aaron Watry <<a href="mailto:awatry@gmail.com" target="_blank">awatry@gmail.com</a>> wrote:<br>
> The CL CTS queries the max allocation size, and then attempts to<br>
> allocate buffers of that size. If any of the VRAM is in use, this<br>
> causes errors in the radeon kernel module.<br>
><br>
> It's a bit of a hack, but experimentally on my system, I can use 3/4<br>
> of the card's VRAM for a single global/constant buffer allocation given<br>
> current GUI/compositor use.<br>
><br>
> If there's a way to get the actual amount of free VRAM, I'd love to hear about it.<br>
><br>
> Also, I'm unsure if the radeon kernel module requires all allocated memory to be<br>
> contiguous, if so, then we'd need to be able to get at that value.. I'm suspecting<br>
> that's not actually the case.<br>
><br>
> For a 1GB Pitcairn (HD7850) this gets me from the reported clinfo values of:<br>
> Global memory size                              2143076352 (1.996GiB)<br>
> Max memory allocation                           1500153446 (1.397GiB)<br>
> Max constant buffer size                        1500153446 (1.397GiB)<br>
><br>
> To:<br>
> Global memory size                              2143076352 (1.996GiB)<br>
> Max memory allocation                           805306368 (768MiB)<br>
> Max constant buffer size                        805306368 (768MiB)<br>
><br>
> Fixes: OpenCL CTS test/conformance/api/min_max_mem_alloc_size,<br>
>        OpenCL CTS test/conformance/api/min_max_constant_buffer_size<br>
><br>
> Signed-off-by: Aaron Watry <<a href="mailto:awatry@gmail.com" target="_blank">awatry@gmail.com</a>><br>
> ---<br>
>  src/gallium/drivers/radeon/r600_pipe_common.c | 17 +++++++++++++++--<br>
>  1 file changed, 15 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c<br>
> index 2c0cadb030..cdd4062fd3 100644<br>
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c<br>
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c<br>
> @@ -1144,8 +1144,21 @@ static int r600_get_compute_param(struct pipe_screen *screen,<br>
>                 if (ret) {<br>
>                         uint64_t *max_mem_alloc_size = ret;<br>
><br>
> -                       *max_mem_alloc_size = rscreen->info.max_alloc_size;<br>
> -               }<br>
> +                       uint64_t max_alloc = rscreen->info.max_alloc_size;<br>
> +<br>
> +                       if (rscreen->info.has_dedicated_vram) {<br>
> +                               /* XXX: Hack to prevent system hangs...<br>
> +                                * Limit to 3/4 VRAM for any single allocation.<br>
> +                                * Prevents:<br>
> +                                *     radeon: Not enough memory for command submission.<br>
> +                                */<br>
> +                               *max_mem_alloc_size = MIN2(<br>
> +                                       rscreen->info.vram_size * 3 / 4, max_alloc<br>
> +                               );<br>
> +                       } else {<br>
> +                               *max_mem_alloc_size = max_alloc;<br>
> +                       }<br>
> +        }<br>
>                 return sizeof(uint64_t);<br>
><br>
>         case PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY:<br>
> --<br>
> 2.11.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>