Re: [Mingw-w64-public] MinGW64 AVX Code Generation on Windows 64 Bit

2021-04-09 Thread Carl Kleffner
Hi all,

please review and comment on
https://github.com/msys2/MINGW-packages/pull/8317 .

The idea of this binutils patch is to create unaligned rather than aligned
instructions at the assembler stage (as.exe) regardless of the created
assembler code by the user or the compiler. This is done by replacing the
opcodes with the opcodes of unaligned versions of the following
instructions:

VMOVDQA   >>  VMOVDQU
VMOVAPS   >>  VMOVUPS
VMOVAPD   >>  VMOVUPD
VMOVAPD32  >>  VMOVUPD32
VMOVAPD64  >>  VMOVUPD64

This replacement is unconditional. That means ALL occurrences of these
aligned instructions will be replaced, regardless of whether they work on
XMM, YMM, or ZMM registers. According to Intel the performance is not
affected in case of aligned memory accesses. On the other hand unaligned
memory access will of course work also on Win64 with these instructions.

There are some other aligned instructions which cannot be replaced easily
as they have no unaligned counterpart - the non-temporal streaming
instructions:

VMOVNTPS, VMOVNTPD, VMOVNTDQ, VMOVNTDQA

However, these instructions will only be generated by the coder with i.e.:
_mm256_stream_si256 / _mm512_stream_si512 / _mm512_stream_pd /
_mm512_stream_ps
or directly with assembler code.

To avoid segfaults one has to fall back on the SSE2 streaming instructions
on Win64

Cheers

Carl


Am Mi., 18. Apr. 2018 um 15:19 Uhr schrieb Liu Hao :

> 在 2018/4/8 21:39, Royi Avital via Mingw-w64-public 写道:
> > Hello,
> > Currently MinGW64 cant generate proper code with AVX / AVX2 on Windows
> 64 Bit due to alignment issues.
> >
> > Is there a plan to fix this significant issue in the near term?
> >
>
> This is a GCC issue:
> 
>
> It is not fixable on the CRT side.
>
> > This issue is a rel problem for anyone generating code with intense
> number crunching which is a usually big motivation for using GCC.
> > I'd guess many scientists will be happy if it is solved.
> >
> > Thank You.
> >
> > Royi
> >
>
>
> --
> Best regards,
> LH_Mouse
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] MinGW64 AVX Code Generation on Windows 64 Bit

2018-04-18 Thread Liu Hao
在 2018/4/8 21:39, Royi Avital via Mingw-w64-public 写道:
> Hello,
> Currently MinGW64 cant generate proper code with AVX / AVX2 on Windows 64 Bit 
> due to alignment issues.
> 
> Is there a plan to fix this significant issue in the near term?
> 

This is a GCC issue:


It is not fixable on the CRT side.

> This issue is a rel problem for anyone generating code with intense number 
> crunching which is a usually big motivation for using GCC.
> I'd guess many scientists will be happy if it is solved.
> 
> Thank You.
> 
> Royi
> 


-- 
Best regards,
LH_Mouse
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] MinGW64 AVX Code Generation on Windows 64 Bit

2018-04-08 Thread Carl Kleffner
Hi,

this question is related to two mingw-w64 bug reports:

(1) "Error: invalid register for .seh_savexmm"
#681 Assembler Error: invalid register for .seh_savexmm when compiling with
avx-512
https://sourceforge.net/p/mingw-w64/bugs/681/
see also:
Bug 65782 - Assembly failure (invalid register for .seh_savexmm) with -O3
-mavx512f on mingw-w64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782

this can potentially be solved by adding the
"-fno-asynchronous-unwind-tables" as requested here:
https://stackoverflow.com/questions/43152633/invalid-register-for-seh-savexmm-in-cygwin

(2) #304 64 bit AVX generated mis-aligned access
https://sourceforge.net/p/mingw-w64/bugs/304/

this can potentially be solved by replacing the 32-bit aligned VMOV
instructions by there unaligned variants as requested here:
https://stackoverflow.com/questions/5983389/how-to-align-stack-at-32-byte-boundary-in-gcc

any ideas how to do this effectively?

Carl


2018-04-08 15:39 GMT+02:00 Royi Avital via Mingw-w64-public <
mingw-w64-public@lists.sourceforge.net>:

> Hello,
> Currently MinGW64 cant generate proper code with AVX / AVX2 on Windows 64
> Bit due to alignment issues.
>
> Is there a plan to fix this significant issue in the near term?
>
> Reference:
>
> 1. Code for Reproduction - https://stackoverflow.com/questions/30926241.
> 2. Previous Discussion - https://sourceforge.net/p/
> mingw-w64/mailman/message/34485783/.
> 3. Comment on the issue snot being Windows' fault -
> https://stackoverflow.com/a/30929086/195787.
> 4. Sleef - Open Source Project which can't offer MinGW comptability due to
> this issue - https://github.com/shibatch/sleef/issues/172#issuecomment-
> 367338219.
>
> This issue is a rel problem for anyone generating code with intense number
> crunching which is a usually big motivation for using GCC.
> I'd guess many scientists will be happy if it is solved.
>
> Thank You.
>
> Royi
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] MinGW64 AVX Code Generation on Windows 64 Bit

2018-04-08 Thread Royi Avital via Mingw-w64-public
Hello,
Currently MinGW64 cant generate proper code with AVX / AVX2 on Windows 64 Bit 
due to alignment issues.

Is there a plan to fix this significant issue in the near term?

Reference:

1. Code for Reproduction - https://stackoverflow.com/questions/30926241.
2. Previous Discussion - 
https://sourceforge.net/p/mingw-w64/mailman/message/34485783/.
3. Comment on the issue snot being Windows' fault - 
https://stackoverflow.com/a/30929086/195787.
4. Sleef - Open Source Project which can't offer MinGW comptability due to this 
issue - https://github.com/shibatch/sleef/issues/172#issuecomment-367338219.

This issue is a rel problem for anyone generating code with intense number 
crunching which is a usually big motivation for using GCC.
I'd guess many scientists will be happy if it is solved.

Thank You.

Royi

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public