mirror of
https://github.com/luxfi/accel.git
synced 2026-07-27 03:39:23 +00:00
fix(nocgo): validate LatticeNTTMLDSABatch shape before no-backend return
The !cgo path returned ErrNotSupported for any input, but the cgo path (and TestNoopBehavior) require shape validation first: a wrong-length poly must be ErrShapeMismatch regardless of build. This was failing the 'Test without CGO (fallback)' CI job (pre-existing, since the op was implemented). Now CGO=0 and CGO=1 agree. Co-authored-by: Hanzo Dev <dev@hanzo.ai> EOF
This commit is contained in:
+13
-1
@@ -97,6 +97,18 @@ func MLDSASignBatch(_ int, _, _ [][]byte, _ int) ([][]byte, error) {
|
||||
}
|
||||
|
||||
// LatticeNTTMLDSABatch returns ErrNotSupported in non-CGO builds.
|
||||
func LatticeNTTMLDSABatch(_ [][]int32, _ bool) error {
|
||||
func LatticeNTTMLDSABatch(polys [][]int32, _ bool) error {
|
||||
// Validate the batch shape before the (absent) GPU dispatch decision,
|
||||
// matching the cgo path so callers get the same error regardless of
|
||||
// build: a wrong-length poly is ErrShapeMismatch, empty is
|
||||
// ErrBatchSizeMismatch; otherwise no backend → ErrNotSupported.
|
||||
if len(polys) == 0 {
|
||||
return ErrBatchSizeMismatch
|
||||
}
|
||||
for _, p := range polys {
|
||||
if len(p) != MLDSANTTPolyLen {
|
||||
return ErrShapeMismatch
|
||||
}
|
||||
}
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user