Skip to content

Commit 53e988f

Browse files
committed
Add 3DGS EWA SYRK BLAS MKL cross-pollination plan
1 parent 3069b2e commit 53e988f

1 file changed

Lines changed: 183 additions & 0 deletions

File tree

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# 3DGS EWA/SYRK/BLAS/MKL Cross-Pollination Plan — ndarray
2+
3+
## Goal
4+
5+
Fold the older PR-X12 BLAS/GEMM lens into the new 3DGS plan family.
6+
7+
The new 3DGS plans should not rediscover this line:
8+
9+
```text
10+
EWA sandwich
11+
-> batched SYRK / GEMM form
12+
-> backend dispatch: native / Intel MKL / OpenBLAS / AMX where available
13+
-> shared Basis<T> / LinearReduce<T> substrate
14+
```
15+
16+
## Existing canon to preserve
17+
18+
Prior architecture docs already identify a high-value Plan C:
19+
20+
```text
21+
Plan C — EWA SYRK-batched
22+
Replace per-Gaussian sandwich loop with batched cblas_ssyrk.
23+
Add backend dispatch: native / intel-mkl / openblas.
24+
Target file: src/hpc/splat3d/spd3.rs plus backend wiring.
25+
```
26+
27+
This plan promotes that into the 3DGS roadmap.
28+
29+
## Kernel identity
30+
31+
The 3DGS projection core contains this sandwich:
32+
33+
```text
34+
Sigma_image = J * W * Sigma * W^T * J^T
35+
```
36+
37+
For many Gaussians, this is not only a per-splat loop. It can be batched:
38+
39+
```text
40+
for each Gaussian block:
41+
M = J * W
42+
Sigma_image = M * Sigma * M^T
43+
```
44+
45+
Batched form:
46+
47+
```text
48+
many small SPD sandwiches
49+
->
50+
SYRK / GEMM-like backend
51+
->
52+
SIMD / MKL / OpenBLAS / AMX dispatch
53+
```
54+
55+
## Why this matters
56+
57+
The current CPU-SIMD path is valuable, but the older canon found a deeper win:
58+
59+
```text
60+
3DGS projection is a BLAS workload in disguise.
61+
```
62+
63+
The renderer should expose two tiers:
64+
65+
```text
66+
small / scalar-ish batches:
67+
native SIMD path
68+
69+
large / stable batches:
70+
BLAS backend path: SYRK / GEMM
71+
```
72+
73+
## Proposed module layout
74+
75+
```text
76+
src/hpc/splat3d/
77+
spd3.rs
78+
projection.rs
79+
batch_sandwich.rs
80+
backend.rs
81+
82+
src/hpc/splat3d/backend/
83+
native.rs
84+
mkl.rs
85+
openblas.rs
86+
amx.rs
87+
```
88+
89+
If the project prefers existing backend namespaces, adapt to that instead of inventing a second backend tree.
90+
91+
## API sketch
92+
93+
```rust
94+
pub enum Splat3dBackend {
95+
NativeSimd,
96+
IntelMkl,
97+
OpenBlas,
98+
AmxBf16,
99+
}
100+
101+
pub struct SandwichBatchConfig {
102+
pub backend: Splat3dBackend,
103+
pub min_batch_for_blas: usize,
104+
pub allow_bf16: bool,
105+
pub require_deterministic: bool,
106+
}
107+
108+
pub fn sandwich_batch_spd3(
109+
transforms: &[Mat3x3<f32>],
110+
sigmas: &[Spd3],
111+
out: &mut [Spd2],
112+
config: &SandwichBatchConfig,
113+
) -> Splat3dBatchReport;
114+
```
115+
116+
## Backend dispatch rules
117+
118+
```text
119+
NativeSimd:
120+
always available
121+
deterministic reference path
122+
best for small batches
123+
124+
IntelMkl:
125+
feature-gated
126+
best for large stable batches
127+
must have numerical tolerance tests against NativeSimd
128+
129+
OpenBlas:
130+
feature-gated
131+
portability backend
132+
tolerance may differ by platform
133+
134+
AmxBf16:
135+
experimental / certified path only
136+
requires pillar probe before becoming default
137+
```
138+
139+
## Interaction with 4x4 carrier
140+
141+
The 4x4 carrier plan remains compatible:
142+
143+
```text
144+
Mat4 world/camera transform
145+
->
146+
extract spatial W / J path
147+
->
148+
3x3 SPD sandwich remains authoritative
149+
->
150+
optional 4x4 metadata/cognitive lane survives alongside
151+
```
152+
153+
Do not replace 3x3 SPD covariance with 4x4 unless the extra lane has a formally defined meaning.
154+
155+
## Certification hooks
156+
157+
Add benchmark and proof links:
158+
159+
```text
160+
Pillar-7 / EWA Sandwich 3D:
161+
PSD preservation
162+
concentration / CV tightness
163+
164+
New backend parity test:
165+
NativeSimd vs MKL/OpenBLAS/AMX within tolerance
166+
167+
New performance test:
168+
small-batch native wins
169+
large-batch BLAS wins
170+
```
171+
172+
## Acceptance criteria
173+
174+
- Native SIMD remains the scalar-compatible reference.
175+
- BLAS backend results match reference within declared tolerance.
176+
- Backend selection is explicit and testable.
177+
- No hard dependency on MKL in default build.
178+
- Large-batch benchmark demonstrates why the BLAS path exists.
179+
- 4x4 carrier plan can call the same backend without breaking 3x3 covariance invariants.
180+
181+
## Cross-repo link
182+
183+
`lance-graph` owns SplatShaderBlas / BLASGraph orchestration and tile/block scheduling. `ndarray` owns this numerical kernel surface.

0 commit comments

Comments
 (0)