summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2016-12-06 21:53:10 +0000
committerTom Stellard <thomas.stellard@amd.com>2016-12-06 21:53:10 +0000
commit175959e35016fe22d6f4f9dbbd92aad47f442dbc (patch)
tree89e990ec91b4806637f4dd956e2945b92cfa69a8 /llvm/lib/Target
parent043e66137c01de5d9f9bf49b471036959018d7d8 (diff)
downloadbcm5719-llvm-175959e35016fe22d6f4f9dbbd92aad47f442dbc.tar.gz
bcm5719-llvm-175959e35016fe22d6f4f9dbbd92aad47f442dbc.zip
AMDGPU/SI: Set correct value for amd_kernel_code_t::kernarg_segment_alignment
Reviewers: arsenm Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, llvm-commits, tony-tye Differential Revision: https://reviews.llvm.org/D27416 llvm-svn: 288852
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp5
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index d836a8ea024..2390fc9b3db 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -763,6 +763,11 @@ void AMDGPUAsmPrinter::EmitAmdKernelCodeT(const MachineFunction &MF,
header.reserved_vgpr_first = KernelInfo.ReservedVGPRFirst;
header.reserved_vgpr_count = KernelInfo.ReservedVGPRCount;
+ // These alignment values are specified in powers of two, so alignment =
+ // 2^n. The minimum alignment is 2^4 = 16.
+ header.kernarg_segment_alignment = std::max((size_t)4,
+ countTrailingZeros(MFI->getMaxKernArgAlign()));
+
if (STM.debuggerEmitPrologue()) {
header.debug_wavefront_private_segment_offset_sgpr =
KernelInfo.DebuggerWavefrontPrivateSegmentOffsetSGPR;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
index 0c8b79d496d..5d0640b816f 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
@@ -50,6 +50,10 @@ public:
return KernArgSize;
}
+ unsigned getMaxKernArgAlign() const {
+ return MaxKernArgAlign;
+ }
+
void setABIArgOffset(unsigned NewOffset) {
ABIArgOffset = NewOffset;
}
OpenPOWER on IntegriCloud