This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][MC] Verify selection of LDS MUBUF opcodes
ClosedPublic

Authored by dp on Jul 29 2022, 5:18 AM.

Details

Summary

MUBUF lds opcodes may be selected even if lds modifier is not specified.
See bug 56755.

Diff Detail

Event Timeline

dp created this revision.Jul 29 2022, 5:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2022, 5:18 AM
dp requested review of this revision.Jul 29 2022, 5:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2022, 5:18 AM
foad added inline comments.Jul 29 2022, 5:42 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
4495–4498

What do these lines achieve?

dp updated this revision to Diff 448610.Jul 29 2022, 6:27 AM

Added a comment.

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
4495–4498

These lines exclude checks for cases when there are separate DMA opcodes. In these cases, incorrect opcode selection is not possible.

GFX940 FLAT opcodes do not support lds modifier, but there are separate DMA opcodes global_load_lds_dword, etc.

Likewise, GFX11 has buffer_load_lds_b32, etc; MUBUF lds modifier is not supported.

foad added inline comments.Jul 29 2022, 6:35 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
4495–4498

OK. I thought those cases would be handled correctly anyway, because we would return true on line 4505, but maybe I am wrong.

dp added inline comments.Jul 29 2022, 7:07 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
4495–4498

You are right, the check for MUBUF is optional, but GFX940 FLAT LDS opcodes have VALU=1.

foad accepted this revision.Jul 29 2022, 7:09 AM

LGTM (with or without any changes in validateLdsDMA).

This revision is now accepted and ready to land.Jul 29 2022, 7:09 AM
This revision was landed with ongoing or failed builds.Aug 1 2022, 6:46 AM
This revision was automatically updated to reflect the committed changes.