llvm-project
127 строк · 7.4 Кб
1; RUN: opt %loadNPMPolly -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-vector-register-bitwidth=256 \
8; RUN: -polly-target-2nd-cache-level-size=262144 \
9; RUN: '-passes=polly-opt-isl,print<polly-ast>' -disable-output < %s | FileCheck %s
10;
11; /* C := A * B + C */
12; /* Elements of the matrices B, C have the double type. */
13; /* Elements of the matrix A have the float type. */
14; /* The type size of elements of the matrix multiplication operands is used
15; to determine the parameters of the code produced by the optimization
16; of the matrix multiplication (e.g. bounds of the loops of the loop
17; nest, the innermost loop body). This test checks the form of
18; the generated loop nest. See getMicroKernelParams and
19; getMacroKernelParams from lib/Transform/ScheduleOptimizer.cpp
20; for details. */
21; for (i = 0; i < _PB_NI; i++)
22; for (j = 0; j < _PB_NJ; j++)
23; for (k = 0; k < _PB_NK; ++k)
24; C[i][j] += A[i][k] * B[k][j];
25;
26; CHECK: // 1st level tiling - Tiles
27; CHECK-NEXT: for (int c1 = 0; c1 <= 3; c1 += 1) {
28; CHECK-NEXT: for (int c3 = 0; c3 <= 1023; c3 += 1)
29; CHECK-NEXT: for (int c4 = 256 * c1; c4 <= 256 * c1 + 255; c4 += 1)
30; CHECK-NEXT: CopyStmt_0(0, c3, c4);
31; CHECK-NEXT: for (int c2 = 0; c2 <= 10; c2 += 1) {
32; CHECK-NEXT: for (int c6 = 96 * c2; c6 <= min(1023, 96 * c2 + 95); c6 += 1)
33; CHECK-NEXT: for (int c7 = 256 * c1; c7 <= 256 * c1 + 255; c7 += 1)
34; CHECK-NEXT: CopyStmt_1(0, c1, c2, c6, c7);
35; CHECK-NEXT: // 1st level tiling - Points
36; CHECK-NEXT: // Register tiling - Tiles
37; CHECK-NEXT: for (int c3 = 0; c3 <= 127; c3 += 1)
38; CHECK-NEXT: for (int c4 = 0; c4 <= min(23, -24 * c2 + 255); c4 += 1)
39; CHECK-NEXT: for (int c5 = 0; c5 <= 255; c5 += 1) {
40; CHECK-NEXT: // Loop Vectorizer Disabled
41; CHECK-NEXT: // Register tiling - Points
42; CHECK-NEXT: {
43; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3, 256 * c1 + c5);
44; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 1, 256 * c1 + c5);
45; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 2, 256 * c1 + c5);
46; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 3, 256 * c1 + c5);
47; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 4, 256 * c1 + c5);
48; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 5, 256 * c1 + c5);
49; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 6, 256 * c1 + c5);
50; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4, 8 * c3 + 7, 256 * c1 + c5);
51; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3, 256 * c1 + c5);
52; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 1, 256 * c1 + c5);
53; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 2, 256 * c1 + c5);
54; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 3, 256 * c1 + c5);
55; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 4, 256 * c1 + c5);
56; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 5, 256 * c1 + c5);
57; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 6, 256 * c1 + c5);
58; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 1, 8 * c3 + 7, 256 * c1 + c5);
59; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3, 256 * c1 + c5);
60; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 1, 256 * c1 + c5);
61; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 2, 256 * c1 + c5);
62; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 3, 256 * c1 + c5);
63; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 4, 256 * c1 + c5);
64; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 5, 256 * c1 + c5);
65; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 6, 256 * c1 + c5);
66; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 2, 8 * c3 + 7, 256 * c1 + c5);
67; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3, 256 * c1 + c5);
68; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 1, 256 * c1 + c5);
69; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 2, 256 * c1 + c5);
70; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 3, 256 * c1 + c5);
71; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 4, 256 * c1 + c5);
72; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 5, 256 * c1 + c5);
73; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 6, 256 * c1 + c5);
74; CHECK-NEXT: Stmt_for_body6(96 * c2 + 4 * c4 + 3, 8 * c3 + 7, 256 * c1 + c5);
75; CHECK-NEXT: }
76; CHECK-NEXT: }
77; CHECK-NEXT: }
78; CHECK-NEXT: }
79;
80target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
81target triple = "x86_64-unknown-unknown"
82
83; Function Attrs: noinline nounwind uwtable
84define internal void @kernel_gemm(i32 %ni, i32 %nj, i32 %nk, double %alpha, double %beta, ptr %C, ptr %A, ptr %B) #0 {
85entry:
86br label %entry.split
87
88entry.split: ; preds = %entry
89br label %for.cond1.preheader
90
91for.cond1.preheader: ; preds = %for.inc20, %entry.split
92%indvars.iv41 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next42, %for.inc20 ]
93br label %for.cond4.preheader
94
95for.cond4.preheader: ; preds = %for.inc17, %for.cond1.preheader
96%indvars.iv38 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next39, %for.inc17 ]
97br label %for.body6
98
99for.body6: ; preds = %for.body6, %for.cond4.preheader
100%indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next, %for.body6 ]
101%arrayidx8 = getelementptr inbounds [1024 x float], ptr %A, i64 %indvars.iv41, i64 %indvars.iv
102%tmp = load float, ptr %arrayidx8, align 4
103%conv = fpext float %tmp to double
104%arrayidx12 = getelementptr inbounds [1024 x double], ptr %B, i64 %indvars.iv, i64 %indvars.iv38
105%tmp1 = load double, ptr %arrayidx12, align 8
106%mul = fmul double %conv, %tmp1
107%arrayidx16 = getelementptr inbounds [1024 x double], ptr %C, i64 %indvars.iv41, i64 %indvars.iv38
108%tmp2 = load double, ptr %arrayidx16, align 8
109%add = fadd double %tmp2, %mul
110store double %add, ptr %arrayidx16, align 8
111%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
112%exitcond = icmp ne i64 %indvars.iv.next, 1024
113br i1 %exitcond, label %for.body6, label %for.inc17
114
115for.inc17: ; preds = %for.body6
116%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
117%exitcond40 = icmp ne i64 %indvars.iv.next39, 1024
118br i1 %exitcond40, label %for.cond4.preheader, label %for.inc20
119
120for.inc20: ; preds = %for.inc17
121%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
122%exitcond43 = icmp ne i64 %indvars.iv.next42, 1024
123br i1 %exitcond43, label %for.cond1.preheader, label %for.end22
124
125for.end22: ; preds = %for.inc20
126ret void
127}
128