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

compilation of extension field in MSM is too slow #99

Open
cliff0412 opened this issue Oct 22, 2024 · 2 comments
Open

compilation of extension field in MSM is too slow #99

cliff0412 opened this issue Oct 22, 2024 · 2 comments

Comments

@cliff0412
Copy link
Collaborator

No description provided.

@doutv
Copy link
Collaborator

doutv commented Oct 28, 2024

Build time when enable G2 MSM: 300s

cmake -B build -DCMAKE_BUILD_TYPE=Release -DCURVE=BN254 -DG2_ENABLED=ON -DBUILD_MSM=ON
time cmake --build build
cmake --build build  302.83s user 7.47s system 99% cpu 5:10.47 total

Look into details

/usr/local/cuda/bin/nvcc --time - --verbose -forward-unknown-to-host-compiler -DFEATURE_BN254 -DG2_ENABLED -DBUILD_MSM -DEXPOSE_C_INTERFACE -DTAKE_RESPONSIBILITY_FOR_ERROR_MESSAGE -DUSE_CUDA -D__ADX__ --options-file CMakeFiles/cryptocudacuda.dir/includes_CUDA.rsp -O3 -DNDEBUG -std=c++17 "--generate-code=arch=compute_89,code=[compute_89,sm_89]" -Xcompiler=-fPIC -dc -MD -MT CMakeFiles/cryptocudacuda.dir/msm/msm.cu.o -MF CMakeFiles/cryptocudacuda.dir/msm/msm.cu.o.d -x cu -rdc=true -c /home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu -o CMakeFiles/cryptocudacuda.dir/msm/msm.cu.o

#$ cicc --c++17 --gnu_version=110400 --display_error_number --orig_src_file_name "/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu" --orig_src_path_name "/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu" --allow_managed  --device-c   -arch compute_89 -m64 --no-version-ident -ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1 --include_file_name "tmpxft_000f2741_00000000-3_msm.fatbin.c" -tused --module_id_file_name "/tmp/tmpxft_000f2741_00000000-4_msm.module_id" --gen_c_file_name "/tmp/tmpxft_000f2741_00000000-6_msm.cudafe1.c" --stub_file_name "/tmp/tmpxft_000f2741_00000000-6_msm.cudafe1.stub.c" --gen_device_file_name "/tmp/tmpxft_000f2741_00000000-6_msm.cudafe1.gpu"  "/tmp/tmpxft_000f2741_00000000-7_msm.cpp1.ii" -o "/tmp/tmpxft_000f2741_00000000-6_msm.ptx"
/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu , cicc ,  /tmp/tmpxft_000f2741_00000000-7_msm.cpp1.ii  , /tmp/tmpxft_000f2741_00000000-6_msm.ptx , compute_89 , nvcc , 260733.2656 , ms
#$ ptxas -arch=sm_89 -m64 --compile-only  "/tmp/tmpxft_000f2741_00000000-6_msm.ptx"  -o "/tmp/tmpxft_000f2741_00000000-8_msm.sm_89.cubin" 
/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu , ptxas , /tmp/tmpxft_000f2741_00000000-6_msm.ptx  , /tmp/tmpxft_000f2741_00000000-8_msm.sm_89.cubin , sm_89 , nvcc , 14485.4258 , ms

@doutv
Copy link
Collaborator

doutv commented Oct 29, 2024

After delete __forceinline__ in extension_field.cuh, the compile time became much faster
i.e. do not inline functions related to G2 extension field
cicc: 260s -> 54s
However, I'm not sure whether it would affect the runtime speed.

#$ cicc --c++17 --gnu_version=110400 --display_error_number --orig_src_file_name "/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu" --orig_src_path_name "/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu" --allow_managed  --device-c   -arch compute_60 -m64 --no-version-ident -ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1 --include_file_name "tmpxft_000f5135_00000000-3_msm.fatbin.c" -tused --module_id_file_name "/tmp/tmpxft_000f5135_00000000-4_msm.module_id" --gen_c_file_name "/tmp/tmpxft_000f5135_00000000-6_msm.cudafe1.c" --stub_file_name "/tmp/tmpxft_000f5135_00000000-6_msm.cudafe1.stub.c" --gen_device_file_name "/tmp/tmpxft_000f5135_00000000-6_msm.cudafe1.gpu"  "/tmp/tmpxft_000f5135_00000000-7_msm.cpp1.ii" -o "/tmp/tmpxft_000f5135_00000000-6_msm.ptx"
/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu , cicc ,  /tmp/tmpxft_000f5135_00000000-7_msm.cpp1.ii  , /tmp/tmpxft_000f5135_00000000-6_msm.ptx , compute_60 , nvcc , 54353.8086 , ms
#$ ptxas -arch=sm_60 -m64 --compile-only  "/tmp/tmpxft_000f5135_00000000-6_msm.ptx"  -o "/tmp/tmpxft_000f5135_00000000-8_msm.sm_60.cubin" 
/home/okxdex/data/zkdex-pap/workspace/jason-huang/cryptography_cuda/native/msm/msm.cu , ptxas , /tmp/tmpxft_000f5135_00000000-6_msm.ptx  , /tmp/tmpxft_000f5135_00000000-8_msm.sm_60.cubin , sm_60 , nvcc , 18578.5273 , ms

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

No branches or pull requests

2 participants