brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · b87ed4f Raw
80 lines · plain
1; RUN: opt %loadNPMPolly -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-vector-register-bitwidth=256 -polly-target-2nd-cache-level-size=262144 '-passes=polly-custom<opt-isl>' -disable-output < %s2;3; RUN: opt %loadNPMPolly '-passes=polly-custom<deps>' -polly-print-deps -disable-output < %s | FileCheck %s --check-prefix=DEPENDENCES4;5;    /* C := A * B + C */6;    /* Elements of the matrices A, B, C have the char type. */7;    /* The type size of elements of the matrix multiplication operands is used8;       to determine the parameters of the code produced by the optimization9;       of the matrix multiplication (e.g. bounds of the loops of the loop10;       nest, the innermost loop body). This test checks the form of11;       the generated loop nest. See getMicroKernelParams and12;       getMacroKernelParams from lib/Transform/ScheduleOptimizer.cpp13;       for details.14;15;       This patch also checks that we can detect matrix multiplication16;       in case there are reduction dependencies and there are not RAW17;       dependencies. */18;    for (i = 0; i < _PB_NI; i++)19;      for (j = 0; j < _PB_NJ; j++)20;   for (k = 0; k < _PB_NK; ++k)21;     C[i][j] += A[i][k] * B[k][j];22;23; DEPENDENCES:  RAW dependences:24; DEPENDENCES-NEXT:    {  }25; DEPENDENCES-NEXT:  WAR dependences:26; DEPENDENCES-NEXT:    {  }27; DEPENDENCES-NEXT:  WAW dependences:28; DEPENDENCES-NEXT:    {  }29; DEPENDENCES-NEXT:  Reduction dependences:30; DEPENDENCES-NEXT:    { Stmt_for_body6[i0, i1, i2] -> Stmt_for_body6[i0, i1, 1 + i2] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023 and 0 <= i2 <= 1022 }31; DEPENDENCES-NEXT:  Transitive closure of reduction dependences:32; DEPENDENCES-NEXT:    { Stmt_for_body6[i0, i1, i2] -> Stmt_for_body6[i0, i1, o2] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023 and ((i2 >= 0 and i2 < o2 <= 1023) or (i2 <= 1023 and 0 <= o2 < i2)) }33;34target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"35target triple = "x86_64-unknown-unknown"36 37define internal void @kernel_gemm(i32 %ni, i32 %nj, i32 %nk, i8 signext %alpha, i8 signext %beta, ptr %C, ptr %A, ptr %B) {38entry:39  br label %entry.split40 41entry.split:                                      ; preds = %entry42  br label %for.cond1.preheader43 44for.cond1.preheader:                              ; preds = %for.inc23, %entry.split45  %indvars.iv45 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next46, %for.inc23 ]46  br label %for.cond4.preheader47 48for.cond4.preheader:                              ; preds = %for.inc20, %for.cond1.preheader49  %indvars.iv42 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next43, %for.inc20 ]50  br label %for.body651 52for.body6:                                        ; preds = %for.body6, %for.cond4.preheader53  %indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next, %for.body6 ]54  %arrayidx8 = getelementptr inbounds [1024 x i8], ptr %A, i64 %indvars.iv45, i64 %indvars.iv55  %tmp = load i8, ptr %arrayidx8, align 156  %arrayidx12 = getelementptr inbounds [1024 x i8], ptr %B, i64 %indvars.iv, i64 %indvars.iv4257  %tmp1 = load i8, ptr %arrayidx12, align 158  %mul = mul i8 %tmp1, %tmp59  %arrayidx17 = getelementptr inbounds [1024 x i8], ptr %C, i64 %indvars.iv45, i64 %indvars.iv4260  %tmp2 = load i8, ptr %arrayidx17, align 161  %add = add i8 %mul, %tmp262  store i8 %add, ptr %arrayidx17, align 163  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 164  %exitcond = icmp ne i64 %indvars.iv.next, 102465  br i1 %exitcond, label %for.body6, label %for.inc2066 67for.inc20:                                        ; preds = %for.body668  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 169  %exitcond44 = icmp ne i64 %indvars.iv.next43, 102470  br i1 %exitcond44, label %for.cond4.preheader, label %for.inc2371 72for.inc23:                                        ; preds = %for.inc2073  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 174  %exitcond47 = icmp ne i64 %indvars.iv.next46, 102475  br i1 %exitcond47, label %for.cond1.preheader, label %for.end2576 77for.end25:                                        ; preds = %for.inc2378  ret void79}80