Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accesses to global module LDS variable start from null, but kernel also thinks its variables start address is null. Fixed by not using a null as an address. Differential Revision: https://reviews.llvm.org/D102882
- Loading branch information
Showing
9 changed files
with
65 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds < %s | FileCheck -check-prefix=OPT %s | ||
; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s | FileCheck -check-prefix=OPT %s | ||
; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s | ||
|
||
; Check that module LDS is allocated at address 0 and kernel starts its | ||
; allocation past module LDS. | ||
|
||
@lds.size.1.align.1 = internal unnamed_addr addrspace(3) global [1 x i8] undef, align 1 | ||
@lds.size.16.align.16 = internal unnamed_addr addrspace(3) global [16 x i8] undef, align 16 | ||
|
||
; GCN-LABEL: {{^}}k0: | ||
; GCN-DAG: v_mov_b32_e32 [[NULL:v[0-9]+]], 0 | ||
; GCN-DAG: v_mov_b32_e32 [[ONE:v[0-9]+]], 1 | ||
; GCN: ds_write_b8 [[NULL]], [[ONE]] | ||
; GCN: v_mov_b32_e32 [[TWO:v[0-9]+]], 2 | ||
; GCN: ds_write_b8 [[NULL]], [[TWO]] offset:16 | ||
define amdgpu_kernel void @k0() { | ||
; OPT-LABEL: @k0( | ||
; OPT-NEXT: call void @llvm.donothing() [ "ExplicitUse"([[LLVM_AMDGCN_MODULE_LDS_T:%.*]] addrspace(3)* @llvm.amdgcn.module.lds) ] | ||
; OPT-NEXT: [[LDS_SIZE_1_ALIGN_1_BC:%.*]] = bitcast [1 x i8] addrspace(3)* getelementptr inbounds ([[LLVM_AMDGCN_MODULE_LDS_T]], [[LLVM_AMDGCN_MODULE_LDS_T]] addrspace(3)* @llvm.amdgcn.module.lds, i32 0, i32 0) to i8 addrspace(3)* | ||
; OPT-NEXT: store i8 1, i8 addrspace(3)* [[LDS_SIZE_1_ALIGN_1_BC]], align 1 | ||
; OPT-NEXT: [[LDS_SIZE_16_ALIGN_16_BC:%.*]] = bitcast [16 x i8] addrspace(3)* @lds.size.16.align.16 to i8 addrspace(3)* | ||
; OPT-NEXT: store i8 2, i8 addrspace(3)* [[LDS_SIZE_16_ALIGN_16_BC]], align 16 | ||
; OPT-NEXT: ret void | ||
; | ||
%lds.size.1.align.1.bc = bitcast [1 x i8] addrspace(3)* @lds.size.1.align.1 to i8 addrspace(3)* | ||
store i8 1, i8 addrspace(3)* %lds.size.1.align.1.bc, align 1 | ||
%lds.size.16.align.16.bc = bitcast [16 x i8] addrspace(3)* @lds.size.16.align.16 to i8 addrspace(3)* | ||
store i8 2, i8 addrspace(3)* %lds.size.16.align.16.bc, align 16 | ||
ret void | ||
} | ||
|
||
; GCN-LABEL: {{^}}f0: | ||
; GCN-DAG: v_mov_b32_e32 [[NULL:v[0-9]+]], 0 | ||
; GCN-DAG: v_mov_b32_e32 [[TREE:v[0-9]+]], 3 | ||
; GCN: ds_write_b8 [[NULL]], [[TREE]] | ||
define void @f0() { | ||
; OPT-LABEL: @f0( | ||
; OPT-NEXT: [[LDS_SIZE_1_ALIGN_1_BC:%.*]] = bitcast [1 x i8] addrspace(3)* getelementptr inbounds ([[LLVM_AMDGCN_MODULE_LDS_T:%.*]], [[LLVM_AMDGCN_MODULE_LDS_T]] addrspace(3)* @llvm.amdgcn.module.lds, i32 0, i32 0) to i8 addrspace(3)* | ||
; OPT-NEXT: store i8 3, i8 addrspace(3)* [[LDS_SIZE_1_ALIGN_1_BC]], align 1 | ||
; OPT-NEXT: ret void | ||
; | ||
%lds.size.1.align.1.bc = bitcast [1 x i8] addrspace(3)* @lds.size.1.align.1 to i8 addrspace(3)* | ||
store i8 3, i8 addrspace(3)* %lds.size.1.align.1.bc, align 1 | ||
ret void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters