[Mesa-dev] [PATCH] radeonsi: Enable VGPR spilling for all shader types v3
Michel Dänzer
michel at daenzer.net
Fri Jan 23 19:32:48 PST 2015
On 24.01.2015 11:56, Tom Stellard wrote:
> On Thu, Jan 22, 2015 at 11:27:32AM +0900, Michel Dänzer wrote:
>>
>> Tom, for now I suggest this solution, summarized from Marek's previous
>> descriptions:
>>
>> (At least) for shaders which have relocations, keep a copy of the
>> machine code in malloced memory. When the relocated values change,
>> update them in the malloced memory, allocate a new BO, map it, copy the
>> machine code from the malloced memory to the BO, replace any existing
>> shader BO with the new one and invalidate the shader state.
>>
>
> Hi,
>
> Attached is a WIP patch attempting to implement it this way.
> Unfortunately, I was unable to get it working, so I wanted to
> submit it for review in case someone can spot what I'm doing wrong.
>
> You can find the broken code wrapped in #if 0 in the
> si_update_scratch_buffer() function in si_state_shaders.c
>
> Based on the dmesg output and other tests I've done, it appears
> that the GPU is still executing the shader code from the old bo
> which does not contain the relocations.
>
> The code in the #else branch works fine, but it updates the existing
> bo in place rather than creating a new one.
>
> Any idea what I've done wrong?
[...]
> + /* Update the shaders, so they are using the latest scratch. The
> + * scratch buffer may have been changed since these shaders were
> + * last used, so we still need to try to update them, even if
> + * they require scratch buffers smaller than the current size.
> + */
> + if (si_update_scratch_buffer(sctx, sctx->ps_shader))
> + sctx->emitted.named.ps = NULL;
> + if (si_update_scratch_buffer(sctx, sctx->gs_shader))
> + sctx->emitted.named.gs = NULL;
> + if (si_update_scratch_buffer(sctx, sctx->vs_shader))
> + sctx->emitted.named.vs = NULL;
Does this work instead?
if (si_update_scratch_buffer(sctx, sctx->ps_shader))
si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
if (si_update_scratch_buffer(sctx, sctx->gs_shader))
si_pm4_bind_state(sctx, gs, sctx->gs_shader->current->pm4);
if (si_update_scratch_buffer(sctx, sctx->vs_shader))
si_pm4_bind_state(sctx, vs, sctx->vs_shader->current->pm4);
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the mesa-dev
mailing list