From: bugzilla-daemon@freedesktop.org Subject: [Bug 111077] link_shader and deserialize_glsl_program suddenly consume huge amount of RAM Date: Mon, 09 Sep 2019 00:58:42 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1208166021==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id A11BD896E9 for ; Mon, 9 Sep 2019 00:58:42 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1208166021== Content-Type: multipart/alternative; boundary="15679907220.2320.27084" Content-Transfer-Encoding: 7bit --15679907220.2320.27084 Date: Mon, 9 Sep 2019 00:58:42 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D111077 --- Comment #29 from Timothy Arceri --- (In reply to roland@rptd.ch from comment #22) > Hi Marek, >=20 > This is going to be complicated. The application is not yet free to use by > others (working on getting it to release shape). I would have to figure o= ut > first how to break this down into a reproducible test case since I don't > know myself what triggers the bug. >=20 > If you can think of some corner values to narrow down in what direction to > search I can fully mess with the source code over here. The faulty commit > talks about UBO maximum size so this might be a start. The OpenGL > Capabilities from the GPU is this: >=20 > - UBO Maximum Block Size =3D 65536 > - UBO Buffer Offset Alignment =3D 4 >=20 > So the maximum size used by the application is 65536 bytes. >=20 > UBOs are used as shared buffers so blocks of data are placed next to each > other respecting alignment and updated. >=20 > UBOs are created like this: >=20 > glBindBuffer(GL_UNIFORM_BUFFER, pUBO) // <=3D done once > glBufferData(GL_UNIFORM_BUFFER, bufferSize, NULL, GL_DYNAMIC_DRAW) // <= =3D > done once > glMapBufferRange(GL_UNIFORM_BUFFER, stride * elementCount, elementStride, > GL_WRITE_ONLY | GL_MAP_INVALIDATE_RANGE_BIT) // <=3D done for each data = block > written >=20 > Data then written and unmapped >=20 > In particular this means a larger UBO is created once then individual blo= cks > are written to it using ranged mapping. Just a wield guess but could the > problem be related to this kind of usage pattern? UBOs are written to the shader cache, and shade cache items are kept in mem= ory in a queue when all threads are busy compiling. If you have large UBOs this could indeed be your problem. The following merge request might be helpful. Are you able to give this a t= est? https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1852 --=20 You are receiving this mail because: You are the assignee for the bug.= --15679907220.2320.27084 Date: Mon, 9 Sep 2019 00:58:42 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Comme= nt # 29 on bug 11107= 7 from Timothy Arceri
(In reply to roland@=
rptd.ch from comment #22)
> Hi Marek,
>=20
> This is going to be complicated. The application is not yet free to us=
e by
> others (working on getting it to release shape). I would have to figur=
e out
> first how to break this down into a reproducible test case since I don=
't
> know myself what triggers the bug.
>=20
> If you can think of some corner values to narrow down in what directio=
n to
> search I can fully mess with the source code over here. The faulty com=
mit
> talks about UBO maximum size so this might be a start. The OpenGL
> Capabilities from the GPU is this:
>=20
> - UBO Maximum Block Size =3D 65536
> - UBO Buffer Offset Alignment =3D 4
>=20
> So the maximum size used by the application is 65536 bytes.
>=20
> UBOs are used as shared buffers so blocks of data are placed next to e=
ach
> other respecting alignment and updated.
>=20
> UBOs are created like this:
>=20
> glBindBuffer(GL_UNIFORM_BUFFER, pUBO)  // <=3D done once
> glBufferData(GL_UNIFORM_BUFFER, bufferSize, NULL, GL_DYNAMIC_DRAW)  //=
 <=3D
> done once
> glMapBufferRange(GL_UNIFORM_BUFFER, stride * elementCount, elementStri=
de,
> GL_WRITE_ONLY | GL_MAP_INVALIDATE_RANGE_BIT)  // <=3D done for each=
 data block
> written
>=20
> Data then written and unmapped
>=20
> In particular this means a larger UBO is created once then individual =
blocks
> are written to it using ranged mapping. Just a wield guess but could t=
he
> problem be related to this kind of usage pattern?

UBOs are written to the shader cache, and shade cache items are kept in mem=
ory
in a queue when all threads are busy compiling. If you have large UBOs this
could indeed be your problem.

The following merge request might be helpful. Are you able to give this a t=
est?

ht=
tps://gitlab.freedesktop.org/mesa/mesa/merge_requests/1852


You are receiving this mail because:
  • You are the assignee for the bug.
= --15679907220.2320.27084-- --===============1208166021== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs --===============1208166021==--