Infrastructure to test DaCe's codegen (in)deterministic behavior#2590
Open
kotsaloscv wants to merge 27 commits into
Open
Infrastructure to test DaCe's codegen (in)deterministic behavior#2590kotsaloscv wants to merge 27 commits into
kotsaloscv wants to merge 27 commits into
Conversation
…CD integration [WIP]
…CD integration [WIP]
…t ONLY GT4Py tests (next & cartesian)
…t ONLY GT4Py tests (next & cartesian)
…t ONLY GT4Py tests (next & cartesian)
…t ONLY GT4Py tests (next & cartesian)
Contributor
Author
|
cscs-ci run dace-determinism |
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (artifacts)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (artifacts)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (artifacts)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (artifacts)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (time limit: WIP)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (time limit: WIP)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (time limit: WIP)
Contributor
Author
|
cscs-ci run dace-determinism |
…ing CI/CD (time limit: WIP)
Contributor
Author
|
cscs-ci run dace-determinism |
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.
Adds infrastructure to detect non-determinism in gt4py's DaCe codegen. Two new parametrized nox sessions run gt4py's own DaCe test selection twice with isolated build caches, then byte-compare the generated sources between the two runs. The session is successful when the codegen is identical, fails on any content diff. Supports both
gt4py.nextandgt4py.cartesiancaches, covering thedace_cpu,dace_gpu(CUDA), and HIP backends. Driven entirely from gt4py's own nox sessions — no external repo needed.Layout
noxfile.py— two new sessions,test_cartesian_dace_determinismandtest_next_dace_determinism. Each calls a shared_run_dace_determinism_checkhelper that runs gt4py's regular DaCe pytest selection twice with the appropriate cache-isolation env vars per layout, then invokes the comparator. Taggeddace+determinism, sonox -t determinismruns every variant.scripts/dace_deterministic_codegen.py— pure-stdlib comparison library + thin argparse CLI with explicit--layout {next,cartesian}dispatch. Each layout has its own snapshot walker:<root>/<program>_<sha256>/src/{cpu,cuda}/...(HIP undersrc/cuda/hip/covered transparently).<root>/py<pyver>_<cachever>/<backend>/<test.module.path>/<Class>_<backend>_<id>/structure, comparingm_*.pyplusbindings.{cpp,cu}andcomputation.hppinside eachm_*_pyext_BUILD/.ci/cscs-ci-dace-determinism.yml— self-contained CSCS-CI pipeline entry-point (see CI section).Per-layout env vars
gt4py.nextandgt4py.cartesianhave completely separate caching subsystems with different knobs. The helper sets them per layout automatically:GT4PY_BUILD_CACHE_DIR=<run_dir>; cache lands at<run_dir>/.gt4py_cache/.GT_CACHE_ROOT=<run_dir>plusGT_CACHE_PYTEST_DIR=<run_dir>/gt_cache, and--keep-gtcachepassed to pytest. cartesian's conftest unconditionallyrmtrees its cache atpytest_sessionfinishunless that CLI flag is present (independent of the env vars), so both knobs are required.DaCe build folder mode
The check requires
DACE_compiler_build_folder_mode=development. gt4py configures DaCe toproductionby default, which strips the generated source files after compilation — leaving nothing to compare. The nox sessions set this env var automatically for both layouts; the comparator raisesNoSourceFilesObservedErrorwith an env-var hint if it ever encounters caches built without it.CI
Standalone CSCS-CI pipeline, independent from
ci/cscs-ci.yml. Pipeline registered separately asdace-determinismand triggered by whitelisted users postingcscs-ci run dace-determinismin a PR comment.allow_failure: truewhile the determinism work stabilizes — to be dropped oncemainstays green. Per-cell artifacts (_dace_deterministic_codegen/containingdiffs/andreport.txtafter the session's cleanup hook removes the raw caches) retained for 1 month.Local use