fix: detect all compute cap; require single cuda arch for zisk

This commit is contained in:
han0110
2026-02-12 00:19:24 +00:00
parent ab96e9c567
commit ce3e851407
7 changed files with 116 additions and 82 deletions

View File

@@ -139,7 +139,10 @@ fi
# Default CUDA_ARCHS when --cuda is set but --cuda-archs not specified
if [ "$CUDA" = true ] && [ -z "$CUDA_ARCHS" ]; then
CUDA_ARCHS="89,120"
case "$ZKVM" in
zisk) CUDA_ARCHS="120" ;; # Default to RTX 50 series (ZisK only support setting single CUDA arch)
*) CUDA_ARCHS="89,120" ;; # Default to RTX 40 and 50 series
esac
fi
# Per-zkVM CUDA architecture translation
@@ -165,10 +168,14 @@ if [ "$CUDA" = true ] && [ -n "$CUDA_ARCHS" ]; then
SERVER_ZKVM_BUILD_ARGS+=(--build-arg "NVCC_APPEND_FLAGS=$NVCC_APPEND_FLAGS")
;;
zisk)
MAX_CUDA_ARCH=$(echo "$CUDA_ARCHS" | tr ',' '\n' | sort -n | tail -1)
BASE_ZKVM_BUILD_ARGS+=(--build-arg "CUDA_ARCH=sm_${MAX_CUDA_ARCH}")
SERVER_ZKVM_BUILD_ARGS+=(--build-arg "CUDA_ARCH=sm_${MAX_CUDA_ARCH}")
CLUSTER_ZKVM_BUILD_ARGS+=(--build-arg "CUDA_ARCH=sm_${MAX_CUDA_ARCH}")
IFS=',' read -ra ARCH_ARRAY <<< "$CUDA_ARCHS"
if [ "${#ARCH_ARRAY[@]}" -ne 1 ]; then
echo "Error: Multiple CUDA architectures are not supported for zisk: $CUDA_ARCHS"
exit 1
fi
BASE_ZKVM_BUILD_ARGS+=(--build-arg "CUDA_ARCH=sm_${ARCH_ARRAY[0]}")
SERVER_ZKVM_BUILD_ARGS+=(--build-arg "CUDA_ARCH=sm_${ARCH_ARRAY[0]}")
CLUSTER_ZKVM_BUILD_ARGS+=(--build-arg "CUDA_ARCH=sm_${ARCH_ARRAY[0]}")
;;
*)
;;

View File

@@ -100,6 +100,9 @@ jobs:
- risc0
- sp1
- zisk
include:
- zkvm: zisk
cuda_archs: '120'
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -121,7 +124,7 @@ jobs:
--registry ${{ needs.image_meta.outputs.registry }} \
--tag ${{ needs.image_meta.outputs.sha_tag }}-cuda \
--base \
--cuda-archs '${{ env.CUDA_ARCHS }}'
--cuda-archs '${{ matrix.cuda_archs || env.CUDA_ARCHS }}'
- name: Push ere-base and ere-base-${{ matrix.zkvm }} images with CUDA enabled
run: |
@@ -134,7 +137,7 @@ jobs:
--registry ${{ needs.image_meta.outputs.registry }} \
--tag ${{ needs.image_meta.outputs.sha_tag }}-cuda \
--server \
--cuda-archs '${{ env.CUDA_ARCHS }}'
--cuda-archs '${{ matrix.cuda_archs || env.CUDA_ARCHS }}'
- name: Push ere-server-${{ matrix.zkvm }} image with CUDA enabled
run: |
@@ -152,6 +155,9 @@ jobs:
matrix:
zkvm:
- zisk
include:
- zkvm: zisk
cuda_archs: '120'
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -173,7 +179,7 @@ jobs:
--registry ${{ needs.image_meta.outputs.registry }} \
--tag ${{ needs.image_meta.outputs.sha_tag }}-cuda \
--cluster \
--cuda-archs '${{ env.CUDA_ARCHS }}'
--cuda-archs '${{ matrix.cuda_archs || env.CUDA_ARCHS }}'
- name: Push ere-cluster-${{ matrix.zkvm }} image with CUDA enabled
run: |

View File

@@ -17,5 +17,6 @@ jobs:
with:
zkvm: zisk
cuda: true
cuda_archs: '120'
cluster: true
skip_prove_test: true

View File

@@ -12,6 +12,11 @@ on:
required: false
type: boolean
default: false
cuda_archs:
description: 'Comma-separated CUDA archs to gencode'
required: false
type: string
default: '89,120'
cluster:
description: 'Whether to build cluster image'
required: false
@@ -26,7 +31,6 @@ on:
env:
CARGO_TERM_COLOR: always
CUDA_ARCHS: '89,120'
jobs:
image_meta:
@@ -99,7 +103,7 @@ jobs:
--registry ${{ needs.image_meta.outputs.image_registry }} \
--tag ${{ needs.image_meta.outputs.image_tag }}-cuda \
--cached-tag "$CACHED_TAG" \
--cuda-archs '${{ env.CUDA_ARCHS }}'
--cuda-archs '${{ inputs.cuda_archs }}'
- name: Build ere-server-${{ inputs.zkvm }} image with CUDA enabled
run: |
@@ -108,7 +112,7 @@ jobs:
--registry ${{ needs.image_meta.outputs.image_registry }} \
--tag ${{ needs.image_meta.outputs.image_tag }}-cuda \
--server \
--cuda-archs '${{ env.CUDA_ARCHS }}'
--cuda-archs '${{ inputs.cuda_archs }}'
- name: Build ere-cluster-${{ inputs.zkvm }} image with CUDA enabled
if: ${{ inputs.cluster && needs.image_meta.outputs.dockerfile_changed == 'true' }}
@@ -118,7 +122,7 @@ jobs:
--registry ${{ needs.image_meta.outputs.image_registry }} \
--tag ${{ needs.image_meta.outputs.image_tag }}-cuda \
--cluster \
--cuda-archs '${{ env.CUDA_ARCHS }}'
--cuda-archs '${{ inputs.cuda_archs }}'
clippy_via_docker:
name: Clippy via Docker