fix[next-dace]: Ignore guid in SDFG fingerprint#2704
Open
edopao wants to merge 4 commits into
Open
Conversation
…cache key `sdfg.to_json()` embeds a per-element `guid`, and the compile cache folder name is a fingerprint of the `ProgramSource`, so the cache key depends on the order in which SDFG elements happened to be created. Two structurally identical lowerings of the same program then miss each other's cached build. guids do not reach the generated code, and `SDFG.from_json()` assigns fresh ids, so they are dead weight in the cached program source. The top-level `hash` (`SDFG.hash_sdfg()`) is kept: it already excludes guids and summarises structure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
guid in SDFG fingerprint
There was a problem hiding this comment.
Pull request overview
This PR improves determinism of the DaCe backend translation output by excluding non-deterministic SDFG element guid fields from the serialized SDFG representation used for cache keying, ensuring structurally identical lowerings can share compilation cache artifacts. It also simplifies the compilation artifact API by removing an unused build_folder field.
Changes:
- Strip
guidkeys from the SDFG JSON object before storing it inProgramSource.source_code(translation stage). - Add a unit test that verifies
ProgramSource.source_codeis unchanged underguidperturbations. - Remove
build_folderfromDaCeCompilationArtifactand update related unit tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/gt4py/next/program_processors/runners/dace/workflow/translation.py |
Drops guid fields from serialized SDFG JSON to stabilize translation output for caching. |
src/gt4py/next/program_processors/runners/dace/workflow/compilation.py |
Removes unused build_folder from DaCeCompilationArtifact. |
tests/next_tests/unit_tests/program_processor_tests/runners_tests/dace_tests/test_dace_translation.py |
Adds regression test ensuring translation output invariance under guid changes. |
tests/next_tests/unit_tests/program_processor_tests/runners_tests/dace_tests/test_dace_compilation.py |
Updates tests for artifact field removal and strengthens SDFG validity in test construction. |
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.
The source code generated by the translation stage should be byte identical, for the same input IR program. In case of lowered SDFGs, the JSON representation produced by the translation stage contains
guids which are not deterministic. These IDs should be excluded from the string containing the JSON source code, in order not to influence the DaCe compilation cache key.The random
guids could be a problem in multi-rank deployment: multiple ranks could try compiling the same gt4py program. This PR allows the ranks to produce exactly the same compilable program, thus using the same cache key and compilation artifact.Additional change: remove
build_folderfromDaCeCompilationArtifact, because not used.Co-authored-by: Hannes Vogt