This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Implement GroupStaticSize Intrinsic for Dynamic LDS
ClosedPublic

Authored by cfang on Mar 10 2016, 2:27 PM.

Details

Summary

Static LDS size is saved in MachineFunctionInfo::LDSSize,
We define a pseudo instruction with usesCustomInserter bit set. Then, in EmitInstrWithCustomInserter,
we replace this pseudo instruction with a mov of MachineFunctionInfo::LDSSize.

Diff Detail

Repository
rL LLVM

Event Timeline

cfang updated this revision to Diff 50355.Mar 10 2016, 2:27 PM
cfang retitled this revision from to AMDGPU/SI: Implement GroupStaticSize Intrinsic for Dynamic LDS.
cfang updated this object.
cfang added reviewers: arsenm, tstellarAMD, scchan.
cfang added subscribers: arsenm, llvm-commits.
lib/Target/AMDGPU/SIISelLowering.cpp
1064 ↗(On Diff #50355)

I don't think this will work if we call this intrinsic in the entry block and then the LDS variables are used in different blocks. Can you add a test case for this and then fix it if it doesn't work.

arsenm added inline comments.Mar 14 2016, 2:16 PM
include/llvm/IR/IntrinsicsAMDGPU.td
219–220 ↗(On Diff #50355)

I think the get should be dropped from the name

arsenm added inline comments.Mar 14 2016, 3:44 PM
lib/Target/AMDGPU/SIISelLowering.cpp
1064 ↗(On Diff #50355)

This is ok because this is called by the ExpandISelPseudos pass which runs on the completed MachineFunction

cfang updated this revision to Diff 50677.Mar 14 2016, 4:53 PM

updated based on Tom and Matt's comments:

  1. drop "get_" in the intrinsic name;
  2. add new test to test multiple block case.
This revision was automatically updated to reflect the committed changes.