This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][InstCombine] Remove zero image offset
ClosedPublic

Authored by sebastian-ne on Jan 21 2022, 4:35 AM.

Details

Summary

Remove the offset parameter if it is zero.

Diff Detail

Event Timeline

sebastian-ne created this revision.Jan 21 2022, 4:35 AM
sebastian-ne requested review of this revision.Jan 21 2022, 4:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2022, 4:35 AM
foad accepted this revision.Jan 21 2022, 4:55 AM

LGTM, but wouldn't it be nice if there was some way to autogenerate the Offset to NoOffset Optimization Mapping table?

This revision is now accepted and ready to land.Jan 21 2022, 4:55 AM
This revision was landed with ongoing or failed builds.Jan 24 2022, 9:07 AM
This revision was automatically updated to reflect the committed changes.

wouldn't it be nice if there was some way to autogenerate the Offset to NoOffset Optimization Mapping table?

Definitely would be nice. I couldn’t find a way to do that easily though. The features (offset, g16, coarse derivatives, lod, bias, etc., etc.) of image instructions are heavily dependent on each other, making it hard to be generic over them.
The only place where the dependencies are spelled out is in the amdgpu intrinsic definitions (which is part of generic llvm and does not have the instruction definitions).

Maybe one could

  1. create one big table of image instructions with their properties in the intrinsic definitions
  2. derive the intrinsics from that table (in generic llvm)
  3. derive the pseudo-instructions from that table (in the amdgpu target)
  4. create a lookup table for feature-matrix (offset, lod, etc.) to intrinsic/instruction

Having that would be nice but creating that would surely be a lot of work.