This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Add llvm.amdgcn.s.buffer.load intrinsic
Needs ReviewPublic

Authored by airlied on May 8 2017, 12:19 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch also adds a new address space to represent loads from the constant
address space that use a buffer resource.

Note that this new address space does not support GEP instructions due to
limitations in the instruction selector.

Written by Tom Stellard

Diff Detail

Event Timeline

airlied created this revision.May 8 2017, 12:19 AM
airlied updated this revision to Diff 98237.May 8 2017, 5:13 PM
airlied edited the summary of this revision. (Show Details)

This adds support for the x2/x4 paths. Probably could be done better, and I've tested this with a few vulkan games.

arsenm added inline comments.May 8 2017, 5:26 PM
include/llvm/IR/IntrinsicsAMDGPU.td
471

I think these need slc as well. I believe slc started meaning something for scalar ops in VI

lib/Target/AMDGPU/AMDGPUISelLowering.h
392

Probably should be S_BUFFER_LOAD to match the instruction name pattern

lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
498

cast<>, not static_cast

lib/Target/AMDGPU/SIISelLowering.cpp
2175–2193

All of this seems to just be a workaround for getTgtMemIntrinsic not setting MODerefenrencable. It would be better to just fix visitTargetIntrinsic to add this to the MMO when it first creates it.

lib/Target/AMDGPU/SMInstructions.td
280

There's no reason to give any of these patterns names

arsenm added inline comments.May 8 2017, 5:28 PM
test/CodeGen/AMDGPU/mubuf.ll
94

name test values

96

Why is this using the old intrinsic? It would be better to only use the new intrinsic in a single test and move any for the old intrinsic into the legacy intrinsic test file

airlied added inline comments.May 8 2017, 6:18 PM
include/llvm/IR/IntrinsicsAMDGPU.td
471

I don't see slc as a bit in the GCN3 docs for s_buffer_load.

lib/Target/AMDGPU/SIISelLowering.cpp
2175–2193

do you mean just the MMO code here?, the Ops changes is needed to cast the 128-bit constant address space pointer into the v4i32 the hw gets.