Skip to content

fix[next-dace]: Ignore guid in SDFG fingerprint#2704

Open
edopao wants to merge 4 commits into
GridTools:mainfrom
edopao:det/cache-key-ignore-guid
Open

fix[next-dace]: Ignore guid in SDFG fingerprint#2704
edopao wants to merge 4 commits into
GridTools:mainfrom
edopao:det/cache-key-ignore-guid

Conversation

@edopao

@edopao edopao commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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_folder from DaCeCompilationArtifact, because not used.

Co-authored-by: Hannes Vogt

Hannes Vogt and others added 3 commits July 9, 2026 15:17
…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>
@edopao edopao changed the title fix[next-dace]: Ignore guid in SDFG fingerprint fix[next-dace]: Ignore guid in SDFG fingerprint Jul 10, 2026
@edopao
edopao requested review from Copilot and havogt July 10, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 guid keys from the SDFG JSON object before storing it in ProgramSource.source_code (translation stage).
  • Add a unit test that verifies ProgramSource.source_code is unchanged under guid perturbations.
  • Remove build_folder from DaCeCompilationArtifact and 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants