Files
zeekay c6128b6122 quasar: route corona R-LWE through lattice GPU NTT dispatch
Add UseCoronaGPUAccelerator / DisableCoronaGPUAccelerator helpers
that flip the corona/gpu global flag. The flag arms the
lattice/ring.SetGPUDispatchers hook installed by lattice/gpu under
`cgo && gpu` build tags; non-GPU builds keep the existing CPU path.

Decomplecting note. Boot wiring stays on the consensus side
(operators decide whether to engage GPU NTT at startup); the actual
lattice ↔ corona ↔ GPU plumbing lives in corona/gpu and lattice/gpu.
Quasar is a thin facade over a single corona/gpu.UseAccelerator()
call.

corona pin bumped to v0.7.2 (in-tree replace pending CI proxy pickup,
matching the pattern documented in CROSS-REPO-VERSION-PIN.md).

Tests pass under CGO_ENABLED=0 and CGO_ENABLED=1 -tags gpu, including
the existing TestDualSigningFlow (Pulsar 2-round protocol) and new
TestUseCoronaGPUAccelerator / TestCoronaGPUBackendNonEmpty.
2026-05-21 13:41:56 -07:00

39 lines
1.2 KiB
Go

// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package quasar
import (
"testing"
)
// TestUseCoronaGPUAccelerator — the consensus-level wrapper flips the
// corona/gpu global flag and the disable helper clears it. Both
// branches survive on every supported build.
func TestUseCoronaGPUAccelerator(t *testing.T) {
t.Cleanup(DisableCoronaGPUAccelerator)
if CoronaGPUAcceleratorEnabled() {
t.Fatal("baseline: CoronaGPUAcceleratorEnabled() should be false")
}
if err := UseCoronaGPUAccelerator(); err != nil {
t.Fatalf("UseCoronaGPUAccelerator: %v", err)
}
if !CoronaGPUAcceleratorEnabled() {
t.Fatal("flag did not flip after UseCoronaGPUAccelerator")
}
DisableCoronaGPUAccelerator()
if CoronaGPUAcceleratorEnabled() {
t.Fatal("flag did not clear after DisableCoronaGPUAccelerator")
}
}
// TestCoronaGPUBackendNonEmpty — backend descriptor is always populated
// (lattice/gpu returns "CPU (pure Go)" on no-cgo builds, "Metal" /
// "CUDA" on -tags gpu builds with the library linked).
func TestCoronaGPUBackendNonEmpty(t *testing.T) {
if got := CoronaGPUBackend(); got == "" {
t.Fatal("CoronaGPUBackend() returned empty string")
}
}