This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Allow abs/neg source modifiers on v_cndmask_b32
ClosedPublic

Authored by foad on Jul 10 2019, 7:40 AM.

Details

Summary

D59191 added support for these modifiers in the assembler and
disassembler. This patch just teaches instruction selection that it can
use them.

Diff Detail

Repository
rL LLVM

Event Timeline

foad created this revision.Jul 10 2019, 7:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2019, 7:40 AM
arsenm accepted this revision.Jul 10 2019, 7:46 AM

LGTM. We still need more work to handle the integer cases in the complex pattern. Plus the combine that tries to avoid source modifiers on select should be updated

This revision is now accepted and ready to land.Jul 10 2019, 7:46 AM
This revision was automatically updated to reflect the committed changes.
foad added a comment.Jul 10 2019, 8:01 AM

We still need more work to handle the integer cases in the complex pattern.

Which pattern?

Plus the combine that tries to avoid source modifiers on select should be updated

Where is that? I looked but couldn't find anything like this.

We still need more work to handle the integer cases in the complex pattern.

Which pattern?

VOP3Mods only looks for FNEG and FABS, although the equivalent bit operations should also work

Plus the combine that tries to avoid source modifiers on select should be updated

Where is that? I looked but couldn't find anything like this.

Look at performFNegCombine, performFAbsCombine, fnegFoldsIntoOp and hasSourceMods

We still need more work to handle the integer cases in the complex pattern.

Which pattern?

VOP3Mods only looks for FNEG and FABS, although the equivalent bit operations should also work

Plus the combine that tries to avoid source modifiers on select should be updated

Where is that? I looked but couldn't find anything like this.

Look at performFNegCombine, performFAbsCombine, fnegFoldsIntoOp and hasSourceMods

You might also want to look at picking up https://github.com/arsenm/llvm/commit/77ac293d3510093e6db3f2825c8bef859bac4dcf
IIRC this had some improvements in shader-db, but also some regressions. It might be better with select using mods

Hi,

This change introduced CTS regressions with RADV like dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.atan2_frag and friends.
Can you investigate ?

Thanks a lot

foad added a comment.Jul 12 2019, 5:41 AM

This change introduced CTS regressions with RADV like dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.atan2_frag and friends.
Can you investigate ?

Yes, sorry, I can reproduce the following failures (with LLPC not RADV):

dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_1.faceforward_vert
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_1.faceforward_tessc
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_1.faceforward_tesse
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_1.faceforward_geom
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_1.faceforward_frag
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_2.faceforward_vert
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_2.faceforward_tessc
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_2.faceforward_tesse
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_2.faceforward_geom
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_2.faceforward_frag
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.faceforward_vert
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.faceforward_tessc
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.faceforward_tesse
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.faceforward_geom
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.faceforward_frag
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_4.faceforward_vert
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_4.faceforward_tessc
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_4.faceforward_tesse
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_4.faceforward_geom
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_4.faceforward_frag

I'll see if I can fix them. Let me know if you want a revert in the mean time.

foad added a comment.Jul 12 2019, 7:51 AM

This change introduced CTS regressions with RADV like dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.atan2_frag and friends.
Can you investigate ?

Hopefully fixed by D64636.