Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

__m512i array

$
0
0

I'm trying to write code by VNNI

There is a data type - __m512i

which I think is mapping to registers on CPU.

I'd like to locate an array of registers

Here is the code

#include <immintrin.h>
int main()
{
        const int size = 5;

        __m512i zero[size];

        for(int i=0; i<size; i++)
        {
                zero[i] = _mm512_setzero_si512();
        }

        return 0;
}

It works.

But when I try dynamic allocate memory

It doesn't work

#include <immintrin.h>
int main()
{
        const int size = 5;

        __m512i *zero = new __m512i[size];

        for(int i=0; i<size; i++)
        {
                zero[i] = _mm512_setzero_si512();
        }

        delete [] zero;

        return 0;
}

Is there any way to create registers dynamically?

Lot of thanks

BR,

chiungliang

TCE Level: 

TCE Open Date: 

Wednesday, March 11, 2020 - 18:21

Viewing all articles
Browse latest Browse all 1175

Trending Articles