Skip to content

Unified Snap - #806

Merged
magik6k merged 28 commits into
andyfastsnapfrom
andyfastsnap-unified
Dec 15, 2025
Merged

Unified Snap#806
magik6k merged 28 commits into
andyfastsnapfrom
andyfastsnap-unified

Conversation

@snadrus

@snadrus snadrus commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

This addition to the fast snap mainline modifies supraseal:

  • No more objcopy: An interface glues the filereader with the NVMe driver.
  • Faster build using parallelism
  • AMD64v3 becomes the default, as Curio has had for a while (2013-2015 era introduction).
  • Added a fallback for CPUs without SHA-NI (v3 but not v4) to be able to use Supraseal.

This should make fastsnap the only path needed for Curio.

  • mbx2 is the crazy SHA for Zen: supraseal/sha/sha_mbx_wrapper.cpp

Cases
old libfilecoin-ffi snap:

  • non-Linux: mbx2 fallback
  • Linux Snap without CUDA
  • Linux before AMD64v4

Use supraseal fastsnap:

  • Linux with Cuda with AMD64v4

Use supraseal PC1:

  • Linux + CUDA + Zen only. TODO!!!!!!!: Fix mbx2 to run only in this case.

DEBs to cover all cases:

  1. OPENGL
  2. CUDA
  3. ZEN

Note

Unifies SupraSeal snap path with CPU/GPU fallback, adds a curio batch setup SPDK command, refactors/builds the SupraSeal library, and overhauls CI/Docker to Ubuntu 24.04 with GCC 12 and CUDA.

  • SupraSeal core/library:
    • Unifies PC2 via templated readers (NVMe and file) and removes objcopy/symbol hacks.
    • Parallelizes build (Poseidon constants, objects); adjusts NVCC flags; builds libsupraseal.a (no tool binaries in CI).
    • Adds CUDA-only TreeR path with CPU/GPU feature detection; fallback to filecoin-ffi when unsupported.
    • Fixes memory delete (delete[]) in c1/challenge.hpp.
  • CLI/runtime:
    • Adds curio batch setup to auto-configure SPDK (hugepages, NVMe binding).
    • Auto SPDK setup and hugepage checks in batch task; supports DISABLE_SPDK_SETUP env.
  • Go bindings (lib/supraffi, ffidirect):
    • Splits NVMe vs generic CUDA paths; adds CPU feature and CUDA probing; TreeR fallback in FFI wrapper.
  • Build/Makefile:
    • Makes SupraSeal a default Linux build dep; sets GOAMD64=v3; removes legacy batch targets.
  • CI/Docker:
    • Migrates to ubuntu-24.04, replaces custom Go action, sets GCC 12 via alternatives.
    • Installs CUDA 12+, configures stubs and env; recursive submodules; caches proof params.
    • Adds dedicated SupraSeal library build job/artifact and local test Dockerfile.
  • Docs:
    • Updates install deps (adds libgmp-dev, libconfig++-dev), switches build instructions to make curio/sptool.
    • Documents curio batch setup and new env var in EN/ZN SupraSeal guides.

Written by Cursor Bugbot for commit 23c6b6a. This will update automatically on new commits. Configure here.

Comment thread cmd/curio/batch.go

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, but I really don't think it's all that useful, all somewhat recent CPUs have sha extensions, and without those I don't think the performance will be useful even for testing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We got pushback when a make Curio's minimum AMD64v4 earlier this year, so we lowered it to V3 which lacks sha-ni.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is V3 == -march=zenver2 or are those kinda different?

Comment thread lib/supraffi/spdk_setup.go
return hasAMD64v4
}

func detectAMD64v4() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magik6k how should I detect "Zen-ish" for SupraPC1 ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking CPU support for SHA-NI should be good enough

@snadrus

snadrus commented Dec 12, 2025

Copy link
Copy Markdown
Contributor Author

Cannot proceed until the self-hosted runners get to Ubuntu 24.04 (currently 20.04 which was also referred to as "ubuntu-latest")

@magik6k
magik6k force-pushed the andyfastsnap-unified branch 2 times, most recently from d77abff to 27984aa Compare December 13, 2025 14:35
@magik6k
magik6k force-pushed the andyfastsnap-unified branch from 27984aa to ec248bc Compare December 13, 2025 14:38
@magik6k
magik6k force-pushed the andyfastsnap-unified branch 2 times, most recently from ce76fab to ca7f08e Compare December 13, 2025 18:26
@magik6k
magik6k marked this pull request as ready for review December 13, 2025 23:25
@magik6k
magik6k requested a review from a team as a code owner December 13, 2025 23:25

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is V3 == -march=zenver2 or are those kinda different?

Comment on lines +12 to +15
// Include file reader implementation with renamed class to avoid conflict
#define streaming_node_reader_t streaming_node_reader_files_t
#include "../c1/streaming_node_reader_files.hpp"
#undef streaming_node_reader_t

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems really extremely cursed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread lib/ffiselect/ffidirect/ffi-direct.go
Comment thread lib/supraffi/cuda_linux.go Outdated
@magik6k

magik6k commented Dec 15, 2025

Copy link
Copy Markdown
Collaborator

Merging into andyfastsnap so that there's just one branch to work on

@magik6k
magik6k merged commit 1c7fa06 into andyfastsnap Dec 15, 2025
6 of 14 checks passed
@magik6k
magik6k deleted the andyfastsnap-unified branch December 15, 2025 07:39
if [ -n "${LD_LIBRARY_PATH}" ]; then
LD_LIB_PATH="$LD_LIB_PATH:${LD_LIBRARY_PATH}"
LIB_PATH="$LIB_PATH:${LIBRARY_PATH}"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Mismatched environment variable check causes incorrect library paths

The condition on line 165 checks if LD_LIBRARY_PATH is non-empty, but line 167 unconditionally appends ${LIBRARY_PATH} (a different environment variable) to LIB_PATH. These are two distinct environment variables (LD_LIBRARY_PATH for runtime linking, LIBRARY_PATH for compile-time linking). If LD_LIBRARY_PATH is set but LIBRARY_PATH is unset, this appends an empty value causing a trailing colon in the path. Conversely, if LIBRARY_PATH is set but LD_LIBRARY_PATH is not, the value never gets appended. Each variable needs its own separate check.

Fix in Cursor Fix in Web

magik6k added a commit that referenced this pull request Jan 14, 2026
* supra: file tree_r ffi

* wire up treerfile to go

* supra: using the correct node reader in file tree_r ffi

* tree_r links

* redefs, it works

* missing test-supra cmd

* fast snap encode

* encode-snap test

* wire up fast-snap

* make gen

* encode works

* fix: yield in PSClientPoll correctly

* faster webui history

* pspoll: Don't timeout the context

* fix EpochPretty ddos

* more robust dealdata

* robusthttp metrics

* enable is done this way round

* pshare: prio snap

* encode bind to data

* make gen

* piecepark node dl limit

* only park pieces locally when supra P2 isn't running

* fix commp canaccept

* fix build

* fix commp canaccept storage query

* aaaargh

* prevent dupe piece park task

* expose piecepark min free pct

* Do snap falloc

* Cache storage info in localstorage.Local calls for a bit

* MoveStorage / UpgradeStore param tweaks

* snap key no read

* snap: Parallel movestorage

* snap mertics, ui fix

* missing snap metrics

* fix snap batch backoff

* somewhat handle snap msg fails on immutable deadline

* fix snap retry query params

* storage: Copy over snap vproof

* treeR file deadline

* slower retry movestorage

* ipni: Handle orphan tasks

* ipni: Accept orphans

* f05 bmgr

* f05 bmgr fixes

* fix f05 bm build

* make gen

* missing fixes postrebase

* fix: proofshare: Fix client payment chain bootstrap

* feat: test post cli: Vanilla Proof test command

* supra: live duration-so-far metric

* webui: Content page

* fix: Make kubo retrievals work (#724)

* fix(retrieval): handle pathed IPFS retrieval style, add basic retrieval tests (#720)

* ipni: Announce addresses with port

* update lotus

* make gen

---------

Co-authored-by: Rod Vagg <rod@vagg.org>

* add more caches

* more metrics, less log spam

* http method in req stats

* http metric for in-flight requests

* remotebs: return correct err on not-found

* limit parallel retrievals

* separate head req limiter

* fix race condition that resulted in ignoring the last bit of cached data.

* merge iffy

* gen

* lint and tests

* old linter making mistakes

* linty

* fixes

* oops

* agent review fixes

* cuda13 capable ffi

* supra: allow passing march flag

* Unified Snap (#806)

* build

* 2

* 3

* build gotchas

* right shape

* requirements include cuda

* get build fixed

* cuda for everyone

* add golang for ci

* stop deleting my stuff

* try with gcc flag

* auto-nvme-setup opt-out

* ci build fix attempt

* fix outdated base image

* gofmt, flag- no avx512bf16

* try cuda setup

* do like working job

* try without cuda

* try cude in install-deps

* cuda info in github env

* make spdk happy

* deps

* gcc12

* ubuntu-latest is not 2404 but 2004

* ci: missing deps, fix ubuntus

* supra: rm mbx wrapper, fix poseidon constants wait, native default arch

* review fixes

---------

Co-authored-by: Łukasz Magiera <magik6k@gmail.com>

* version and dep

* dl v1

* missing market miners onchange initial setup

* test supra system-info command

* supra: add missing pc2_hash_files template instantiations

* supra: correct -march in pc2.cu to make blst not segfault

* cache supraseal

* fix: storage: Make declare usably fast

* sectormetadata: Recheck partition presence

* debug expmgr

* expmgr: Never try to extend dead sectors

* use our runners

* Trying to fix CI

* fixing CI

* indexing: gracefully handle no-unsealed-copy pieces

* solve CI lint errors

* CI cleanups

* CI: export regex

* test_env_vars

* cgo fix

* paux in fallback flow

* gen

* cuda probe without nvcc

* env to disable snap supra

* fix generic crosscompile, explicit native target

* gcc 13 for supra

* supra docs

* address review

* fix itests

---------

Co-authored-by: Łukasz Magiera <magik6k@gmail.com>
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
Co-authored-by: Rod Vagg <rod@vagg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants