Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: support blst portable build #2091

Merged
merged 1 commit into from Jan 18, 2024

Conversation

yoomee1313
Copy link
Contributor

@yoomee1313 yoomee1313 commented Jan 16, 2024

Proposed changes

  • This PR added CGO_CFLAGS="-O2 -g -D__BLST_PORTABLE__" when building klaytn binary to support blst portable build

Types of changes

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

#2076

Further comments

  • Performance Test. @blukat29
    • environment is m6i.xlarge (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz)
    • cpuid: ADX instructions = true, SHA instructions = true (optimized instruction works)
    • test fn: blst go binding (https://github.com/supranational/blst/tree/master/bindings/go) BenchmarkCoreSignMinPk
    • test result
      • blst library v0.3.10 (without runtime detection): Default 420,000 ns/op, Portable 530,000 ns/op
      • blst library v0.3.11 (with runtime detection): Default 420,000 ns/op, Portable 420,000 ns/op
    • conclusion
      • Runtime detection at v0.3.11 works. Portable binary automatically optimizes depending on the environment.
  • Compatibility Test
    • Check the docker image generated in x86_64 works at m1. → works well
    • Check the intel mac binary works at m1. → works well
    • Check if CGO_CFLAGS works. -> settings are correct
  • How to check if a binary is porable
# Portable. Built with CGO_CFLAGS
$ strings build/bin/ken | grep CGO_CFLAGS
build	CGO_CFLAGS="-O2 -g -D__BLST_PORTABLE__"
build	CGO_CFLAGS="-O2 -g -D__BLST_PORTABLE__"

# Not portable. Built without CGO_CFLAGS
$ strings build/bin/ken | grep CGO_CFLAGS       
CGO_CFLAGS=""
CGO_CFLAGS=""

@blukat29
Copy link
Contributor

@yoomee1313 The -g flag adds debug symbols to the binary. Please check if binary size increases.

@yoomee1313
Copy link
Contributor Author

yoomee1313 commented Jan 17, 2024

@blukat29 The binary size is same. 53M. Referenced from geth code.
https://github.com/ethereum/go-ethereum/blob/c66ca8bf7a8c63ae54e44f4566e206cd1a4fa204/internal/build/gotool.go#L58.

@blukat29 blukat29 merged commit ebe8779 into klaytn:dev Jan 18, 2024
11 checks passed
@blukat29 blukat29 mentioned this pull request Jan 22, 2024
13 tasks
@yoomee1313 yoomee1313 deleted the test-intel-mac-binary branch April 8, 2024 10:13
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.

None yet

4 participants