Skip to content

fix[next]: avoid name clash between nanobind wrapper timers and program parameters - #2915

Open
havogt wants to merge 1 commit into
GridTools:mainfrom
havogt:f76-timer-names
Open

havogt wants to merge 1 commit into
GridTools:mainfrom
havogt:f76-timer-names

Conversation

@havogt

@havogt havogt commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

The nanobind wrapper generated for gtfn programs declared timer locals start and stop in the exec_info branch. A program parameter named start was shadowed by the timer inside the wrapped call, so the bindings failed to compile (cannot convert 'start' (type 'std::chrono::time_point<...>') to type 'int32_t').

Fix: rename the timers to _gt4py_start / _gt4py_stop, matching the existing _gt4py_return local.

Test: test_domain.py gains programs with domain-bound parameters named start/stop and stop alone. The first fails on gtfn.run_gtfn without the fix; both pass on all backends with it.

@havogt
havogt marked this pull request as ready for review September 23, 2026 19:37
@havogt
havogt requested a balanced review from Copilot September 23, 2026 19:37

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.

Copilot review overview

🟡 Changes recommended

Fixed timer names can still collide with valid parameters such as _gt4py_start.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Updates nanobind timer locals to reduce clashes with program parameters and adds regression coverage.

Changes:

  • Prefixes generated timer names with _gt4py_.
  • Adds domain-bound parameter tests for start and stop.
File Description
nanobind.py Renames generated timer locals.
test_domain.py Adds parameter-name regression tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
else {
auto start = std::chrono::high_resolution_clock::now();
auto _gt4py_start = std::chrono::high_resolution_clock::now();
@havogt
havogt requested a review from tehrengruber September 24, 2026 09:36
@havogt

havogt commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@tehrengruber What's your feeling about the convention? I am ok with the prefix and implicitly forbidding users calling their parameter _gt4py_something.

This branch has not been deployed

No deployments
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