deps: bump accel v1.1.2 → v1.1.4, drop MLX_ROOT, use auto-discovery

accel v1.1.4 auto-discovers the lux-gpu substrate (libluxgpu_hqc.a +
lux/gpu/hqc.h) by probing every standard install prefix via cgo
#cgo CFLAGS/LDFLAGS directives. The build resolves whichever prefix
has the artefacts (pkg-config, /opt/homebrew, /usr/local, /opt/lux,
in-tree mlx/ sibling) without any env var or Makefile wiring.

Makefile:
  - drop the MLX_ROOT requirement
  - default `make build` works with NO env vars set
  - optional LUX_GPU_PREFIX override remains for non-standard installs
  - rename print-env diagnostic to show LUX_GPU_PREFIX

CI:
  - run `cmake --install build` so lux-gpu lands on the standard
    pkg-config path
  - verify discovery via `pkg-config --modversion lux-gpu`
  - drop the manual CGO_CFLAGS / CGO_LDFLAGS export
  - drop MLX_ROOT references everywhere

go.mod:
  - bump luxfi/accel v1.1.2 → v1.1.4
  - remove the local replace directive (development-only, not for
    release)
This commit is contained in:
Hanzo AI
2026-05-21 17:34:28 -07:00
parent fecb0ade9b
commit 867ab049b1
4 changed files with 59 additions and 37 deletions
+22 -9
View File
@@ -2,10 +2,14 @@ name: CI
# Go build/test for the precompile suite.
#
# luxfi/accel v1.1.2+ requires the mlx C ABI headers + libluxgpu_hqc.a
# on the CGO include/link paths. CI checks out luxfi/mlx alongside,
# builds it once, and exports CGO_CFLAGS / CGO_LDFLAGS into go via the
# Makefile (see ../../Makefile MLX_ROOT).
# luxfi/accel v1.1.3+ auto-discovers the lux-gpu substrate (header +
# libluxgpu_hqc.a) by probing every standard install prefix. CI:
# 1. Checks out luxfi/mlx as a sibling repo
# 2. Builds it once (CPU-only — no GPU device required on the runner)
# 3. Installs it to /usr/local (cmake --install build)
# 4. Runs the Go build/test/vet — no CGO_CFLAGS / CGO_LDFLAGS needed
#
# Setting MLX_ROOT or LUX_GPU_PREFIX is no longer required.
on:
push:
@@ -39,23 +43,32 @@ jobs:
path: ../mlx
ref: main
- name: Build libluxgpu_hqc.a (CPU only, no GPU device required)
- name: Build + install lux-gpu (CPU-only, no GPU device required)
working-directory: ../mlx
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DLUX_GPU_BUILD_CUDA=OFF \
-DLUX_GPU_BUILD_METAL=OFF
cmake --build build --target luxgpu_hqc --parallel
cmake --build build --target luxgpu_hqc luxgpu_core_static --parallel
sudo cmake --install build
pkg-config --modversion lux-gpu
pkg-config --cflags --libs lux-gpu
- name: Show resolved GPU paths
run: |
go run -mod=mod ./... -h 2>/dev/null || true
go test -run TestPathReport_LogsResolved -v github.com/luxfi/accel || true
- name: Build
run: make build MLX_ROOT=$GITHUB_WORKSPACE/../mlx
run: make build
- name: Test (short)
run: make test MLX_ROOT=$GITHUB_WORKSPACE/../mlx
run: make test
- name: Vet
run: make vet MLX_ROOT=$GITHUB_WORKSPACE/../mlx
run: make vet
govulncheck:
name: govulncheck
+34 -21
View File
@@ -1,24 +1,36 @@
# Lux precompile build wiring.
#
# accel v1.1.2 introduced the ops/code package (HQC code-based KEM)
# which is a CGO bridge to libluxgpu_hqc.a built by the sibling mlx
# repo. accel's default `#cgo CFLAGS: -I${SRCDIR}/../../../mlx/include`
# resolves against the accel module path, which inside the Go module
# cache does NOT have a sibling mlx/ directory. Consumers therefore
# MUST set CGO_CFLAGS / CGO_LDFLAGS explicitly to point at a built
# mlx tree.
# accel v1.1.3+ auto-discovers the lux-gpu substrate (libluxgpu_hqc.a
# + lux/gpu/hqc.h headers) by probing every standard install prefix
# via cgo. The default `go build ./...` invocation works without any
# env var, as long as ONE of the following is true:
#
# This Makefile centralises that wiring so devs and CI use the same
# flags. The mlx checkout is expected at ~/work/lux/mlx (a symlink to
# the canonical luxcpp/gpu source tree); override via MLX_ROOT.
# 1. `pkg-config lux-gpu` resolves (cmake --install put a
# lux-gpu.pc on PKG_CONFIG_PATH); OR
# 2. /usr/local has the lux-gpu install (cmake default prefix); OR
# 3. /opt/homebrew has it (Homebrew on Apple Silicon); OR
# 4. /opt/lux has it (canonical Lux prefix); OR
# 5. The Go workspace has luxfi/mlx as a sibling repo with a
# ready-to-link `mlx/build/libluxgpu_hqc.a`.
#
# To target a non-standard install, set LUX_GPU_PREFIX:
#
# LUX_GPU_PREFIX=/opt/custom make ci
#
# That gets fed into CGO_CFLAGS / CGO_LDFLAGS automatically. Power
# users can still set CGO_CFLAGS / CGO_LDFLAGS directly.
MLX_ROOT ?= $(HOME)/work/lux/mlx
# Optional override; empty means "use accel's auto-discovery".
LUX_GPU_PREFIX ?=
ifneq ($(LUX_GPU_PREFIX),)
export CGO_CFLAGS += -I$(LUX_GPU_PREFIX)/include
export CGO_LDFLAGS += -L$(LUX_GPU_PREFIX)/lib
endif
export CGO_CFLAGS := -I$(MLX_ROOT)/include
export CGO_LDFLAGS := -L$(MLX_ROOT)/build
export GOWORK := off
.PHONY: build test vet bench clean
.PHONY: build test test-long vet bench clean ci print-env
build:
go build ./...
@@ -33,14 +45,15 @@ vet:
go vet ./...
bench:
go test -bench=. -benchmem -run=^$ -timeout 600s ./...
go test -bench=. -benchmem -run=^$$ -timeout 600s ./...
ci: vet build test
# Diagnostic: print the resolved CGO env so a debugging dev can see
# what the build will actually use.
# Diagnostic: print the resolved cgo env so a debugging dev can see
# what the build will use. With LUX_GPU_PREFIX empty, accel falls
# back to its built-in fallback chain (see accel.GPUPaths()).
print-env:
@echo "MLX_ROOT = $(MLX_ROOT)"
@echo "CGO_CFLAGS = $(CGO_CFLAGS)"
@echo "CGO_LDFLAGS = $(CGO_LDFLAGS)"
@echo "GOWORK = $(GOWORK)"
@echo "LUX_GPU_PREFIX = $(LUX_GPU_PREFIX)"
@echo "CGO_CFLAGS = $(CGO_CFLAGS)"
@echo "CGO_LDFLAGS = $(CGO_LDFLAGS)"
@echo "GOWORK = $(GOWORK)"
+1 -5
View File
@@ -9,7 +9,7 @@ require (
github.com/consensys/gnark-crypto v0.20.1
github.com/crate-crypto/go-kzg-4844 v1.1.0
github.com/holiman/uint256 v1.3.2
github.com/luxfi/accel v1.1.2
github.com/luxfi/accel v1.1.4
github.com/luxfi/ai v0.1.0
github.com/luxfi/corona v0.4.1
github.com/luxfi/crypto v1.19.10
@@ -101,7 +101,3 @@ exclude (
github.com/luxfi/precompiles v0.1.10
github.com/luxfi/precompiles v0.1.11
)
// Local replace while the HQC PQClean cgo backend is being landed in
// luxfi/crypto. Drop once crypto cuts a release including
// crypto/hqc/pqclean/.
+2 -2
View File
@@ -73,8 +73,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4=
github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c=
github.com/luxfi/accel v1.1.2 h1:V3vZOWTcOmR5mm7I27jRvXmpEPyb3oRf7lLnL6R+pFI=
github.com/luxfi/accel v1.1.2/go.mod h1:K00BcnLzEYMPHwCFq8Tf/450ApmTs9xBVvYOnofJCkc=
github.com/luxfi/accel v1.1.4 h1:UOvS/00vG6WByf2P1tGYRkoBcsUkFuCgw7o2xU03OoE=
github.com/luxfi/accel v1.1.4/go.mod h1:K00BcnLzEYMPHwCFq8Tf/450ApmTs9xBVvYOnofJCkc=
github.com/luxfi/ai v0.1.0 h1:PwTGob0GJivbdqNpUs82bvwcE8/qxyTokxfY7BZVPoo=
github.com/luxfi/ai v0.1.0/go.mod h1:lTuY32dGjEJUgVheYuanlt1O0jHj0AZ09sUSpRsmH6M=
github.com/luxfi/atomic v1.0.0 h1:xUV60MuzRvXngaQ1sM0yVC2v4TRoLlUGkkH7M9PS4yw=