Skip to content

Commit

Permalink
Remove rapidsnark_asm build tag. Now default build is with asm by def…
Browse files Browse the repository at this point in the history
…ault.
  • Loading branch information
olomix committed Sep 14, 2024
1 parent 3c16ee7 commit 9588ce2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 51 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/test-linux-asm.yaml

This file was deleted.

17 changes: 9 additions & 8 deletions prover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ For the following architectures, pre-built vendored libraries are included:

## Performance optimization on x86_64 hardware

Rapidsnark has optimization for recent x86_64 processors that gives ~2x speed boost, but older hardware may lack support for ADX and BMI2 instruction sets used.
Rapidsnark has optimization for recent x86_64 processors that gives ~2x speed boost,
but older hardware may lack support for ADX and BMI2 instruction sets used.
If you have such hardware, you may want to disable assembly optimizations by
specifying `rapidsnark_noasm` build tag. By default, optimizations are ON.

MacOS build has it enabled. But for linux we disabled the optimization (at least for now, because GitHub Actions may use old hardware).

To **enable** optimization on linux use `rapidsnark_asm` build tag:
MacOS build there is no way to disable assembly optimizations with build tags.
You need to build your custom library with disabled optimizations. And
build the library with `dynamic` tag to use it instead of vendored one.

```shell
go build -tags rapidsnark_asm
go test -tags rapidsnark_asm
go build -tags rapidsnark_noasm
go test -tags rapidsnark_noasm
```

In the future we may change default behaviour, so to force disable optimizations use `rapidsnark_noasm` build tag.

## Performance optimization on arm64 hardware
We used NEON instruction set, and it is always enabled, so no build tags are needed.

Expand Down
4 changes: 2 additions & 2 deletions prover/build_linux_amd64.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build !dynamic && !rapidsnark_noasm && !rapidsnark_asm
//go:build !dynamic && !rapidsnark_noasm

package prover

// #cgo CFLAGS: -DUSE_VENDORED_RAPIDSNARK
// #cgo LDFLAGS: ${SRCDIR}/rapidsnark_vendor/librapidsnark-linux-amd64-noasm.a ${SRCDIR}/rapidsnark_vendor/libgmp-linux-amd64.a -lstdc++ -fopenmp
// #cgo LDFLAGS: ${SRCDIR}/rapidsnark_vendor/librapidsnark-linux-amd64.a ${SRCDIR}/rapidsnark_vendor/libgmp-linux-amd64.a -lstdc++ -fopenmp
import "C"
7 changes: 0 additions & 7 deletions prover/build_linux_amd64_asm.go

This file was deleted.

2 changes: 1 addition & 1 deletion prover/build_linux_amd64_noasm.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux && amd64 && !dynamic && rapidsnark_noasm && !rapidsnark_asm
//go:build linux && amd64 && !dynamic && rapidsnark_noasm

package prover

Expand Down

0 comments on commit 9588ce2

Please sign in to comment.