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

CPU Feature Detection 2 #281

Merged

Conversation

martindevans
Copy link
Member

@martindevans martindevans commented Nov 13, 2023

The new CUDA autodetection and NativeLibraryConfig lost one major feature of the previous loading system that it replaced - automatic detection of AVX levels. Reintroduced that by probing support in the NativeLibraryConfig constructor.

I also added in support for AVX512 even on dotnet versions that don't support it! Autodetection won't detect AVX512 except on dotnet 8.0, but you can manually specify it yourself by calling WithAvx(AvxLevel.Avx512).

A few other minor changes to the NativeLibraryConfig system while I was there:

  • Renamed NativeLibraryConfig.Default to NativeLibraryConfig.Instance. I don't think Default makes sense since it's mutable (so it's not the default after you've changed it)!
  • using Lazy<T> to initialize it automatically, just a little cleaner than doing it with a lock but basically the same thing.
  • Some spelling and grammar fixes in docs.

Regression

I noticed that there's probably a (minor, ish) regression in the current 0.8.0 release for CPU only inference. Previously the default libllama.dll required AVX2 support, now the system uses no SIMD at all for the default version. That makes sense, we get wider support for older platforms. However 0.8.0 didn't ship any of the more advanced binaries for CPU, so this is probably a big slowdown for pure CPU inference!

@AsakusaRinne can we aim to get a 0.8.1 patch out next weekend with all of the various SIMD binaries for Windows and Linux? I can get started on a PR for that tomorrow if so :)

…nce`. It's not default any more as soon as you call `WithX`!

 - using `Lazy<T>` to initialize it automatically.
 - Added in `AVX512` support for all dotnet versions (but not autodetected).
 - Added in AVX version auto detection.
@AsakusaRinne
Copy link
Collaborator

@AsakusaRinne can we aim to get a 0.8.1 patch out next weekend with all of the various SIMD binaries for Windows and Linux? I can get started on a PR for that tomorrow if so :)

Yes, I think it's a good idea. 😄

For the regression you mentioned, I think there's probably no regression compared to 0.7.0 because the libllama in NuGet package is still the one with avx2. However, yes, it will be a problem for users with netstandard2.0 if we split libraries into different avx levels.

@martindevans martindevans merged commit b44e780 into SciSharp:master Nov 13, 2023
5 checks passed
@martindevans martindevans deleted the NativeLibraryConfig_improvements branch November 13, 2023 23:26
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