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

SIMD for Silk.NET.Math #2 #670

Merged
merged 36 commits into from
Nov 10, 2021

Conversation

WhiteBlackGoose
Copy link
Contributor

@WhiteBlackGoose WhiteBlackGoose commented Nov 5, 2021

Summary of the PR

Keep working on #666

Tasks

  • Equal
  • NotEqual
  • GreaterThan
  • GreaterThanOrEqual
  • LessThan
  • LessThanOrEqual
  • Min
  • Max

Benchmarks

For all bitnesses x for all types

  • GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual
  • 4 arithmetic operators
  • Min, Max
  • Equal, NotEqual

Tests

For all bitnesses x for all types

  • 4 arithmetic operators
  • Less/Greater Than (OrEqual)
  • Min, Max
  • (Not)Equal
  • Bitwise
  • Abs

Other

  • Use naive operations for 8-byte values on simd64

What is NOT done

long and ulong are not supported by majority of methods (added to TODO of #666)

*OrEqual don't support most types (so I replaced it with Not(...Than for types that aren't supported) done in the best way

128-bit fallbacks when 256-bit is not supported done where appropriate

@WhiteBlackGoose
Copy link
Contributor Author

Codegen for 128-bit fallback for float versus going over elements: sharplab

@WhiteBlackGoose
Copy link
Contributor Author

Good news: despite the visual overhead, LessThan, GreaterThan, LessThanOrEqual and GreaterThanOrEqual generate good codegens (only differing by the instruction itself) for float for .net 5.

@WhiteBlackGoose WhiteBlackGoose marked this pull request as ready for review November 6, 2021 15:53
@WhiteBlackGoose WhiteBlackGoose marked this pull request as draft November 6, 2021 16:18
@WhiteBlackGoose WhiteBlackGoose marked this pull request as ready for review November 6, 2021 16:25
Copy link
Member

@HurricanKai HurricanKai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the add trick is wrong everywhere?

@WhiteBlackGoose WhiteBlackGoose marked this pull request as draft November 7, 2021 09:01
@WhiteBlackGoose WhiteBlackGoose marked this pull request as ready for review November 7, 2021 12:54
@HurricanKai HurricanKai merged commit 26eb04e into dotnet:feature/math-simd Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants