Skip to content

Commit d29dd7b

Browse files
authored
fix: finish inverting the nofvm logic
1 parent 9828a50 commit d29dd7b

7 files changed

Lines changed: 33 additions & 9 deletions

File tree

cgo/fvm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build fvm
1+
//go:build !nofvm
22

33
package cgo
44

cgo/types_fvm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build fvm
1+
//go:build !nofvm
22

33
package cgo
44

fvm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//go:build cgo && (amd64 || arm64 || riscv64) && fvm
1+
//go:build cgo && (amd64 || arm64 || riscv64) && !nofvm
22
// +build cgo
33
// +build amd64 arm64 riscv64
4-
// +build fvm
4+
// +build !nofvm
55

66
package ffi
77

fvm_stub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !fvm
1+
//go:build nofvm
22

33
package ffi
44

install-filcrypto

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ build_from_source() {
218218
fi
219219
fi
220220

221+
# Use -no-fvm GPU feature variants when FVM is disabled
222+
if [ -n "${FFI_DISABLE_FVM}" ] && [ -n "${gpu_flags}" ]; then
223+
echo "FFI_DISABLE_FVM is set, using no-fvm GPU variant"
224+
gpu_flags="${gpu_flags}-no-fvm"
225+
fi
226+
221227
# Default to use multicore_sdr flags, unless specified to disable
222228
use_multicore_sdr="multicore-sdr"
223229
if [ "${FFI_USE_MULTICORE_SDR}" == "0" ]; then
@@ -237,7 +243,7 @@ build_from_source() {
237243
[ -n "${use_multicore_sdr}" ] && features+=("${use_multicore_sdr}")
238244

239245
[ -n "${gpu_flags}" ] && features+=("${gpu_flags#,}")
240-
[ "${FFI_DISABLE_FVM}" != "1" ] && features+=("fvm")
246+
[ -z "${FFI_DISABLE_FVM}" ] && features+=("fvm")
241247
[ -n "${use_fixed_rows_to_discard}" ] && features+=("${use_fixed_rows_to_discard#,}")
242248
if [ "${FFI_USE_BLST_PORTABLE}" == "1" ] || [ "${FFI_PORTABLE}" == "1" ]; then
243249
features+=("blst-portable")

rust/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ opencl = [
8787
"fvm3/opencl",
8888
"fvm4/opencl",
8989
]
90+
# GPU features without FVM (for builds that disable FVM)
91+
cuda-no-fvm = [
92+
"filecoin-proofs-api/cuda",
93+
"rust-gpu-tools/cuda",
94+
]
95+
cuda-supraseal-no-fvm = [
96+
"filecoin-proofs-api/cuda-supraseal",
97+
"rust-gpu-tools/cuda",
98+
]
99+
opencl-no-fvm = [
100+
"filecoin-proofs-api/opencl",
101+
"rust-gpu-tools/opencl",
102+
]
90103
multicore-sdr = ["filecoin-proofs-api/multicore-sdr"]
91104
c-headers = ["safer-ffi/headers"]
92105
# This feature enables a fixed number of discarded rows for TreeR. The `FIL_PROOFS_ROWS_TO_DISCARD`

rust/scripts/build-release.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ main() {
2424
#
2525
local __rust_flags="--print native-static-libs ${RUSTFLAGS}"
2626

27+
local __extra_features=""
28+
if [[ -z "${FFI_DISABLE_FVM}" ]]; then
29+
__extra_features="--features fvm"
30+
fi
31+
2732
# shellcheck disable=SC2068 # the rest of the parameters should be split
2833
RUSTFLAGS="${__rust_flags}" \
2934
cargo build \
30-
--release --locked ${@:2} 2>&1 | tee ${__build_output_log_tmp}
35+
--release --locked ${@:2} ${__extra_features} 2>&1 | tee ${__build_output_log_tmp}
3136

3237
# parse build output for linker flags
3338
#
@@ -56,7 +61,7 @@ main() {
5661
# shellcheck disable=SC2068 # the rest of the parameters should be split
5762
RUSTFLAGS="${__rust_flags}" \
5863
cargo build \
59-
--release --locked --target ${__target} ${@:2} 2>&1 \
64+
--release --locked --target ${__target} ${@:2} ${__extra_features} 2>&1 \
6065
| tee ${__build_output_log_tmp}
6166

6267
# Create the universal binary/
@@ -75,7 +80,7 @@ main() {
7580
# generate filcrypto.h
7681
# Check if FVM is in the build features - if so, include it in header generation
7782
local __header_features="c-headers"
78-
if echo "${@:2}" | grep -q "fvm"; then
83+
if [[ -z "${FFI_DISABLE_FVM}" ]]; then
7984
__header_features="c-headers,fvm"
8085
fi
8186
RUSTFLAGS="${__rust_flags}" HEADER_DIR="." \

0 commit comments

Comments
 (0)