This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Add pass for promoting uniform loads to constant address space
Needs ReviewPublic

Authored by tstellarAMD on Apr 25 2016, 1:45 PM.
This revision needs review, but all reviewers have resigned.

Details

Reviewers
rampitec
arsenm
Summary

This pass will convert uniform global address space loads to constant address
space loads when the load's pointer points to memory which has not been
modified by the function.

Diff Detail

Event Timeline

tstellarAMD retitled this revision from to AMDGPU/SI: Add pass for promoting uniform loads to constant address space.
tstellarAMD updated this object.
tstellarAMD added reviewers: arsenm, rampitec.
tstellarAMD added a subscriber: llvm-commits.
arsenm added inline comments.Apr 25 2016, 3:57 PM
lib/Target/AMDGPU/GCNOptimizeUniformMemOps.cpp
1

I'm not sure Optimize is the right name to use for this. Maybe promote or scalarize?
GCNPromoteUniformLoadsToSMRD?

22

Typo bee

44

Why would this need to create globals?

84

Typo Optmize

100

Can be early return

103

there is a getPointerElementType helper

113–114

I think there's a new skipFunction test instead

test/CodeGen/AMDGPU/uniform-mem-opt.ll
2

There should be a run line / test with just opt. With opt you could write a test with a calls that might write through or capture the pointer

rampitec edited edge metadata.Nov 21 2016, 9:54 AM

This is not valid to run on just any function. A value shall not be written to memory starting from the kernel. We currently inline everything, but when we have calls that will be an error.

rampitec added inline comments.Nov 21 2016, 10:37 AM
lib/Target/AMDGPU/GCNOptimizeUniformMemOps.cpp
105

According to memory model global and constant do not alias. Casts are only possible between flat and any non-constant segment.

rampitec resigned from this revision.May 19 2017, 2:26 AM
arsenm resigned from this revision.Aug 3 2017, 4:06 PM