simde icon indicating copy to clipboard operation
simde copied to clipboard

porting @Microsoft SPTAG (with native aliases enabled): missing `__mmask32 __mmask64 _mm512_setzero_ps _mm512_cvtepi32_ps _mm512_extractf32x8_ps _mm512_cmpgt_epi16_mask`

Open pabs3 opened this issue 1 year ago • 2 comments

While porting @Microsoft SPTAG to use SIMDe (with native aliases enabled), I found that there are several missing functions/definitions. As suggested in the README.md I am reporting them here for prioritisation. There are some missing native aliases and missing variants of existing functions:

  • simde_ variants defined but not native aliases: __mmask32 __mmask64 _mm512_setzero_ps
  • _mm512_cvtepi32_ps: missing but _mm512_cvtepu32_ps exists
  • _mm512_extractf32x8_ps: missing but _mm512_extractf32x4_ps exists
  • _mm512_cmpgt_epi16_mask: missing but _mm512_cmpgt_epi8_mask exists

I need the native aliases because @Microsoft requires signing a CLA, so I won't be submitting a pull request, so I want my patch to be relatively compatible with any changes that are made upstream to the intrinsics.

pabs3 avatar Jul 12 '22 07:07 pabs3

Hi we need it for debian side packaging...

bastien-roucaries avatar Sep 05 '22 07:09 bastien-roucaries

Thanks for the report. There is a guide to adding new instructions at https://github.com/simd-everywhere/simde/wiki/Implementing-a-New-Function

mr-c avatar Sep 05 '22 09:09 mr-c

Update: _mm512_setzero_ps now exists since commit c900d5e195c4692e0f6b1c3ad8e18e577cf55e11

pabs3 avatar Feb 05 '23 03:02 pabs3

ping ?

bastien-roucaries avatar Mar 20 '23 15:03 bastien-roucaries

Hello @bastien-roucaries There is a guide to adding new instructions at https://github.com/simd-everywhere/simde/wiki/Implementing-a-New-Function

Please let me know if you want assistance with working on this issue, I would be happy to help!

mr-c avatar Mar 20 '23 18:03 mr-c

@pabs3 Did you see that simde__mmask32, simde__mmask64, and simde_mm512_setzero_ps are implemented?

mr-c avatar Apr 29 '23 07:04 mr-c

@mr-c this issue isn't fully completed because the native aliases __mmask32 and __mmask64 don't exist. I note that the __mmask8 and __mmask16 native aliases do exist though.

Thanks for implementing _mm512_cvtepi32_ps, _mm512_extractf32x8_ps, _mm512_cmpgt_epi16_mask in commit bf1fbae and thanks to @EleonoreMizo for adding _mm512_setzero_ps in commit c900d5e.

pabs3 avatar Apr 29 '23 11:04 pabs3

@mr-c this issue isn't fully completed because the native aliases __mmask32 and __mmask64 don't exist. I note that the __mmask8 and __mmask16 native aliases do exist though.

Whoops I misunderstood. Did you see the note about those types in https://github.com/simd-everywhere/simde/blob/8b4e375340e7c9f898c884cd1b09ecfb946a6d76/simde/x86/avx512/types.h#L501-L514

If there is a specific compiler version / architecture combination that you are using, and for which you need the native types defined, I think that would be straightforward to add

mr-c avatar Apr 29 '23 14:04 mr-c

I did see that note, it sounds complicated.

When I was testing this I was on Debian bookworm amd64 with GCC 12. My intention was to enable porting SPTAG from amd64 to all of the Debian architectures, probably starting with arm64. Since bookworm is in the freeze, this will likely be something for trixie.

In that situation #define __mmask32 simde__mmask32 was enough to workaround __mmask32 being missing. Likewise for __mmask64. See the link to the SPTAG patch above.

PS: since you are the Debian maintainer of simde too, an upload to Debian experimental would be appreciated so I can work on this further.

pabs3 avatar Apr 29 '23 23:04 pabs3

Sure, I can upload https://github.com/simd-everywhere/simde/releases/tag/v0.7.4-rc3 to Debian experimental, but it won't have all of the new functions you need; however you could copy them from https://github.com/simd-everywhere/simde/commit/bf1fbae1d28ad88e958b80075f2175d4f30e6c55

mr-c avatar Apr 30 '23 07:04 mr-c

Maybe wait until that commit has entered a release candidate.

pabs3 avatar May 01 '23 02:05 pabs3

@pabs3 done: https://tracker.debian.org/news/1430405/accepted-simde-074rc4-0exp-source-into-experimental/

mr-c avatar May 04 '23 05:05 mr-c

This bug should still be open because of the native aliases for __mmask32 and __mmask64 are probably still missing?

Thanks for the upload though, I'll be able to work on SPTAG now by adding some defines for __mmask32 and __mmask64.

-- bye, pabs

https://bonedaddy.net/pabs3/

pabs3 avatar May 04 '23 06:05 pabs3

@pabs3 I'm testing https://github.com/simd-everywhere/simde/commit/d850b8399ee8c592d454948e48f966eeb8a31c7b to provide __mask32 and __mask64 now

mr-c avatar May 04 '23 12:05 mr-c

@pabs3 https://github.com/simd-everywhere/simde/commit/d850b8399ee8c592d454948e48f966eeb8a31c7b has been merged! It'll be in the next rc snapshot (perhaps that will be the real release of 0.7.4 ??)

mr-c avatar May 04 '23 16:05 mr-c

Excellent, thanks!

@mr-c BTW, I noticed on the staging branch you added @Pabs as a bug/code contributor but I can't find any contributions from them.

If you meant to attribute me, my GitHub account is @pabs3 and I did not contribute any patches to SIMDe so the entry should read bugs only.

-- bye, pabs

https://bonedaddy.net/pabs3/

pabs3 avatar May 05 '23 00:05 pabs3

@pabs3 whoops, that was my mistake; I've queued up a fix

mr-c avatar May 05 '23 05:05 mr-c