C5002 1204 自动矢量化程序原因代码是什么意思?

What does C5002 1204 auto-vectorizer reason code mean?

我是一名学生,正在学习矢量化技术。我正在尝试使编译器向量化一个函数,该函数将两个矩阵相乘(每个矩阵由大小相等的元素组成)。代码如下所示:

#define f_dim1 2000
#define f_dim2 240
#define s_dim1 240
#define s_dim2 2000

#define i_dim1 4
#define i_dim2 4

void automaticallyBuilt(float* firstMatrix, float* secondMatrix, float* result) {
    for (int i = 0; i < f_dim2; i++) { // rows in frist matrix
        for (int j = 0; j < s_dim1; j++) { // columns in second matrix
            for (int o = 0; o < f_dim1; o++) { // row element of first matrix = column element of second
                for (int k = 0; k < i_dim2; k++) { // rows in inner matrix
                    for (int l = 0; l < i_dim1; l++) { // columns in inner matrix
                        for (int h = 0; h < i_dim2; h++) { // row element of inner = column element of inner
                            *(result + i*s_dim1*i_dim2*i_dim1 + j*i_dim2*i_dim1 + k*i_dim1 + l) +=
                                *(firstMatrix + i*f_dim1*i_dim2*i_dim1 + o*i_dim2*i_dim1 + k*i_dim1 + h) *
                                *(secondMatrix + o*s_dim1*i_dim2*i_dim1 + j*i_dim2*i_dim1 + h*i_dim1 + l);
                            // smth like result[i][j][k][l] += firstMatrix[i][o][k][h] * secondMatrix[o][j][h][l];
                        }
                    }
                }
            }
        }
    }
}

为了让编译器对其进行矢量化,我修改了这段代码,如下所示:

#define f_dim1 2000
#define f_dim2 240
#define s_dim1 240
#define s_dim2 2000

#define i_dim1 4
#define i_dim2 4

void automaticallyVectorized(float* firstMatrix, float*  secondMatrix, float* result) {
    for (int i = 0; i < f_dim2; i++) { // rows in frist matrix
        for (int o = 0; o < f_dim1; o++) { // row element of first matrix = column element of second
            for (int j = 0; j < s_dim1; j++) { // columns in second matrix
                for (int k = 0; k < i_dim2; k++) { // rows in inner matrix
                    for (int h = 0; h < i_dim2; h++) { // row element of inner = column element of inner
                        float firstMatrixInnerRowElement = *(firstMatrix + i*f_dim1*i_dim2*i_dim1 + o* i_dim2*i_dim1 + k*i_dim1 + h);
                        float* resultInnerRow = result + i*s_dim1*i_dim2*i_dim1 + j*i_dim2*i_dim1 + k*i_dim1;
                        float* secondMatrixInnerColumnElementRow = secondMatrix + o*s_dim1*i_dim2*i_dim1 + j*i_dim2*i_dim1 + h*i_dim1;
                        for (int l = 0; l < i_dim1; l++) { // columns in inner matrix
                            resultInnerRow[l] += firstMatrixInnerRowElement * secondMatrixInnerColumnElementRow[l];
                        }
                    }
                }
            }
        }
    }
}

在构建编译器期间发出以下消息:

code.cpp(161) : info C5002: Loop not vectorized due to reason: "1204"

未提及代码 1204 here。此外,我还没有找到任何有关 Google 的信息。 我尝试使用 __restrict 修饰符但没有成功。

我使用 Visual Studio 2019,但我尝试使用 VS 2017 构建它,结果相同。

谁能解释一下这个原因码是什么意思?我不相信以前没有人遇到过这个问题。

此原因码表示循环嵌套太深

正如 Eljay 所建议的,我使用文档页面底部的 link 在 github 上发布了一个问题。这是答案的link