Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GPGPU] Correctly initialize array order and fixed_element information
Summary: This information is necessary for PPCG to perform correct life range reordering. With these changes applied we can live-range reorder some of the important kernels in COSMO. We also update and rename one test case, which previously could not be optimized and now is optimized thanks to live-range reordering. To preserve test coverage we add a new test case scalar-writes-in-scop-requires-abort.ll, which exercises our automatic abort in case of scalar writes in the kernel. Reviewers: Meinersbur, bollu, singam-sanjay Subscribers: nemanjai, pollydev, llvm-commits, kbarton Tags: #polly Differential Revision: https://reviews.llvm.org/D36929 llvm-svn: 311259
- Loading branch information
1 parent
91522ff
commit ecb94a0
Showing
6 changed files
with
111 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
; RUN: opt %loadPolly -S -polly-use-llvm-names -polly-scops \ | ||
; RUN: -polly-acc-dump-code -analyze \ | ||
; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s -check-prefix=SCOP | ||
|
||
; RUN: opt %loadPolly -S -polly-use-llvm-names -polly-codegen-ppcg \ | ||
; RUN: -polly-acc-dump-code \ | ||
; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s -check-prefix=CODE | ||
|
||
; RUN: opt %loadPolly -S -polly-use-llvm-names -polly-codegen-ppcg \ | ||
; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s -check-prefix=HOST-IR | ||
|
||
; REQUIRES: pollyacc | ||
|
||
; SCOP: Invariant Accesses: { | ||
; SCOP-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] | ||
; SCOP-NEXT: { Stmt_loop[i0] -> MemRef_p[0] }; | ||
; SCOP-NEXT: Execution Context: { : } | ||
; SCOP-NEXT: } | ||
|
||
; CODE: # kernel0 | ||
; CODE-NEXT: { | ||
; CODE-NEXT: if (32 * b0 + t0 <= 1025) { | ||
; CODE-NEXT: Stmt_loop(32 * b0 + t0); | ||
; CODE-NEXT: write(0); | ||
; CODE-NEXT: } | ||
; CODE-NEXT: sync0(); | ||
; CODE-NEXT: } | ||
|
||
; Check that we generate a correct "always false" branch. | ||
; HOST-IR: br i1 false, label %polly.start, label %loop.pre_entry_bb | ||
|
||
; This test case checks that we generate correct code if PPCGCodeGeneration | ||
; decides a build is unsuccessful with invariant load hoisting enabled. | ||
; | ||
; There is a conditional branch which switches between the original code and | ||
; the new code. We try to set this conditional branch to branch on false. | ||
; However, invariant load hoisting changes the structure of the scop, so we | ||
; need to change the way we *locate* this instruction. | ||
|
||
target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" | ||
target triple = "i386-apple-macosx10.12.0" | ||
|
||
define void @foo(float* %A, float* %p) { | ||
entry: | ||
br label %loop | ||
|
||
loop: | ||
%indvar = phi i64 [0, %entry], [%indvar.next, %loop] | ||
%indvar.next = add i64 %indvar, 1 | ||
%invariant = load float, float* %p | ||
%ptr = getelementptr float, float* %A, i64 %indvar | ||
store float 42.0, float* %ptr | ||
%cmp = icmp sle i64 %indvar, 1024 | ||
br i1 %cmp, label %loop, label %loop2 | ||
|
||
loop2: | ||
%indvar2 = phi i64 [0, %loop], [%indvar2.next, %loop2] | ||
%indvar2f = phi float [%invariant, %loop], [%indvar2f, %loop2] | ||
%indvar2.next = add i64 %indvar2, 1 | ||
store float %indvar2f, float* %A | ||
%cmp2 = icmp sle i64 %indvar2, 1024 | ||
br i1 %cmp2, label %loop2, label %end | ||
|
||
end: | ||
ret void | ||
} |