3.
Revision 1.0

Copyright© 2011, XLsoft K.K. All rights reserved.

1

Linux*-vec_reportn•Windows*/Qvec_reportn
nn=0:n=1:n=2:n=3:
n=4:
n=5:

Copyright© 2011, XLsoft K.K. All rights reserved.

2

– Existence of vector dependence""– Nonunit stride used"
– Mixed Data Types"– Subscript too complex""– Unsupported Loop Structure"""– Contains unvectorizable statement at line XX""

XX"– Condition too Complex– Not Inner Loop

– Condition may protect exception– Vectorization possible but seems inefficient

""

"

""

– Low trip count
""

"

"
"

– Operator unsuited for vectorization"

Copyright© 2011, XLsoft K.K. All rights reserved.

"3

"

"

for (i=0;i<=MAX;i++)for (j=0;j<=MAX;j++) {c[i][j]+=1; //c[j][i]+=1; //A[j*j]+=1;//
A[B[j]]+=1; //if (A[MAX-j]=1) last1=j;}//••

Copyright© 2011, XLsoft K.K. All rights reserved.

4

C/C++ FortranCFortran•• CTips

FortranFortran

C[I][J] = C[I][J] + A[I][K] * B[K][J]C(J,I) = C(J,I) + A(K,I) * B(J,K)
C(I,J) = C(I,J) + A(I,K) * B(K,J)

Copyright© 2011, XLsoft K.K. All rights reserved.

5

""

SIMD

int A[MAX-50];
for (i = 0; i < MAX; i++) {if (i < MAX-50) A[i] = 0;…
}

Copyright© 2011, XLsoft K.K. All rights reserved.

6

""#pragma loop count(5)for (i = 0; i < MAX1; ++i) {a1[i] = b1[i] * c1[i] + d1[i];}#pragma loop count(1000)for (i = 0; i < MAX2; ++i) {a2[i] = b2[i] * c2[i] + d2[i];}Copyright© 2011, XLsoft K.K. All rights reserved.

7

""

32bit

#pragma distribute point –for (i = 0; i < N; i++) {A[i] = B[i] * max(C[i], D[i]) + F[i] - E[i];#pragma distribute point
G[i] = H[i] * sin(I[i]) + J[i] / K[i];}Copyright© 2011, XLsoft K.K. All rights reserved.

8

#pragma novector –#pragma vector always –#pragma vector alwaysfor (i = 0; i < MAX; ++i) {a[i] = b[i] * c[i] + d[i];}6-9Copyright© 2011, XLsoft K.K. All rights reserved.

9

""

struct _xx { int data; int bound; };doit1(int *a, struct _xx *x) {for (int i = 0; i < x->bound; i++)a[i] = 0;}
struct _xx { int data; int bound; };doit1(int *a, struct _xx *x) {int MAX = x->bound;for (int i = 0; i < MAX; i++)a[i] = 0;}
Copyright© 2011, XLsoft K.K. All rights reserved.

10

""
int howmany_close(double *x, double *y) {long long withinborder=0;
double dist;for(int i=0;i<MAX;i++) {dist=sqrtf(x[i]*x[i] + y[i]*y[i]);if (dist<5) withinborder++;}}

Copyright© 2011, XLsoft K.K. All rights reserved.

11

""•
•2()

void scale(float *z, float *x) {for (i = 0; i < 100; i++)z[i] = A * x[i];}Copyright© 2011, XLsoft K.K. All rights reserved.

zx12

• IPO
IPO-ipo (Linux)• C99/Qipo (Windows)

restrict-restrict (Linux)/Qrestrict (Windows)

void mult(int a[][NUM], int b[restrict][NUM]);void foo(int *x, int *y, int * restrict z) {int i;for (i = 0; i < 100; i++) z[i] = A * x[i] + y[i];}Copyright© 2011, XLsoft K.K. All rights reserved.

13

ivdep#pragma ivdepfor (i = 0; i < 100; i++)z[i] = A * x[i] + y[i];!DEC$ IVDEPDO I=1, N
A(INDARR(I)) = A(INDARR(I)) + B(I)END DO

Copyright© 2011, XLsoft K.K. All rights reserved.

14

-fno-alias (Linux)/Oa (Windows)

Copyright© 2011, XLsoft K.K. All rights reserved.

15

•Linux:-opt_report -opt_report_phase=<phase>•Windows:/Qopt_report /Qopt_report_phase:<phase><phase> =ipohlohpopgoallilo:
icc -O3 -xHost -opt-report -opt-report-phase=hlo sample.c※ -O3

Copyright© 2011, XLsoft K.K. All rights reserved.

16

HLO

Block, Unroll, Jam Report:(loop line numbers, unroll factors and type of transformation)<pardat.f90;157:157;hlo_unroll;parallel_data_mp_exchange_;0>Loop at line 157 unrolled with remainder by 2
Loop at line 157 completely unrolled by 1

<red_black.f90;11:138;IPO INLINING;MAIN__;0><pardat.f90;187:187;hlo_unroll;parallel_data_mp_exchange_;0>
INLINING REPORT: (MAIN__) [1/2=50.0%]
Loop at line 187 unrolled with remainder by 2
Loop at line 187 completely unrolled by 1-> for_write_seq_lis(EXTERN)-> for_write_seq_lis_xmit(EXTERN)<pardat.f90;217:217;hlo_unroll;parallel_data_mp_exchange_;0>-> for_write_seq_lis(EXTERN)
Loop at line 217 unrolled with remainder by 2-> for_write_seq_lis_xmit(EXTERN)
Loop at line 217 completely unrolled by 1-> output_mp_out_(EXTERN)-> mpi_wtime_(EXTERN)-> poisson_red_black_(2) (isz = 2278) (sz = 2295 (983+1312))-> mpi_wtime_(EXTERN)-> for_check_mult_overflow64(EXTERN)
IPO-> for_alloc_allocatable(EXTERN)-> for_check_mult_overflow64(EXTERN)

Copyright© 2011, XLsoft K.K. All rights reserved.

17

Copyright© 2011, XLsoft K.K. All rights reserved.

18