Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit fb3ad89

Browse files
committed
AMDGPU: Emit error if too much LDS is used
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267922 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4030c6e commit fb3ad89

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
504504
Ctx.emitError("too many user SGPRs used");
505505
}
506506

507+
if (MFI->LDSSize > static_cast<unsigned>(STM.getLocalMemorySize())) {
508+
LLVMContext &Ctx = MF.getFunction()->getContext();
509+
Ctx.emitError("LDS size exceeds device maximum");
510+
}
511+
507512
ProgInfo.VGPRBlocks = (ProgInfo.NumVGPR - 1) / 4;
508513
ProgInfo.SGPRBlocks = (ProgInfo.NumSGPR - 1) / 8;
509514
// Set the value to initialize FP_ROUND and FP_DENORM parts of the mode

test/CodeGen/AMDGPU/32-bit-local-address-space.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
1+
; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
22
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
33

44
; On Southern Islands GPUs the local address space(3) uses 32-bit pointers and
@@ -91,12 +91,12 @@ define void @infer_ptr_alignment_global_offset(float addrspace(1)* %out, i32 %ti
9191

9292

9393
@ptr = addrspace(3) global i32 addrspace(3)* undef
94-
@dst = addrspace(3) global [16384 x i32] undef
94+
@dst = addrspace(3) global [16383 x i32] undef
9595

9696
; FUNC-LABEL: {{^}}global_ptr:
9797
; SI: ds_write_b32
9898
define void @global_ptr() nounwind {
99-
store i32 addrspace(3)* getelementptr ([16384 x i32], [16384 x i32] addrspace(3)* @dst, i32 0, i32 16), i32 addrspace(3)* addrspace(3)* @ptr
99+
store i32 addrspace(3)* getelementptr ([16383 x i32], [16383 x i32] addrspace(3)* @dst, i32 0, i32 16), i32 addrspace(3)* addrspace(3)* @ptr
100100
ret void
101101
}
102102

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; RUN: not llc -march=amdgcn -mcpu=tahiti < %s 2>&1 | FileCheck -check-prefix=ERROR %s
2+
; RUN: not llc -march=amdgcn -mcpu=hawaii < %s 2>&1 | FileCheck -check-prefix=ERROR %s
3+
; RUN: not llc -march=amdgcn -mcpu=fiji < %s 2>&1 | FileCheck -check-prefix=ERROR %s
4+
5+
; ERROR: error: LDS size exceeds device maximum
6+
7+
@huge = internal unnamed_addr addrspace(3) global [100000 x i32] undef, align 4
8+
9+
define void @promote_alloca_size_256() {
10+
entry:
11+
%v0 = getelementptr inbounds [100000 x i32], [100000 x i32] addrspace(3)* @huge, i32 0, i32 0
12+
store i32 0, i32 addrspace(3)* %v0
13+
ret void
14+
}

0 commit comments

Comments
 (0)