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

golang v3 wrappers #564

Closed
wants to merge 48 commits into from
Closed

golang v3 wrappers #564

wants to merge 48 commits into from

Conversation

nonam3e
Copy link
Contributor

@nonam3e nonam3e commented Jul 28, 2024

No description provided.

vladfdp and others added 27 commits July 3, 2024 09:07
…-zk/icicle into feat/vlad/refactor-from-affine
Fix typos
## Describe the changes

This PR refactors the different affine to projective conversion
functions using the C function

also small bug fix for ProjectiveToAffine() function in Go

## Linked Issues

Resolves #
## Describe the changes

This PR...

## Linked Issues

Resolves #
@yshekel yshekel force-pushed the yshekel/V3 branch 2 times, most recently from 0e2d8e2 to 73dd80b Compare August 1, 2024 13:31

# TODO: bw6 on windows requires more memory than the standard runner has
# Add a large runner and then enable this job
# build-windows:
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the Windows build? Should'nt we just remove this at this point?

Copy link
Collaborator

Choose a reason for hiding this comment

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

➕ for removing

export DEFAULT_BACKEND_INSTALL_DIR=$PWD/../../../build/
go test ./$FIELD/tests -count=1 -failfast -p 2 -timeout 60m -v

# build-hashes-linux:
Copy link
Contributor

Choose a reason for hiding this comment

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

are hashes not supported in v3 rn? This specific check only runs keccak

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't have hashes in v3 for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets remove this for now then

Copy link
Collaborator

@jeremyfelder jeremyfelder left a comment

Choose a reason for hiding this comment

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

Great job 💪🏻. Most comments are small

Comment on lines +4 to +20
type EIcicleError int

const (
Success EIcicleError = iota // Operation completed successfully
InvalidDevice // The specified device is invalid
OutOfMemory // Memory allocation failed due to insufficient memory
InvalidPointer // The specified pointer is invalid
AllocationFailed // Memory allocation failed
DeallocationFailed // Memory deallocation failed
CopyFailed // Data copy operation failed
SynchronizationFailed // Device synchronization failed
StreamCreationFailed // Stream creation failed
StreamDestructionFailed // Stream destruction failed
ApiNotImplemented // The API is not implemented for a device
InvalidArgument // Invalid argument passed
UnknownError // An unknown error occurred
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to use the C.enum_eIcicleError values directly from cpp errors.h to prevent reordering issues.

See https://pkg.go.dev/cmd/cgo#hdr-Go_references_to_C for accessing C types from Go

wrappers/golang_v3/build.ps1 Show resolved Hide resolved
wrappers/golang_v3/build.sh Show resolved Hide resolved
wrappers/golang_v3/build.sh Show resolved Hide resolved
wrappers/golang_v3/curves/bn254/curve.go Show resolved Hide resolved
wrappers/golang_v3/README.md Show resolved Hide resolved
@nonam3e nonam3e marked this pull request as draft August 29, 2024 10:53
@@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v4
- name: Check rustfmt
if: needs.check-changed-files.outputs.rust == 'true' || needs.check-changed-files.outputs.cpp_cuda == 'true'
working-directory: ./wrappers/rust
working-directory: ./wrappers/rust_v3
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

@@ -0,0 +1,205 @@
name: GoLang
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename to golang without v3_golang

@@ -18,7 +18,9 @@ cpu_msm(const Device& device, const S* scalars, const A* bases, int msm_size, co
const S* batch_scalars = scalars + msm_size * batch_idx;
const A* batch_bases = config.are_bases_shared ? bases : bases + msm_size * batch_idx;
for (auto i = 0; i < msm_size; ++i) {
res = res + P::from_affine(batch_bases[i]) * batch_scalars[i];
res =
Copy link
Collaborator

Choose a reason for hiding this comment

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

can remove this now assuming fixed in new msm. Also note the icicle_v3 dir

@nonam3e
Copy link
Contributor Author

nonam3e commented Aug 29, 2024

Opened a new PR #594 with the same changes and review fixes

@nonam3e nonam3e closed this Aug 29, 2024
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.

6 participants