Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IACA analysis fails due to pointer_increment #71

Closed
sguera opened this issue Dec 13, 2017 · 9 comments
Closed

IACA analysis fails due to pointer_increment #71

sguera opened this issue Dec 13, 2017 · 9 comments

Comments

@sguera
Copy link

sguera commented Dec 13, 2017

When running:

 kerncraft -p ECM stencil.c -m Intel_Xeon_CPU_X5650_2.67GHz_mod.yml  -D M 1224 -D N 1224

I get:

kerncraft                                    
stencil.c -m Intel_Xeon_CPU_X5650_2.67GHz_mod.yml
-D M 1224 -D N 1224
------------------------------------- ECM --------------------------------------
IACA analysis failed: pointer_increment could not be detected automatically. Use --pointer-increment to set manually to byte offset of store pointer address between consecutive assembly block iterations.

Content of stencil.c:

double a[M][N];
double b[M][N];
double W[M][N][2];

for(int j=1; j < M-1; j++){
for(int i=1; i < N-1; i++){
b[j][i] = W[j][i][0] * a[j][i]
+ W[j][i][1] * ((a[j][i-1] + a[j][i+1]) + (a[j-1][i] + a[j+1][i]))
;
}
}
@sguera
Copy link
Author

sguera commented Dec 13, 2017

It also fails with this code:

double a[M][N];
double b[M][N];
double c0;
double c1;
double c2;

for(int j=1; j < M-1; j++){
for(int i=1; i < N-1; i++){
b[j][i] = c0 * a[j][i]
+ c1 * (a[j][i-1] + a[j-1][i] + a[j+1][i] + a[j][i+1])
+ c2 * (a[j-1][i-1] + a[j+1][i-1] + a[j-1][i+1] + a[j+1][i+1])
;
}
}

@cod3monk
Copy link
Member

you can resolve this by manually providing the pointer increment via --pointer-increment. For me to investigate this issue further, you will need to provide the generated assembly file.

@cod3monk
Copy link
Member

cod3monk commented Jan 8, 2018

@sguera Have you tried the latest kerncraft version? Did it solve the problem? If not, could you provide the generated assembly file for debugging purposes.

@sguera
Copy link
Author

sguera commented Jan 10, 2018

I just tried for both the codes. I still get the same error with the latest kerncraft.
I attach the 2 assembly files.

2D-5pt-variable.s.txt
2D-5pt-constant.s.txt

@cod3monk
Copy link
Member

cod3monk commented Jan 10, 2018

It is not en error, you can always set the pointer increment manually: for the 2D-5pt-variable code use --pointer-increment 16 and for the 2D-5pt-constant code use --pointer-increment 8.

I will try to tweak the heuristics to also handle the codes you provided, but there will always be cases where it fails an the loop or pointer increment needs to be manually given.

@sguera
Copy link
Author

sguera commented Jan 10, 2018

I understand.. the problem is when we want to use it automatically on all the bouquet of stencils that can be generated through STEMPEL (generate each possible combination + for each code kerncraft analysis + for each code run through PROVA! and then validate)

@sguera
Copy link
Author

sguera commented Jan 10, 2018

For me to understand how to do it (even if not automatically), can you explain or give me a reference in how to identify the correct pointer increment (and then manually specify it?

@cod3monk
Copy link
Member

You need to identify the loop in the assembly code. iaca_marker helps here, most of the time the default selection is correct. Then in the assembly you will need to look for the store memory references and identify the increment from one block iteration to the next.

@cod3monk
Copy link
Member

The two cases you provided are now recognized automatically, but as said before: there will always be situations where the heuristic fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants