Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMD: Support D_SIMD #42

Open
6 of 9 tasks
p0nce opened this issue Jan 30, 2020 · 14 comments
Open
6 of 9 tasks

DMD: Support D_SIMD #42

p0nce opened this issue Jan 30, 2020 · 14 comments

Comments

@p0nce
Copy link
Collaborator

p0nce commented Jan 30, 2020

Enabling core.simd:

  • We can enable core.simd usage with DMD today, without even using D_SIMD, which brings the performance gap of LDC vs DMD from 20x to 4x. DMD binaries that makes heavy usage of intel-intrinsics typically go 5x faster.

Instead of the slow replacements. But does it support float2, int2? (EDIT: no, but we can work around it)

  • D_SIMD and core.simd can be enabled with a constant
  • MMX
  • SSE
  • SSE2 up to line: 1024
  • SSE3
  • SSSE3
  • Wait for DMD 2.096 and test that _mm_movehl_ps generates MOVHLPS with __simd (and not MOVLPS)
  • Wait for DMD 2.096 and test that _mm_movelh_ps generates MOVLHPS with __simd (and not MOVHPS)
@p0nce
Copy link
Collaborator Author

p0nce commented Oct 17, 2020

Also DMD: use core.simd instead of emulation when available.

@p0nce
Copy link
Collaborator Author

p0nce commented Dec 16, 2020

Blocked by #59

@p0nce
Copy link
Collaborator Author

p0nce commented Mar 2, 2021

Each version of DMD bring regressions when SIMD vectors are actually used. It's a maintenance burden.

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 10, 2022

D_SIMD finally enabled in intel-intrinsics v1.9, when DMD 2.099+ is used. Let's see what happens next.

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 10, 2022

8 hours later I was asked to remove it. 4 bugs are kinda blockers for D_SIMD to happen (well, more will be found as translation progress, but also perf will augment).

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 24, 2022

4 more issues fixed by core.
https://forum.dlang.org/post/[email protected]

@p0nce
Copy link
Collaborator Author

p0nce commented May 1, 2022

Enable core.simd and D_SIMD usage in DMD now! It seems like the best time to do it. (mmm, not really)

@p0nce
Copy link
Collaborator Author

p0nce commented May 1, 2022

DMD debug builds now surprisingly useful since, they are at a 5% difference with LDC builds but build faster. Could become both faster to build and more efficient with a bit of effort on intel-intrinsics.

@p0nce
Copy link
Collaborator Author

p0nce commented Aug 27, 2022

Another final attemps at making D_SIMD used by default. Phew.

@p0nce
Copy link
Collaborator Author

p0nce commented Aug 28, 2022

It triggered only one regression, some Linux only bugs, and it seems like this is it? D_SIMD finally activated. (but not for AVX, only SSE)

@p0nce
Copy link
Collaborator Author

p0nce commented Sep 25, 2022

Some critical instructions:

  • _mmcvtps_pd
  • _mm_srli_epi32
  • _mm_hadd_ps

@p0nce
Copy link
Collaborator Author

p0nce commented Sep 25, 2022

Besides, DMD output is wrong vs LDC on a complete plugin such as Lens.

@p0nce
Copy link
Collaborator Author

p0nce commented Dec 25, 2022

Critical for Lens:

  • inlining of _mm_addsub_pd with D_SIMD => didn't work
  • _mm_movelh_ps till buggy with D_SIMD? => no
  • _mm_cvtepi32_ps
    (try within Lens regression testing, it's dangerous)

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 7, 2023

Are we still in the DMD test suite? latest DMD fails in GH Actions => yes we are

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant