AMDGPU: allow specifying a workgroup size that needs to fit in a compute unit
authorTom Stellard <thomas.stellard@amd.com>
Thu, 14 Apr 2016 16:27:07 +0000 (16:27 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 14 Apr 2016 16:27:07 +0000 (16:27 +0000)
commit79a1fd718c71b4480dc9f00e8e77f4408ec9e6fa
treed7ad0eed911b428e15f871225d742595de9420b8
parentf110f8f9f7f46c668e03f4808e03aa54c2157269
AMDGPU: allow specifying a workgroup size that needs to fit in a compute unit

Summary:
For GL_ARB_compute_shader we need to support workgroup sizes of at least 1024. However, if we want to allow large workgroup sizes, we may need to use less registers, as we have to run more waves per SIMD.

This patch adds an attribute to specify the maximum work group size the compiled program needs to support. It defaults, to 256, as that has no wave restrictions.

Reducing the number of registers available is done similarly to how the registers were reserved for chips with the sgpr init bug.

Reviewers: mareko, arsenm, tstellarAMD, nhaehnle

Subscribers: FireBurn, kerberizer, llvm-commits, arsenm

Differential Revision: http://reviews.llvm.org/D18340

Patch By: Bas Nieuwenhuizen

llvm-svn: 266337
llvm/include/llvm/Support/MathExtras.h
llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
llvm/test/CodeGen/AMDGPU/large-work-group-promote-alloca.ll [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/large-work-group-registers.ll [new file with mode: 0644]