Skip to content

feat: parallel softmax via rayon (3x speedup) - #1

Merged
asjad2401 merged 1 commit into
masterfrom
feature/parallel-softmax
May 11, 2026
Merged

feat: parallel softmax via rayon (3x speedup)#1
asjad2401 merged 1 commit into
masterfrom
feature/parallel-softmax

Conversation

@asjad2401

Copy link
Copy Markdown
Owner

What this does

Replaces the sequential lane-by-lane softmax loop with a parallel one
using rayon. Public API is unchanged.

Changes

  • Added rayon = "1" dependency
  • Enabled ndarray's rayon feature flag
  • Softmax now uses .into_iter().par_bridge().for_each() instead of a sequential for loop

Benchmark results (200 runs, AMD x86-64)

Array shape NumPy rustnum Speedup
1000×1000 f64 11.35 ms 3.72 ms 3.05×
32×128×512 f64 26.14 ms 8.12 ms 3.22×

Correctness

Verified against NumPy on 2D and 3D inputs with default and non-default axis.

@asjad2401
asjad2401 merged commit 375b38c into master May 11, 2026
17 checks passed
@asjad2401
asjad2401 deleted the feature/parallel-softmax branch May 11, 2026 07:01
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.

1 participant