Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ markers = [
'requires_atlas: tests that require `atlas4py` bindings package',
'requires_dace: tests that require `dace` package',
'requires_gpu: tests that require a NVidia GPU (`cupy` and `cudatoolkit` are required)',
'requires_jax: tests that require `jax` package',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unrelated fix that I sneak in...

'uses_applied_shifts: tests that require backend support for applied-shifts',
'uses_can_deref: tests that require backend support for can_deref builtin function',
'uses_composite_shifts: tests that use composite shifts in unstructured domain',
Expand Down
8 changes: 8 additions & 0 deletions src/gt4py/next/otf/compiled_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,14 @@ def _compile_variant(
# key computed here
call_key: CompiledProgramsKey | None = None,
) -> None:
if __debug__:
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional suggestion: since this code has nothing to do with the compilation itself, we could move it to the compile_variant_hook default implementation, since it kind of fits better for unrelated aspects like the metrics or this warning and will have the same effect....

warnings.warn(
"Python is not running in optimized mode, which may impact performance when using a"
" compiled backend. Consider running with `python -O` or setting the environment"
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The warning text says it may impact performance when using a “compiled backend”, but this code path runs for any non-embedded backend, including pure-Python backends like roundtrip (see src/gt4py/next/program_processors/runners/roundtrip.py). Consider rewording to “non-embedded backend” (or only emitting for truly compiled backends) to avoid misleading users.

Suggested change
" compiled backend. Consider running with `python -O` or setting the environment"
" non-embedded backend. Consider running with `python -O` or setting the environment"

Copilot uses AI. Check for mistakes.
" variable `PYTHONOPTIMIZE=1`.",
stacklevel=2,
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

With stacklevel=2 this warning will typically point at an internal call site in compiled_program.py (e.g., the _compile_variant caller) rather than the public API entry points (Program.__call__ / Program.compile) that users interact with. Consider increasing the stacklevel so the warning location is more actionable (and remains stable across call sites).

Suggested change
stacklevel=2,
stacklevel=3,

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@havogt can you check if this suggestion make sense? I don't know by heart right now...

)

if not common.is_offset_provider(offset_provider):
if common.is_offset_provider_type(offset_provider):
raise ValueError(
Expand Down
Loading