Skip to content

feat(zk): add GPU ZK long-run tests and CI workflow#3453

Draft
pdroalves wants to merge 1 commit intomainfrom
pa/chore/zk-long-tests
Draft

feat(zk): add GPU ZK long-run tests and CI workflow#3453
pdroalves wants to merge 1 commit intomainfrom
pa/chore/zk-long-tests

Conversation

@pdroalves
Copy link
Copy Markdown
Contributor

closes: https://github.com/zama-ai/tfhe-rs-internal/issues/1372

PR content/description

Check-list:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Relevant issues are marked as resolved/closed, related issues are linked in the description
  • Check for breaking changes (including serialization changes) and add them to commit message following the conventional commit specification

@cla-bot cla-bot bot added the cla-signed label Apr 7, 2026
@pdroalves pdroalves force-pushed the pa/chore/zk-long-tests branch from 778b322 to 5f8fc4e Compare April 7, 2026 19:55
@zama-bot zama-bot removed the approved label Apr 7, 2026
Copy link
Copy Markdown
Contributor

@andrei-stoian-zama andrei-stoian-zama left a comment

Choose a reason for hiding this comment

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

I see this output:




running 1 test
test gpu::tests::prove_verify_stress::test_pke_v2_gpu_cpu_equivalence_long_run ... test_pke_v2_gpu_cpu_equivalence_long_run: base_seed=0x7ca2d9fd80287902, rounds=3
  round 0/3: seed=0x61bbcfdbee87953a
  round 1/3: seed=0x2a5b618e3fcba7e0
  round 2/3: seed=0xce7587440ec88f6d
ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 54 filtered out; finished in 505.59s

   Doc-tests tfhe_zk_pok

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Is this ok ? only 3 rounds of one test are run ?

can't we group this with some other workflow ? we're adding more CI costs just for 6 minutes of tests

thread_rng().gen()
}

/// Run one full GPU-vs-CPU equivalence sweep for a given seed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this comment isn't very clear. the values in the comment may change. the comment should explain what the function does not give the constants used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

/// they agree.
#[test]
fn test_pke_v2_gpu_cpu_equivalence() {
let seed: u64 = thread_rng().gen();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why don't we allow to use the user supplied seed here? why print the seed if we can't reproduce with it ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Which user supplied seed?

The seed print was once requested by @nsarlin-zama. In case some test fails we can easily reproduce the execution path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if we print the seed we may want to re-use it easily through "TFHE_RS_LONGRUN_TESTS_SEED", why don't we use that here ?


/// Multi-seed long-run variant of the GPU/CPU equivalence test.
///
/// Repeats the full sweep (3 CRS variants x 32 invalid-witness flags
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the comment is too verbose. no need to explain environment variables again

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@pdroalves pdroalves force-pushed the pa/chore/zk-long-tests branch from 5f8fc4e to e0f2e3f Compare April 8, 2026 15:00
@pdroalves
Copy link
Copy Markdown
Contributor Author

@andrei-stoian-zama I removed most of the comments. Check again, please.

@pdroalves
Copy link
Copy Markdown
Contributor Author

pdroalves commented Apr 8, 2026

@andrei-stoian-zama I don't know why you got only 3 runs. Here I see 20.

➜  zk-long-tests git:(pa/chore/zk-long-tests) ✗ make test_integer_zk_experimental_long_run_gpu 
RUSTFLAGS="-C target-cpu=native" cargo test --profile release \
	-p tfhe-zk-pok --features experimental,gpu-experimental -- \
	test_pke_v2_gpu_cpu_equivalence_long_run --test-threads=1 --nocapture
   Compiling tfhe-cuda-backend v0.14.0 (/home/zama/Code/worktree/zk-long-tests/backends/tfhe-cuda-backend)
   Compiling tfhe-safe-serialize v0.1.0 (/home/zama/Code/worktree/zk-long-tests/utils/tfhe-safe-serialize)
   Compiling zk-cuda-backend v0.1.0 (/home/zama/Code/worktree/zk-long-tests/backends/zk-cuda-backend)
   Compiling tfhe-zk-pok v0.8.1 (/home/zama/Code/worktree/zk-long-tests/tfhe-zk-pok)
    Finished `release` profile [optimized] target(s) in 1m 31s
     Running unittests src/lib.rs (target/release/deps/tfhe_zk_pok-87f34bb3a8b87d8e)

running 1 test
test gpu::tests::prove_verify_stress::test_pke_v2_gpu_cpu_equivalence_long_run ... test_pke_v2_gpu_cpu_equivalence_long_run: base_seed=0x42140705ecf06134, rounds=20
  round 0/20: seed=0xedf04fa57d7e8096
  round 1/20: seed=0xc324af2d510cccea
  round 2/20: seed=0x29b5a233e97efed
  round 3/20: seed=0x586b8903a1d2caf2
  round 4/20: seed=0x6afbbe1eb01672f9

I'm not familiar with the other long run tests. Which one do you think would fit this test?

on:
workflow_dispatch:
schedule:
- cron: "0 20 * * *"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's only run it on Mondays (integer long run will run the same way)

workflow_dispatch:
schedule:
- cron: "0 20 * * *"
pull_request:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please use an appropriate "should_run" filter - only changes to ZK trigger it

});
}

let is_minimal =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if it's set and not "TRUE" then please assert. otherwise we'll make mistakes with the syntax

/// they agree.
#[test]
fn test_pke_v2_gpu_cpu_equivalence() {
let seed: u64 = thread_rng().gen();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if we print the seed we may want to re-use it easily through "TFHE_RS_LONGRUN_TESTS_SEED", why don't we use that here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants