Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.

__m256 not recognized by OneAPI

Anonymous
Not applicable
2,919 Views

And all its instruction family.

wqaxs36_0-1605532741021.png

 

0 Kudos
1 Solution
Viet_H_Intel
Moderator
2,845 Views

since icx is based on LLVM technology and clang doesn't treat __m128 as a struct or union.

So code needs to be changed as t8.cpp

C:\temp>icl t9.cpp

Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827

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

t9.cpp

Microsoft (R) Incremental Linker Version 14.28.29333.0

Copyright (C) Microsoft Corporation. All rights reserved.

-out:t9.exe

t9.obj

C:\temp>t9.exe

1.5

2.5

3.5

4.5

C:\temp>icx t9.cpp

Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827

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

t9.cpp(11,8): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union

V.m128_f32[i] = i + 1.5;

^~~~~~~~

t9.cpp(12,12): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union

a = V.m128_f32[i];

^~~~~~~~

2 errors generated.

$ clang++ t9.cpp
t9.cpp:11:3: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
V.m128_f32[i] = i + 1.5;
~^~~~~~~~~
t9.cpp:12:7: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
a = V.m128_f32[i];
~^~~~~~~~~
2 errors generated.

C:\temp>icx t8.cpp

Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827

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

C:\temp>t8.exe

1.5

2.5

3.5

4.5

C:\temp> notepad t9.cpp

#include <immintrin.h>

#include <iostream>

using namespace std;

int main () {

float a;

__m128 V;

for (int i =0; i< 4; i ++)

{

V.m128_f32[i] = i + 1.5;

a = V.m128_f32[i];

cout << a << endl;

}

return 1 ;

}

C:\temp> notepad t8.cpp

#include <iostream>

#include <immintrin.h>

#include <vector>

using namespace std;

int main () {

__m128 a;

float b;

for (int i =0; i< 4; i ++)

{

a[i] = i +1.5;

b = a[i];

cout << b << endl;

}

return 0;

}

 

View solution in original post

6 Replies
GouthamK_Intel
Moderator
2,888 Views

Hi,

Thanks for reaching out to us!

Could you please provide steps to reproduce and source code for which you are getting this error.

Also, let us know the oneAPI toolkit version which you are currently using.


Regards

Goutham


0 Kudos
Anonymous
Not applicable
2,884 Views
#include <immintrin.h>
#include <corecrt_math_defines.h>
#include <corecrt_math.h>

typedef          __int8  Int8;
typedef          __int16 Int16;
typedef          __int32 Int32;
typedef          __int64 Int64;
typedef unsigned __int8  UInt8;
typedef unsigned __int16 UInt16;
typedef unsigned __int32 UInt32;
typedef unsigned __int64 UInt64;
typedef          char*   String;
typedef          float   Single;
typedef          double  Double;
typedef          bool    Boolean;

struct Matrix3D
{
    union
    {
        struct
        {
            Single   M11, M12, M13, M14;
            Single   M21, M22, M23, M24;
            Single   M31, M32, M33, M34;
            Single   M44, M43, M42, M41;
        };
        __m128 Row[4];
        float Arr[4][4];
    };

    __m256 _Row[4];

    friend Matrix3D     operator*(Matrix3D left, Matrix3D right)
    {
        Matrix3D Res = { 0 };
        __m128   Dst;

        for (Int32 i = 0; i < 4; i++)
        {
            for (Int32 j = 0; j < 4; j++)
            {
                Dst = _mm_mul_ps(left.Row[i], right.Row[j]);
                Dst = _mm_hadd_ps(Dst, Dst);
                Dst = _mm_hadd_ps(Dst, Dst);

                Res.Arr[i][j] += Dst.m128_f32[0];

                //result.Arr[i][j] += left.Arr[i][0] * right.Arr[0][j];
                //result.Arr[i][j] += left.Arr[i][1] * right.Arr[1][j];
                //result.Arr[i][j] += left.Arr[i][2] * right.Arr[2][j];
                //result.Arr[i][j] += left.Arr[i][3] * right.Arr[3][j];
            }
        }

        Res._Row[0] = _mm256_broadcast_ps(&Res.Row[0]);
        Res._Row[1] = _mm256_broadcast_ps(&Res.Row[1]);
        Res._Row[2] = _mm256_broadcast_ps(&Res.Row[2]);
        Res._Row[3] = _mm256_broadcast_ps(&Res.Row[3]);

        return (Res);
    }
};
0 Kudos
GouthamK_Intel
Moderator
2,863 Views

Hi,

Thanks for providing the reproducer code, we are able to reproduce the error which you are facing.

We are escalating this thread to the concerned internal team who will help you in resolving your issue.


Regards

Goutham


Viet_H_Intel
Moderator
2,857 Views

icx requires at least /Qxavx to use _m128/_m256 and intrinsic.

However, it gave an error on m128_f32[0]. I've reported this issue to the compiler Developer.


Thanks,


Viet_H_Intel
Moderator
2,846 Views

since icx is based on LLVM technology and clang doesn't treat __m128 as a struct or union.

So code needs to be changed as t8.cpp

C:\temp>icl t9.cpp

Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827

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

t9.cpp

Microsoft (R) Incremental Linker Version 14.28.29333.0

Copyright (C) Microsoft Corporation. All rights reserved.

-out:t9.exe

t9.obj

C:\temp>t9.exe

1.5

2.5

3.5

4.5

C:\temp>icx t9.cpp

Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827

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

t9.cpp(11,8): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union

V.m128_f32[i] = i + 1.5;

^~~~~~~~

t9.cpp(12,12): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union

a = V.m128_f32[i];

^~~~~~~~

2 errors generated.

$ clang++ t9.cpp
t9.cpp:11:3: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
V.m128_f32[i] = i + 1.5;
~^~~~~~~~~
t9.cpp:12:7: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
a = V.m128_f32[i];
~^~~~~~~~~
2 errors generated.

C:\temp>icx t8.cpp

Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827

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

C:\temp>t8.exe

1.5

2.5

3.5

4.5

C:\temp> notepad t9.cpp

#include <immintrin.h>

#include <iostream>

using namespace std;

int main () {

float a;

__m128 V;

for (int i =0; i< 4; i ++)

{

V.m128_f32[i] = i + 1.5;

a = V.m128_f32[i];

cout << a << endl;

}

return 1 ;

}

C:\temp> notepad t8.cpp

#include <iostream>

#include <immintrin.h>

#include <vector>

using namespace std;

int main () {

__m128 a;

float b;

for (int i =0; i< 4; i ++)

{

a[i] = i +1.5;

b = a[i];

cout << b << endl;

}

return 0;

}

 

Viet_H_Intel
Moderator
2,533 Views

Since we have provided a solution, we are going to close this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Thanks,


0 Kudos
Reply