- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

**"icpc -xHost -O3 -parallel -vec-report3 -c test.cpp"**results in "test.cpp(8): (col. 7) remark: loop was not vectorized: dereference too complex." . This loop is described as being vectorizable by the Intel Parallel Composer documentation for #pragma ivdep.Is there anyway to get this loop to vectorize with icpc in Linux/Mac?

[cpp]void vectorization_test(int* a, int* b, int n) { int j; #pragma ivdep for (j=0; j] = a[b ] + 1; } } [/cpp]

Link Copied

11 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

If you have the job of getting meaningless vectorization reports on all loops regardless of value, this is a reasonable way. #pragma vector always says vectorize regardless of efficiency or possible degradation of exception handling.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

[cpp]void indirect_increment(int* a, int* b, int n) { int j; #pragma ivdep #pragma vector always for (j=0; j] = a[b ] + 1; } } [/cpp]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

icc -E test.cpp > test.i

you might submit the test.i file on your premier.intel.com account.

Also, of course, it's generally risky using names which conflict with shell built-ins, although I don't see how it could matter in this context.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

I've also tried an equivalent Fortran subroutine. Same problem, the only difference is, instead the reason for not vectorizing is that "subscript too complex".

[fortran]subroutine vectorization_test(na,nb,a,b) integer :: na, nb real(kind=8) :: a(na), b(nb) !dir$ ivdep !dir$ vector always do i=1,nb a(b(i)) = a(b(i)) + 1 end do end subroutine[/fortran]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Andrew

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

When I was experimenting with CEAN features of Composer XE I found that a for loop containing a single CEAN statement would not "port" the pragmas into (onto) the CEAN statement. However, by placing the #pragma's on the CEAN statement the vectorization was produced. With this in mind, try:

**void**indirect_increment(**int***a,**int***b,**int**n)

{**int**j;**for**(j=0;j

#pragmaivdep

#pragmavectoralways

a[b

}

Jim Dempsey

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

test.cpp(6): (col. 4) remark: loop was not vectorized: existence of vector dependence.

test.cpp(10): (col. 7) remark: vector dependence: assumed ANTI dependence between a line 10 and a line 10.

test.cpp(10): (col. 7) remark: vector dependence: assumed FLOW dependence between a line 10 and a line 10.

test.cpp(10): (col. 7) remark: vector dependence: assumed FLOW dependence between a line 10 and a line 10.

test.cpp(10): (col. 7) remark: vector dependence: assumed ANTI dependence between a line 10 and a line 10.

test.cpp(6): (col. 4) remark: loop was not vectorized: existence of vector dependence.test.cpp(10): (col. 7) remark: vector dependence: assumed ANTI dependence between a line 10 and a line 10.test.cpp(10): (col. 7) remark: vector dependence: assumed FLOW dependence between a line 10 and a line 10.test.cpp(10): (col. 7) remark: vector dependence: assumed FLOW dependence between a line 10 and a line 10.test.cpp(10): (col. 7) remark: vector dependence: assumed ANTI dependence between a line 10 and a line 10.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

As the compiler does not know if b

--mark

$ cat t2.cpp

const int N = 128;

int a

int b

void indirect_increment(int n)

{

int j;

#pragma ivdep

#pragma vector always

for (j=0; j

a[b

}

}

$ icpc -V -c -vec-report2 t2.cpp

Intel C++ Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100806 Package ID: l_cproc_p_11.1.073

Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

t2.cpp(10): (col. 5) remark: LOOP WAS VECTORIZED.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

[cpp]void gather_scatter(int face0, int face1, double* cell_values, double* face_values, int* owner, int* nghbr) { int i_face, i_owner, i_nghbr; double fvl; #pragma ivdep #pragma vector always for(i_face = face0; i_face < face1; ++i_face) { i_owner = owner[i_face]; i_nghbr = nghbr[i_face]; fvl = face_values[i_face]; cell_values[i_owner] = cell_values[i_owner] + fvl; cell_values[i_nghbr] = cell_values[i_nghbr] - fvl; } }[/cpp]

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page