Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

c++ - Auto-Vectorization of Matrix Addition

I am trying simple matrix addition code to get auto vectorized.

float A[100];
float A[100];
float C[100];

int n = 6;

  for (int i=0; i<n; i++)
    for (int j=0; j<n; j++)
        C[i*n+j] = A[i*n+j] + B[i*n+j];

I am getting following remarks after using Rpass analysis flag for the above code :

the cost-model indicates that vectorization is not beneficial [-Rpass-missed=loop-vectorize]

the cost-model indicates that interleaving is not beneficial [-Rpass-missed=loop-vectorize]

loop not vectorized: the optimizer was unable to perform the requested transformation; the 
transformation might be disabled or specified as part of an unsupported transformation ordering

what changes should I do to make it vectorized and what does this remarks mean ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...