Skip to content

fix[next]: Include compile-time arguments in fingerprint#2537

Open
SF-N wants to merge 2 commits intoGridTools:mainfrom
SF-N:fix_cache_key
Open

fix[next]: Include compile-time arguments in fingerprint#2537
SF-N wants to merge 2 commits intoGridTools:mainfrom
SF-N:fix_cache_key

Conversation

@SF-N
Copy link
Contributor

@SF-N SF-N commented Mar 17, 2026

This pull request refactors the way unique hashes are generated for compilable programs and adds a new unit test to ensure hash uniqueness for different precision arguments.

  • The fingerprint_compilable_program function in src/gt4py/next/otf/stages.py now generates the hash using the entire args object instead of individually hashing specific components like offset_provider and column_axis.

  • A new unit test, test_different_precisions, was added to verify that changing the precision of a scalar argument results in a different fingerprint hash.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors compilable-program fingerprinting to include full compile-time arguments (to avoid hash collisions) and adds a unit test ensuring different scalar precisions produce different fingerprints.

Changes:

  • Update fingerprint_compilable_program to hash (program IR fingerprint, compile-time args) instead of selected fields.
  • Add unit test validating fingerprint uniqueness for different scalar precisions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/next_tests/unit_tests/iterator_tests/test_ir.py Adds a regression test ensuring different precision compile-time args change the fingerprint.
src/gt4py/next/otf/stages.py Refactors fingerprint input to include the entire CompileTimeArgs object.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 41 to 46
program_hash = utils.content_hash(
(
program.fingerprint(),
sorted(offset_provider.items(), key=lambda el: el[0]),
column_axis,
program_def.data.fingerprint(),
program_def.args,
)
)
Comment on lines +12 to +13
from gt4py.next.otf import arguments, definitions, stages
from gt4py.next.type_system import type_specifications as ts
assert node1.fingerprint() != node3.fingerprint()


def test_different_precisions():
tehrengruber added a commit to tehrengruber/gt4py that referenced this pull request Mar 18, 2026
tehrengruber added a commit to tehrengruber/gt4py that referenced this pull request Mar 18, 2026
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