Skip to content

Commit 67e94fb

Browse files
committed
ScheduleOptimizer: Allow to set register width in command line
We use this option to set a fixed register width in our test cases to make sure the results are identical accross platforms. llvm-svn: 292002
1 parent cc1f65c commit 67e94fb

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

polly/lib/Transform/ScheduleOptimizer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ static cl::opt<int> SecondCacheLevelSize(
162162
cl::desc("The size of the second level specified in bytes."), cl::Hidden,
163163
cl::init(262144), cl::ZeroOrMore, cl::cat(PollyCategory));
164164

165+
static cl::opt<int> VectorRegisterBitwidth(
166+
"polly-target-vector-register-bitwidth",
167+
cl::desc("The size in bits of a vector register (if not set, this "
168+
"information is taken from LLVM's target information."),
169+
cl::Hidden, cl::init(-1), cl::ZeroOrMore, cl::cat(PollyCategory));
170+
165171
static cl::opt<int> FirstLevelDefaultTileSize(
166172
"polly-default-tile-size",
167173
cl::desc("The default tile size (if not enough were provided by"
@@ -599,7 +605,11 @@ getMicroKernelParams(const llvm::TargetTransformInfo *TTI) {
599605

600606
// Nvec - Number of double-precision floating-point numbers that can be hold
601607
// by a vector register. Use 2 by default.
602-
auto Nvec = TTI->getRegisterBitWidth(true) / 64;
608+
long RegisterBitwidth = VectorRegisterBitwidth;
609+
610+
if (RegisterBitwidth == -1)
611+
RegisterBitwidth = TTI->getRegisterBitWidth(true);
612+
auto Nvec = RegisterBitwidth / 64;
603613
if (Nvec == 0)
604614
Nvec = 2;
605615
int Nr =

polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout.ll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true -polly-target-throughput-vector-fma=1 -polly-target-latency-vector-fma=8 -polly-target-1st-cache-level-associativity=8 -polly-target-2nd-cache-level-associativity=8 -polly-target-1st-cache-level-size=32768 -polly-target-2nd-cache-level-size=262144 -polly-optimized-scops < %s 2>&1 | FileCheck %s
1+
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true \
2+
; RUN: -polly-target-throughput-vector-fma=1 \
3+
; RUN: -polly-target-latency-vector-fma=8 \
4+
; RUN: -polly-target-1st-cache-level-associativity=8 \
5+
; RUN: -polly-target-2nd-cache-level-associativity=8 \
6+
; RUN: -polly-target-1st-cache-level-size=32768 \
7+
; RUN: -polly-target-2nd-cache-level-size=262144 \
8+
; RUN: -polly-optimized-scops \
9+
; RUN: -polly-target-vector-register-bitwidth=256 \
10+
; RUN: < %s 2>&1 | FileCheck %s
211
;
312
; /* C := alpha*A*B + beta*C */
413
; for (i = 0; i < _PB_NI; i++)

polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout_2.ll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true -polly-target-throughput-vector-fma=1 -polly-target-latency-vector-fma=8 -polly-target-1st-cache-level-associativity=8 -polly-target-2nd-cache-level-associativity=8 -polly-target-1st-cache-level-size=32768 -polly-target-2nd-cache-level-size=262144 -polly-ast -analyze < %s | FileCheck %s
1+
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true \
2+
; RUN: -polly-target-throughput-vector-fma=1 \
3+
; RUN: -polly-target-latency-vector-fma=8 \
4+
; RUN: -polly-target-1st-cache-level-associativity=8 \
5+
; RUN: -polly-target-2nd-cache-level-associativity=8 \
6+
; RUN: -polly-target-1st-cache-level-size=32768 \
7+
; RUN: -polly-target-2nd-cache-level-size=262144 -polly-ast \
8+
; RUN: -polly-target-vector-register-bitwidth=256 \
9+
; RUN: -analyze < %s | FileCheck %s
210
;
311
; /* C := alpha*A*B + beta*C */
412
; /* _PB_NK % Kc != 0 */

polly/test/ScheduleOptimizer/pattern-matching-based-opts_3.ll

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true -polly-target-throughput-vector-fma=1 -polly-target-latency-vector-fma=8 -analyze -polly-ast -polly-target-1st-cache-level-size=0 < %s 2>&1 | FileCheck %s
2-
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true -polly-target-throughput-vector-fma=1 -polly-target-latency-vector-fma=8 -analyze -polly-ast -polly-target-1st-cache-level-associativity=8 -polly-target-2nd-cache-level-associativity=8 -polly-target-1st-cache-level-size=32768 -polly-target-2nd-cache-level-size=262144 < %s 2>&1 | FileCheck %s --check-prefix=EXTRACTION-OF-MACRO-KERNEL
1+
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true \
2+
; RUN: -polly-target-throughput-vector-fma=1 \
3+
; RUN: -polly-target-latency-vector-fma=8 \
4+
; RUN: -analyze -polly-ast -polly-target-1st-cache-level-size=0 \
5+
; RUN: -polly-target-vector-register-bitwidth=256 \
6+
; RUN: < %s 2>&1 | FileCheck %s
7+
8+
; RUN: opt %loadPolly -polly-opt-isl -polly-pattern-matching-based-opts=true \
9+
; RUN: -polly-target-throughput-vector-fma=1 \
10+
; RUN: -polly-target-latency-vector-fma=8 \
11+
; RUN: -analyze -polly-ast -polly-target-1st-cache-level-associativity=8 \
12+
; RUN: -polly-target-2nd-cache-level-associativity=8 \
13+
; RUN: -polly-target-1st-cache-level-size=32768 \
14+
; RUN: -polly-target-vector-register-bitwidth=256 \
15+
; RUN: -polly-target-2nd-cache-level-size=262144 < %s 2>&1 \
16+
; RUN: | FileCheck %s --check-prefix=EXTRACTION-OF-MACRO-KERNEL
317
;
418
; /* C := alpha*A*B + beta*C */
519
; for (i = 0; i < _PB_NI; i++)

0 commit comments

Comments
 (0)