Skip to content

Ruf 069#982

Merged
inducer merged 2 commits intomainfrom
ruf-069
Feb 15, 2026
Merged

Ruf 069#982
inducer merged 2 commits intomainfrom
ruf-069

Conversation

@inducer
Copy link
Owner

@inducer inducer commented Feb 15, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 15, 2026 14:46
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

This PR addresses Ruff linting rule RUF069 warnings by adding suppression comments and reorganizes imports in loopy/target/execution.py to improve type checking organization.

Changes:

  • Adds # noqa: RUF069 suppressions to 7 test assertions to silence warnings about float literal clarity and division operations
  • Moves type-checking-only imports to the TYPE_CHECKING block in loopy/target/execution.py
  • Adds explicit type annotations to ExecutorBase class attributes

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
test/test_target.py Adds 4 RUF069 suppressions for float literals with trailing decimal points (2., 7., 5.)
test/test_statistics.py Adds 2 RUF069 suppressions for integer expressions using true division operator
test/test_c_execution.py Adds 1 RUF069 suppression for integer expression using true division operator
loopy/target/execution.py Reorganizes imports: moves Expression, ArrayArg, _ArraySeparationInfo to TYPE_CHECKING block, corrects auto import source, adds Set import, and adds type annotations to ExecutorBase attributes

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


assert a.get() == 1
assert b.get() == 2.
assert b.get() == 2. # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider fixing the float literal. Replace 2. with 2.0 for better readability and clarity. The RUF069 rule exists to ensure float literals are written in a clear, consistent style.

Copilot uses AI. Check for mistakes.
_evt, out = knl(queue, y=y, x=x)
assert out[0] is x
assert x[0] == 7.
assert x[0] == 7. # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider fixing the float literal. Replace 7. with 7.0 for better readability and clarity. The RUF069 rule exists to ensure float literals are written in a clear, consistent style.

Copilot uses AI. Check for mistakes.
_evt, out = knl(queue, y=y, x=x)
assert out[0] is x
assert x[0] == 7.
assert x[0] == 7. # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider fixing the float literal. Replace 7. with 7.0 for better readability and clarity. The RUF069 rule exists to ensure float literals are written in a clear, consistent style.

Copilot uses AI. Check for mistakes.
_evt, out = knl(queue, y=y, x=x)
assert out[0] is x
assert x[0] == 5.
assert x[0] == 5. # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider fixing the float literal. Replace 5. with 5.0 for better readability and clarity. The RUF069 rule exists to ensure float literals are written in a clear, consistent style.

Copilot uses AI. Check for mistakes.
assert len(sync_map) == 2
assert sync_map.filter_by(kind="kernel_launch").eval_and_sum(params) == 1
assert sync_map.filter_by(kind="barrier_local").eval_and_sum(params) == 2*m/bsize
assert sync_map.filter_by(kind="barrier_local").eval_and_sum(params) == 2*m/bsize # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider clarifying the division intent. If integer division is intended, use // operator (2*m//bsize). If float division is intended, consider using a float literal (2.0*m/bsize) to make the intent explicit.

Suggested change
assert sync_map.filter_by(kind="barrier_local").eval_and_sum(params) == 2*m/bsize # noqa: RUF069
assert sync_map.filter_by(kind="barrier_local").eval_and_sum(params) == 2*m//bsize

Copilot uses AI. Check for mistakes.

# (count-per-sub-group)*n_subgroups
assert local_mem_s == m*2/bsize*n_subgroups
assert local_mem_s == m*2/bsize*n_subgroups # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider clarifying the division intent. If integer division is intended, use // operator (m*2//bsize*n_subgroups). If float division is intended, consider using a float literal (m*2.0/bsize*n_subgroups) to make the intent explicit.

Suggested change
assert local_mem_s == m*2/bsize*n_subgroups # noqa: RUF069
assert local_mem_s == m*2//bsize*n_subgroups

Copilot uses AI. Check for mistakes.
target=lp.ExecutableCTarget())(n=n)

assert out == (n*(n-1)/2)
assert out == (n*(n-1)/2) # noqa: RUF069
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Instead of suppressing RUF069, consider clarifying the division intent. If integer division is intended, use // operator (n*(n-1)//2). If float division is intended, consider using a float literal (n*(n-1)/2.0) to make the intent explicit.

Suggested change
assert out == (n*(n-1)/2) # noqa: RUF069
assert out == (n*(n-1)//2)

Copilot uses AI. Check for mistakes.
@inducer inducer merged commit 248b47c into main Feb 15, 2026
23 checks passed
@inducer inducer deleted the ruf-069 branch February 15, 2026 19:16
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.

1 participant