avx512

AVX-512 and Branching

核能气质少年 提交于 2019-11-30 15:12:38
问题 I'm confused as to what masking can do in theory in relation to branches. Let's say I have a Skylake-SP (ha, I wish..), and we're ignoring compiler capabilities, just what's possible in theory: If a branch conditional is dependant on a static flag, and all branches set an array to a computational result, assuming the compiler does not optimize this to two separate loops anyways , can it vectorize? do i = 1, nx if (my_flag .eq. 0) then a(i) = b(i) ** 2 else a(i) = b(i) ** 3 end if end do If

AVX-512 and Branching

风流意气都作罢 提交于 2019-11-30 14:19:47
I'm confused as to what masking can do in theory in relation to branches. Let's say I have a Skylake-SP (ha, I wish..), and we're ignoring compiler capabilities, just what's possible in theory: If a branch conditional is dependant on a static flag, and all branches set an array to a computational result, assuming the compiler does not optimize this to two separate loops anyways , can it vectorize? do i = 1, nx if (my_flag .eq. 0) then a(i) = b(i) ** 2 else a(i) = b(i) ** 3 end if end do If only as subset of the branches are setting the value in question, can it vectorize? do i = 1, nx if (my

How do the Conflict Detection instructions make it easier to vectorize loops?

喜欢而已 提交于 2019-11-30 11:47:53
The AVX512CD instruction families are: VPCONFLICT, VPLZCNT and VPBROADCASTM. The Wikipedia section about these instruction says: The instructions in AVX-512 conflict detection (AVX-512CD) are designed to help efficiently calculate conflict-free subsets of elements in loops that normally could not be safely vectorized. What are some examples that show these instruction being useful in vectorizing loops? It would be helpful if answers will include scalar loops and their vectorized counterparts. Thanks! One example where the CD instructions might be useful is histogramming. For scalar code

How to detect SSE/SSE2/AVX/AVX2/AVX-512/AVX-128-FMA/KCVI availability at compile-time?

旧街凉风 提交于 2019-11-29 19:40:28
I'm trying to optimize some matrix computations and I was wondering if it was possible to detect at compile-time if SSE/SSE2/AVX/AVX2/AVX-512/AVX-128-FMA/KCVI [1] is enabled by the compiler ? Ideally for GCC and Clang, but I can manage with only one of them. I'm not sure it is possible and perhaps I will use my own macro, but I'd prefer detecting it rather and asking the user to select it. [1] "KCVI" stands for Knights Corner Vector Instruction optimizations. Libraries like FFTW detect/utilize these newer instruction optimizations. Paul R Most compilers will automatically define: __SSE__ _

How do the Conflict Detection instructions make it easier to vectorize loops?

梦想的初衷 提交于 2019-11-29 17:43:13
问题 The AVX512CD instruction families are: VPCONFLICT, VPLZCNT and VPBROADCASTM. The Wikipedia section about these instruction says: The instructions in AVX-512 conflict detection (AVX-512CD) are designed to help efficiently calculate conflict-free subsets of elements in loops that normally could not be safely vectorized. What are some examples that show these instruction being useful in vectorizing loops? It would be helpful if answers will include scalar loops and their vectorized counterparts.

Embedded broadcasts with intrinsics and assembly

谁说胖子不能爱 提交于 2019-11-29 14:40:14
In section 2.5.3 "Broadcasts" of the Intel Architecture Instruction Set Extensions Programming Reference the we learn than AVX512 (and Knights Corner) has a bit-field to encode data broadcast for some load-op instructions, i.e. instructions that load data from memory and perform some computational or data movement operation. For example using Intel assembly syntax we can broadcast the scalar at the address stored in rax and then multiplying with the 16 floats in zmm2 and write the result to zmm1 like this vmulps zmm1, zmm2, [rax] {1to16} However, there are no intrinsics which can do this.

Missing AVX-512 intrinsics for masks?

非 Y 不嫁゛ 提交于 2019-11-29 10:42:38
Intel's intrinsics guide lists a number of intrinsics for the AVX-512 K* mask instructions, but there seem to be a few missing: KSHIFT{L/R} KADD KTEST The Intel developer manual claims that intrinsics are not necessary as they are auto generated by the compiler. How does one do this though? If it means that __mmask* types can be treated as regular integers, it would make a lot of sense, but testing something like mask << 4 seems to cause the compiler to move the mask to a regular register, shift it, then move back to a mask. This was tested using Godbolt 's latest GCC and ICC with -O2

How to transpose a 16x16 matrix using SIMD instructions?

偶尔善良 提交于 2019-11-28 23:29:32
I'm currently writing some code targeting Intel's forthcoming AVX-512 SIMD instructions, which supports 512-bit operations. Now assuming there's a matrix represented by 16 SIMD registers, each holding 16 32-bit integers (corresponds to a row), how can I transpose the matrix with purely SIMD instructions? There're already solutions to transposing 4x4 or 8x8 matrices with SSE and AVX2 respectively. But I couldn't figure out how to extend it to 16x16 with AVX-512. Any ideas? Z boson For two operand instructions using SIMD you can show that the number of operations necessary to transpose a nxn

Do 128bit cross lane operations in AVX512 give better performance?

本秂侑毒 提交于 2019-11-28 09:24:58
In designing forward looking algorithms for AVX256, AVX512 and one day AVX1024 and considering the potential implementation complexity/cost of fully generic permutes for large SIMD width I wondered if it is better to generally keep to isolated 128bit operations even within AVX512? Especially given that AVX had 128bit units to execute 256bit operations. To that end I wanted to know if there was a performance difference between AVX512 permute type operations across all of the 512bit vector as opposed to permute type operations within each 4x128bit sub-vectors of a 512bit vector? Generally yes,

Embedded broadcasts with intrinsics and assembly

我的梦境 提交于 2019-11-28 07:58:24
问题 In section 2.5.3 "Broadcasts" of the Intel Architecture Instruction Set Extensions Programming Reference the we learn than AVX512 (and Knights Corner) has a bit-field to encode data broadcast for some load-op instructions, i.e. instructions that load data from memory and perform some computational or data movement operation. For example using Intel assembly syntax we can broadcast the scalar at the address stored in rax and then multiplying with the 16 floats in zmm2 and write the result to