Skip to content

Enable SymSgdNative on arm64 via system BLAS#7609

Open
anicka-net wants to merge 1 commit intodotnet:mainfrom
anicka-net:arm64-symsGd-openblas
Open

Enable SymSgdNative on arm64 via system BLAS#7609
anicka-net wants to merge 1 commit intodotnet:mainfrom
anicka-net:arm64-symsGd-openblas

Conversation

@anicka-net
Copy link
Copy Markdown

Summary

Resolves the TODO in src/Native/CMakeLists.txt and provides the four MKL method substitutes requested in #5798, enabling SymbolicSgdLogisticRegression on ARM platforms.

  • New MklImportsArm target — builds a libMklImports.so backed by the system BLAS (via find_package(BLAS)) for ARM, replacing the Intel MKL redistribution which is x86-only
  • Portable sparse BLAS — implements cblas_saxpyi and cblas_sdoti (MKL extensions not in standard CBLAS/OpenBLAS) as straightforward C loops
  • DFTI stubs — stubs the MKL FFT functions referenced by the managed Microsoft.ML.Mkl.Components initializer but unused by SymSGD; stubs return error codes so any actual FFT call fails cleanly
  • __cdecl fix — guards the Windows-only calling convention in SparseBLAS.h behind #ifdef _WIN32

Changes

File Change
src/Native/CMakeLists.txt Build MklImportsArm + SymSgdNative on ARM (instead of skipping both)
src/Native/MklImportsArm/CMakeLists.txt New — builds libMklImports.so from system BLAS
src/Native/MklImportsArm/MklImportsArm.c New — sparse BLAS implementations + FFT stubs (57 lines)
src/Native/SymSgdNative/CMakeLists.txt On ARM: link CMake MklImports target instead of find_library
src/Native/SymSgdNative/SparseBLAS.h Guard __cdecl for Windows only

Test plan

  • CMake build succeeds on aarch64 (Ubuntu 24.04, GCC 13, OpenBLAS 0.3.26)
  • SymbolicSgdLogisticRegression trains and predicts correctly on arm64
  • Binary classification accuracy, AUC, init predictor handoff verified
  • CreatePredictionEngine works end-to-end
  • Existing [NativeDependencyFact("MklImports")] tests in SymSgdClassificationTests.cs pass on arm64

Tested on NVIDIA DGX Spark (Grace ARM CPU, Ubuntu 24.04, .NET 10.0.107).

Related issues

Provide an ARM-native libMklImports.so backed by the system BLAS
(via CMake find_package(BLAS)), with portable implementations of the
two MKL-specific sparse BLAS extensions (cblas_saxpyi, cblas_sdoti)
and stubs for DFTI (FFT) functions referenced by the managed
initializer but unused by SymSGD.

Fixes dotnet#5798

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anicka-net
Copy link
Copy Markdown
Author

@dotnet-policy-service agree company="Microsoft"

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.59%. Comparing base (4c8b357) to head (87e01f8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7609   +/-   ##
=======================================
  Coverage   69.59%   69.59%           
=======================================
  Files        1484     1484           
  Lines      273606   273606           
  Branches    27949    27949           
=======================================
+ Hits       190408   190425   +17     
+ Misses      75836    75817   -19     
- Partials     7362     7364    +2     
Flag Coverage Δ
Debug 69.59% <ø> (+<0.01%) ⬆️
production 63.85% <ø> (+<0.01%) ⬆️
test 89.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add substitutes for 4 IntelMKL methods so SymSgd can be added to non x86/x64 builds

1 participant