Conversation
|
thanks @mrain for taking the initiative to upgrade our icicle dep! 👍 |
| ark-ed-on-bn254 = "0.4.0" | ||
| criterion = "0.5.1" | ||
| jf-pcs = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = ["test-srs"] } | ||
| jf-pcs = { path = "../pcs", features = ["test-srs"] } |
There was a problem hiding this comment.
Use path b/c some updates are not reflected in the github yet.
There was a problem hiding this comment.
Do you intend to switch back before merge?
There was a problem hiding this comment.
i don't think he can. One of the perils of separate versioning is multi-step upgrade here.
changing back need another PR: a new tag will be added once this PR is merged, then next one would switch back.
ggutoski
left a comment
There was a problem hiding this comment.
A couple of nits. I'd like another pair of eyes before approval.
| icicle_bn254::curve::G1Affine { | ||
| x: icicle_bn254::curve::BaseField::from(p.x.0 .0), | ||
| y: icicle_bn254::curve::BaseField::from(p.y.0 .0), | ||
| x: unsafe { ark_std::mem::transmute(p.x.into_bigint()) }, |
There was a problem hiding this comment.
Nit: refactor this recurring line of unsafe code into a separate function.
There was a problem hiding this comment.
and did we add test for this unsafe transmute anywhere?
also can you add comment that even though arkworks uses u64 limb (as opposed to u32 in icicle), they are both little-endian encoded, thus agree on a byte-level, which is why this unsafe transmute is correct.
^^ am I right?
There was a problem hiding this comment.
Yes, the test is here: https://github.com/EspressoSystems/jellyfish/pull/595/files#diff-1b7c209306eb56d628e64ac6bc03978824af57767468dc3c618243860d04a6e3L1415
But it's only testing the ScalarField conversion. Maybe it's okay to assume that BaseField conversion should pass if this passes.
| /// - default implementation assume normal(non-montgomery) affine for | ||
| /// bases and scalars, consider overwrite this function if you want | ||
| /// otherwise |
There was a problem hiding this comment.
From the PR description:
commit_on_gpunow assume that the input scalars are in normal form instead of montgomery form.
Why switch from montgomery to normal?
I'm surprised you don't need to update this comment. This comment suggests it was always the case that scalars are in normal form. So was it wrong before and is now correct??
There was a problem hiding this comment.
No this is always correct. The generic implementation assumes that the scalars are normal. Only for Bn254 we take montgomery scalars. Now they have to be normal in all cases.
| pub fn warmup_new_stream() -> anyhow::Result<CudaStream> { | ||
| let stream = CudaStream::create().map_err(|e| anyhow!("{:?}", e))?; | ||
| let _warmup_bytes = HostOrDeviceSlice::<'_, u8>::cuda_malloc_async(1024, &stream) | ||
| .map_err(|e| anyhow!("{:?}", e))?; | ||
| let _warmup_bytes = | ||
| DeviceVec::<u8>::cuda_malloc_async(1024, &stream).map_err(|e| anyhow!("{:?}", e))?; |
There was a problem hiding this comment.
i think we can forgo this function in favor of out-of-box: https://github.com/ingonyama-zk/icicle/blob/621676bd41659bc101f29dc7ac54f29c7cdaa92b/wrappers/rust/icicle-cuda-runtime/src/device.rs#L44
There was a problem hiding this comment.
this is probably the last unaddressed comment? @mrain
There was a problem hiding this comment.
They are already at v4.0.0 and there're many breaking changes. Probably we could directly jump there by spending some more time if necessary.
| ark-ed-on-bn254 = "0.4.0" | ||
| criterion = "0.5.1" | ||
| jf-pcs = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = ["test-srs"] } | ||
| jf-pcs = { path = "../pcs", features = ["test-srs"] } |
There was a problem hiding this comment.
i don't think he can. One of the perils of separate versioning is multi-step upgrade here.
changing back need another PR: a new tag will be added once this PR is merged, then next one would switch back.
| /// Stress test with varied payload sizes for GPU memory | ||
| /// leakage/fragmentation. |
There was a problem hiding this comment.
how does this test leakage or fragmentation?
iiuc, this only put lots of running instances, and in case we didn't clean up (after use) the memory, it would overflow the memory?
but how does it test fragmentation?
There was a problem hiding this comment.
Suggested by Salman. It really depends on the GPU memory management. Hypothesis is that if you make many GPU memory allocations and they are not cleaned up fast enough, then there're potentially fragmentations that prevent you from allocating even if the GPU memory is not full.
There was a problem hiding this comment.
plz put this explanation in a comment 🙏
| icicle_bn254::curve::G1Affine { | ||
| x: icicle_bn254::curve::BaseField::from(p.x.0 .0), | ||
| y: icicle_bn254::curve::BaseField::from(p.y.0 .0), | ||
| x: unsafe { ark_std::mem::transmute(p.x.into_bigint()) }, |
There was a problem hiding this comment.
and did we add test for this unsafe transmute anywhere?
also can you add comment that even though arkworks uses u64 limb (as opposed to u32 in icicle), they are both little-endian encoded, thus agree on a byte-level, which is why this unsafe transmute is correct.
^^ am I right?
| DeviceVec<IcicleAffine<<UnivariateKzgPCS<E> as GPUCommittable<E>>::IC>>, | ||
| CudaStream, |
There was a problem hiding this comment.
do we strictly need type AdvzGPU? the 'srs lifetime can be removed at least?
There was a problem hiding this comment.
Sure we could remove the lifetime specifier. I'm not sure what do you mean, AdvzGPU takes additional type generics for on GPU srs and CudaStream.
There was a problem hiding this comment.
AdvzGPU takes additional type generics for on GPU srs and CudaStream.
i forgot about this. nvm. maybe just remove the lifetime.
…ellyfish into cl/icicle
no issue related.
This PR:
HostOrDeviceSliceis now a trait. Occurrences are changed to concrete types now.Bn254curve implcommit_on_gpunow assume that the input scalars are in normal form instead of montgomery form.load_poly_to_gpuhas one memory copy instead of free as beforeu32limbs instead ofu64limbs as in arkworks.This PR does not:
Key places to review:
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
CHANGELOG.mdof touched crates.Files changedin the GitHub PR explorer