Skip to content

Backend#36

Open
dimortix wants to merge 3 commits intomainfrom
backend
Open

Backend#36
dimortix wants to merge 3 commits intomainfrom
backend

Conversation

@dimortix
Copy link
Collaborator

Added Float32/Float64 support via dtype.go with SetDefaultDType to switch the default data type globally. Implemented cache-blocked MatMul v2 with block sizes 32/64 (mc=64, kc=128) and a 4x4 microkernel - at least 40% faster on 1024x1024 matrices. Added ParallelFor scheduler that scales with GOMAXPROCS and passes -race tests. Added workspace pool for matmulV2 to reduce allocations. Created pkg/tensor/ops package with Max, Sub, Div functions for autograd compatibility. Added tests for dtype, matmul v2, and scheduler.
Fixed blas_nocgo.go to have real BLAS implementations instead of stubs, with Float32 support and proper error handling. Fixed Float32 support in MatMulTransposeB and MatMulTransposeA. Removed Forward method from the Operation interface in graph/node.go, keeping only Backward. Fixed CallbackList pointer dereference in train/config.go. Fixed benchmark panic caused by out-of-bounds access in matmulV2, gebp, and microKernel4x4 by adding proper bounds guards on numChunks and slots.

Dimortix and others added 3 commits February 25, 2026 13:21
…benchmark panic fix

- Float32: SetDefaultDType, dtype.go, matmulV2Float32, ops Float32 support
- Scheduler: ParallelFor scales with GOMAXPROCS, tests with -race
- MatMul v2: block sizes 32/64, mc=64 kc=128, ≥40% faster on 1024×1024
- Workspace pool for matmulV2, reduced alloc/op
- Guards in matmulV2/gebp/microKernel4x4, numChunks vs slots, avoid panic
- BLAS nocgo: real impls, Float32, error handling; Transpose Float32 in matmul

Co-authored-by: Cursor <cursoragent@cursor.com>
@dimortix dimortix requested a review from Hirogava March 6, 2026 22:25
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