fix(python): initialize and expose ICICLE GPU runtime#1028
Open
peter941221 wants to merge 1 commit into
Open
Conversation
Python GPU entrypoints were bypassing the CLI device setup path, so gen_srs, setup, and prove could silently stay on CPU even when ICICLE_BACKEND_INSTALL_DIR was set. This patch makes GPU initialization run from the shared execution entrypoints and makes it idempotent with Once. It also fixes Linux Python GPU loading by promoting the required ICICLE frontend shared libraries to RTLD_GLOBAL, so later backend dlopen calls can resolve symbols such as register_deviceAPI.
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes the Linux Python GPU path for
ezkl.Before this patch:
run()gen_srs,setup, andprovebypassed that pathICICLE_BACKEND_INSTALL_DIRset, Python could still stay on CPUdlopencallsAfter this patch:
gen_srs,setup, andproveall initialize the GPU backend/device through the shared execution pathRTLD_GLOBALon Linux GPU buildsRoot Cause
There were two linked issues.
set_device()existed, but only the CLIrun()path called itlibicicle_device.solibicicle_hash.solibicicle_field_bn254.solibicicle_curve_bn254.sodlopencalls could fail to resolve symbols likeregister_deviceAPIChanges
src/execute.rsset_device()idempotent withOnceset_device()from:gen_srs_cmdsetupprovesrc/bindings/python.rsRTLD_GLOBALduring module initializationLocal Validation
Validated locally on
2026-05-17in WSL on an RTX 5090.Build
Python repro
Minimal Python chain:
gen_settingscompile_circuitgen_witnesssetupproveObserved behavior:
Registering DEVICE: device=CPURegistering DEVICE: device=CUDAsetupandproveboth succeedScope
This is intentionally narrow: