mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
ONE matching path: BackendGo (CPU). The pretend-acceleration cruft
is gone.
Removed (archive/lp108-2026-05-04/):
* pkg/engine/mlx_engine.go — claimed MLX-accelerated processing.
Real body was time.Sleep simulating GPU work + a hardcoded
597 ns/order constant. No Metal Performance Shaders, no MLX
device, no kernel.
* pkg/engine/mlx_engine_test.go — tested the stub.
* pkg/lx/fpga_accelerator.go — 484 LoC FPGA "accelerator". No
bitstream, no driver, interface-only.
* pkg/lx/fpga_accelerator_test.go — tested the stub itself
("DisabledFPGA returns error").
* pkg/fpga/* — 8 files, ~3K LoC of FPGA interfaces (amd_versal,
aws_f2, fpga_engine, fpga_interface, types, stubs + tests).
Interface-only. No hardware path.
Surgical edits to keep the rest of the test surface compiling:
* pkg/lx/orderbook.go::detectBestBackend — collapsed. Used to set
currentBackend to BackendGo/CGO/MLX/CUDA based on env probes;
nothing branched on the enum so the matching engine ran the Go
path regardless. Now: const Backend = BackendGo only. Removed
unused "os" + "runtime" imports.
* pkg/lx/critical_path_bench_test.go::BenchmarkFPGAAcceleration —
removed (called NewFPGAAccelerator).
* pkg/lx/coverage_improvement_test.go::TestFPGAAccelerator* —
removed (3 tests calling NewFPGAAccelerator).
* test/benchmark/orderbook_bench_test.go::BenchmarkMLXEngine —
removed. Called the standard CPU OrderBook then reported
b.ReportMetric(597, "ns/order") as a hardcoded literal.
* test/benchmark/orderbook_bench_test.go::BenchmarkPlanetScale —
removed. Entirely fabricated metrics (markets=5M, orders/sec=150M,
ns/order=597, watts=370, orders/watt=405405). No code in the
repo measured any of those.
What's left:
* BenchmarkOrderBook — real CPU path measurement
* BenchmarkOrderBookParallel — real CPU path measurement
* All match logic, order types, vault/margin/clearinghouse, etc.
Real measured numbers for the matching engine come from
luxcpp/dex/build/luxdex_bench (5.51 M orders/sec single-symbol on
Apple M1 Max). Anything labeled "GPU" or "FPGA" in benchmark
output of this repo is now removed because it didn't measure
GPU or FPGA work.
Verification on M1 Max:
* GOWORK=off go build ./pkg/lx/... ./test/benchmark/... — clean
* GOWORK=off go test -run='TestOrderBook$|TestNewOrderBook' ./pkg/lx/ — PASS
When real GPU/FPGA matching ships: add the variants back AND wire
through the match path AND a parity test vs BackendGo AND a
reproducible benchmark. LP-108 production gate applies.