[Mesa-stable] [PATCH] ac/nir: mark some texture intrinsics as convergent
Marek Olšák
maraeo at gmail.com
Thu May 30 22:49:44 UTC 2019
On Thu, May 30, 2019, 6:44 PM Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
wrote:
>
>
> On Thu, May 30, 2019, 11:45 PM Marek Olšák <maraeo at gmail.com> wrote:
>
>>
>>
>> On Thu, May 30, 2019, 3:54 PM Rhys Perry <pendingchaos02 at gmail.com>
>> wrote:
>>
>>> Otherwise LLVM can sink them and their texture coordinate calculations
>>> into divergent branches.
>>>
>>> v2: simplify the conditions on which the intrinsic is marked as
>>> convergent
>>>
>>> Cc: <mesa-stable at lists.freedesktop.org>
>>> Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
>>> Reviewed-By: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
>>> ---
>>> src/amd/common/ac_nir_to_llvm.c | 12 ++++++++++++
>>> 1 file changed, 12 insertions(+)
>>>
>>> diff --git a/src/amd/common/ac_nir_to_llvm.c
>>> b/src/amd/common/ac_nir_to_llvm.c
>>> index 265e3b636c4..b1a191ac24c 100644
>>> --- a/src/amd/common/ac_nir_to_llvm.c
>>> +++ b/src/amd/common/ac_nir_to_llvm.c
>>> @@ -1394,6 +1394,18 @@ static LLVMValueRef build_tex_intrinsic(struct
>>> ac_nir_context *ctx,
>>> }
>>>
>>> args->attributes = AC_FUNC_ATTR_READNONE;
>>> + /* Prevent texture instructions with implicit derivatives from
>>> being
>>> + * sinked into branches. */
>>> + switch (instr->op) {
>>> + case nir_texop_tex:
>>> + case nir_texop_txb:
>>> + case nir_texop_lod:
>>> + args->attributes |= AC_FUNC_ATTR_CONVERGENT;
>>> + break;
>>> + default:
>>> + break;
>>> + }
>>>
>>
>> I think this should only apply to the fragment shader.
>>
>
> Well these opcodes will only be used in fragment shaders anyway, right?
>
I think the normal tex opcode can be used in vertex shaders as well,
probably only in OpenGL.
Marek
>> Marek
>>
>> +
>>> return ac_build_image_opcode(&ctx->ac, args);
>>> }
>>>
>>> --
>>> 2.21.0
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20190530/f30fe489/attachment-0001.html>
More information about the mesa-stable
mailing list