Skip to content

Commit d6be619

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents bd4ac1b + ebb9d3c commit d6be619

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1624
-6214
lines changed

.basedpyright/baseline.json

Lines changed: 853 additions & 5429 deletions
Large diffs are not rendered by default.

.github/workflows/autopush.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: startsWith(github.repository, 'inducer/')
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v5
1414
- run: |
1515
curl -L -O https://tiker.net/ci-support-v0
1616
. ./ci-support-v0

.github/workflows/ci.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
name: Ruff
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v5
2020
with:
2121
submodules: true
22-
- uses: astral-sh/setup-uv@v6
22+
- uses: astral-sh/setup-uv@v7
2323
- name: "Main Script"
2424
run: |
2525
uv run --only-dev ruff check
@@ -28,13 +28,13 @@ jobs:
2828
name: Typos
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v5
3232
- uses: crate-ci/typos@master
3333

3434
basedpyright:
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@v5
3838
- name: "Main Script"
3939
run: |
4040
EXTRA_INSTALL="pytest types-colorama types-Pygments scipy-stubs"
@@ -54,7 +54,7 @@ jobs:
5454
matrix:
5555
os: [ubuntu-latest, macos-latest]
5656
steps:
57-
- uses: actions/checkout@v4
57+
- uses: actions/checkout@v5
5858
- name: "Main Script"
5959
run: |
6060
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/build-and-test-py-project-within-miniconda.sh
@@ -64,7 +64,7 @@ jobs:
6464
name: Conda Pytest with Intel CL
6565
runs-on: ubuntu-latest
6666
steps:
67-
- uses: actions/checkout@v4
67+
- uses: actions/checkout@v5
6868
- name: "Main Script"
6969
run: |
7070
curl -L -O https://raw.githubusercontent.com/illinois-scicomp/machine-shop-maintenance/main/install-intel-icd.sh
@@ -83,7 +83,7 @@ jobs:
8383
name: Conda Pytest without arg check
8484
runs-on: ubuntu-latest
8585
steps:
86-
- uses: actions/checkout@v4
86+
- uses: actions/checkout@v5
8787
- name: "Main Script"
8888
run: |
8989
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/build-and-test-py-project-within-miniconda.sh
@@ -94,7 +94,7 @@ jobs:
9494
name: Conda Pytest Twice (for cache behavior)
9595
runs-on: ubuntu-latest
9696
steps:
97-
- uses: actions/checkout@v4
97+
- uses: actions/checkout@v5
9898
- name: "Main Script"
9999
run: |
100100
# This test makes sure that loopy can run with kernels loaded from disk cache.
@@ -112,7 +112,7 @@ jobs:
112112
name: Conda Examples
113113
runs-on: ubuntu-latest
114114
steps:
115-
- uses: actions/checkout@v4
115+
- uses: actions/checkout@v5
116116
- name: "Main Script"
117117
run: |
118118
curl -L -O https://tiker.net/ci-support-v0
@@ -130,9 +130,9 @@ jobs:
130130
name: Documentation
131131
runs-on: ubuntu-latest
132132
steps:
133-
- uses: actions/checkout@v4
133+
- uses: actions/checkout@v5
134134
-
135-
uses: actions/setup-python@v5
135+
uses: actions/setup-python@v6
136136
with:
137137
python-version: '3.x'
138138
- name: "Main Script"
@@ -150,7 +150,7 @@ jobs:
150150
name: Tests for downstream project ${{ matrix.downstream_project }}
151151
runs-on: ubuntu-latest
152152
steps:
153-
- uses: actions/checkout@v4
153+
- uses: actions/checkout@v5
154154
- name: "Main Script"
155155
env:
156156
DOWNSTREAM_PROJECT: ${{ matrix.downstream_project }}
@@ -194,15 +194,14 @@ jobs:
194194
# patch so exception messages get shown
195195
curl -L https://gist.githubusercontent.com/inducer/17d7134ace215f0df1f3627eac4195c7/raw/ec5470a7d8587b6e1f336f3ef1d0ece5e26f236a/firedrake-debug-patch.diff | patch -p1
196196
197-
sed -i 's/@mpiexec/@mpiexec --oversubscribe/' Makefile
198-
make check
197+
firedrake-check --mpiexec 'mpiexec --oversubscribe -n'
199198
200199
validate_cff:
201200
name: Validate CITATION.cff
202201
runs-on: ubuntu-latest
203202
steps:
204-
- uses: actions/checkout@v4
205-
- uses: actions/setup-python@v5
203+
- uses: actions/checkout@v5
204+
- uses: actions/setup-python@v6
206205
- run: |
207206
pip install cffconvert
208207
cffconvert -i CITATION.cff --validate

TODO

Lines changed: 0 additions & 4 deletions
This file was deleted.

contrib/mem-pattern-explorer/pattern_vis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def data_gen():
5858
for _ in f():
5959
self.tick()
6060

61-
for ary, plot in zip(self.arrays, plots):
61+
for ary, plot in zip(self.arrays, plots, strict=True):
6262
plot.set_array(ary.get_plot_data())
6363

6464
fig.canvas.draw()
@@ -85,7 +85,7 @@ def __init__(self, ctx, name, shape, strides, elements_per_row=None):
8585
if elements_per_row is None:
8686
if len(shape) > 1:
8787
minstride = min(strides)
88-
for sh_i, st_i in zip(shape, strides):
88+
for sh_i, st_i in zip(shape, strides, strict=True):
8989
if st_i == minstride:
9090
elements_per_row = sh_i
9191
break
@@ -119,7 +119,7 @@ def reshape_ind(ind):
119119

120120
lin_index = sum(
121121
ind_i * stride_i
122-
for ind_i, stride_i in zip(index, self.strides))
122+
for ind_i, stride_i in zip(index, self.strides, strict=True))
123123

124124
if not isinstance(lin_index, np.ndarray):
125125
subscript = [np.newaxis] * self.ctx.ind_length

examples/fortran/matmul-driver.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import numpy.linalg as la
33

44
import pyopencl as cl
5-
import pyopencl.array
6-
import pyopencl.clrandom
5+
import pyopencl.array as cla
6+
import pyopencl.clrandom as clrandom
77

88
import loopy as lp
99

@@ -21,11 +21,11 @@ def main():
2121
queue = cl.CommandQueue(ctx)
2222

2323
n = 2048
24-
a = cl.array.empty(queue, (n, n), dtype=np.float64, order="F")
25-
b = cl.array.empty(queue, (n, n), dtype=np.float64, order="F")
26-
c = cl.array.zeros(queue, (n, n), dtype=np.float64, order="F")
27-
cl.clrandom.fill_rand(a)
28-
cl.clrandom.fill_rand(b)
24+
a = cla.empty(queue, (n, n), dtype=np.float64, order="F")
25+
b = cla.empty(queue, (n, n), dtype=np.float64, order="F")
26+
c = cla.zeros(queue, (n, n), dtype=np.float64, order="F")
27+
clrandom.fill_rand(a)
28+
clrandom.fill_rand(b)
2929

3030
dgemm = lp.set_options(dgemm, write_code=True)
3131

examples/python/ispc-stream-harness.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ctypes
2-
import ctypes.util
32
import os
43
from tempfile import TemporaryDirectory
54
from time import time

loopy/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,9 @@ def make_copy_kernel(new_dim_tags, old_dim_tags=None):
580580
command_indices = ", ".join(indices)
581581
bounds = " and ".join(
582582
f"0<={ind}<{shape_i}"
583-
for ind, shape_i in zip(indices, shape))
583+
for ind, shape_i in zip(indices, shape, strict=True))
584584

585-
set_str = "{{[{}]: {} }}".format(
586-
command_indices,
587-
bounds
588-
)
585+
set_str = f"{{[{command_indices}]: {bounds} }}"
589586
result = make_kernel(set_str,
590587
"output[%s] = input[%s]"
591588
% (command_indices, command_indices),
@@ -659,7 +656,7 @@ def make_einsum(spec, arg_names, **knl_creation_kwargs):
659656
lhs = var("out")[tuple(var(i) for i in out_spec)]
660657

661658
rhs = 1
662-
for arg_name, argsp in zip(arg_names, arg_specs):
659+
for arg_name, argsp in zip(arg_names, arg_specs, strict=True):
663660
rhs = rhs * var(arg_name)[tuple(var(i) for i in argsp)]
664661

665662
if sum_indices:
@@ -694,7 +691,7 @@ def set_default_target(target: Callable[[], TargetBase] | None):
694691

695692
def _set_up_default_target():
696693
try:
697-
import pyopencl # noqa
694+
import pyopencl # noqa: F401
698695
except ImportError:
699696
from loopy.target.opencl import OpenCLTarget
700697
target = OpenCLTarget

loopy/auto_test.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def make_ref_args(kernel, queue, parameters):
158158
strides = evaluate(get_strides(arg), parameters)
159159

160160
alloc_size = sum(astrd*(alen-1) if astrd != 0 else alen-1
161-
for alen, astrd in zip(shape, strides)) + 1
161+
for alen, astrd in zip(shape, strides, strict=True)) + 1
162162

163163
if dtype is None:
164164
raise LoopyError("dtype for argument '%s' is not yet "
@@ -229,7 +229,7 @@ def make_args(kernel, queue, ref_arg_data, parameters):
229229
from loopy.kernel.data import ArrayArg, ConstantArg, ImageArg, ValueArg
230230

231231
args = {}
232-
for arg, arg_desc in zip(kernel.args, ref_arg_data):
232+
for arg, arg_desc in zip(kernel.args, ref_arg_data, strict=True):
233233
if isinstance(arg, ValueArg):
234234
arg_value = parameters[arg.name]
235235

@@ -264,7 +264,7 @@ def make_args(kernel, queue, ref_arg_data, parameters):
264264
numpy_strides = [itemsize*s for s in strides]
265265

266266
alloc_size = sum(astrd*(alen-1) if astrd != 0 else alen-1
267-
for alen, astrd in zip(shape, strides)) + 1
267+
for alen, astrd in zip(shape, strides, strict=True)) + 1
268268

269269
# use contiguous array to transfer to host
270270
host_ref_contig_array = arg_desc.ref_pre_run_storage_array.get()
@@ -429,8 +429,9 @@ def auto_test_vs_ref(
429429
raise LoopyError("ref_prog and test_prog do not have the same number "
430430
"of arguments")
431431

432-
for i, (ref_arg, test_arg) in enumerate(zip(ref_prog[ref_entrypoint].args,
433-
test_prog[test_entrypoint].args)):
432+
for i, (ref_arg, test_arg) in enumerate(
433+
zip(ref_prog[ref_entrypoint].args,
434+
test_prog[test_entrypoint].args, strict=True)):
434435
if ref_arg.name != test_arg.name:
435436
raise LoopyError("ref_prog and test_prog argument lists disagree at "
436437
"index %d (1-based)" % (i+1))
@@ -477,8 +478,8 @@ def auto_test_vs_ref(
477478
properties=cl.command_queue_properties.PROFILING_ENABLE)
478479
ref_codegen_result = lp.generate_code_v2(ref_prog)
479480

480-
logger.info("{} (ref): trying {} for the reference calculation".format(
481-
ref_entrypoint, dev))
481+
logger.info("%s (ref): trying %s for the reference calculation",
482+
ref_entrypoint, dev)
482483

483484
if not quiet and print_ref_code:
484485
print(75*"-")
@@ -513,8 +514,8 @@ def auto_test_vs_ref(
513514

514515
ref_queue.finish()
515516

516-
logger.info("{} (ref): using {} for the reference calculation".format(
517-
ref_entrypoint, dev))
517+
logger.info("%s (ref): using %s for the reference calculation",
518+
ref_entrypoint, dev)
518519
logger.info("%s (ref): run" % ref_entrypoint)
519520

520521
ref_start = time()
@@ -665,8 +666,8 @@ def auto_test_vs_ref(
665666
logger.info("%s: timing run done" % (test_entrypoint))
666667

667668
rates = ""
668-
for cnt, lbl in zip(op_count, op_label):
669-
rates += " {:g} {}/s".format(cnt/elapsed_wall, lbl)
669+
for cnt, lbl in zip(op_count, op_label, strict=True):
670+
rates += f" {cnt / elapsed_wall:g} {lbl}/s"
670671

671672
if not quiet:
672673
def format_float_or_none(v):
@@ -683,8 +684,8 @@ def format_float_or_none(v):
683684

684685
if do_check:
685686
ref_rates = ""
686-
for cnt, lbl in zip(op_count, op_label):
687-
rates += " {:g} {}/s".format(cnt/elapsed_wall, lbl)
687+
for cnt, lbl in zip(op_count, op_label, strict=True):
688+
rates += f" {cnt/elapsed_wall:g} {lbl}/s"
688689

689690
if not quiet:
690691
print("elapsed: %s s event, %s s marker-event %s s wall "
@@ -695,11 +696,12 @@ def format_float_or_none(v):
695696

696697
if do_check:
697698
ref_rates = ""
698-
for cnt, lbl in zip(op_count, op_label):
699-
ref_rates += " {:g} {}/s".format(cnt/ref_elapsed_event, lbl)
699+
for cnt, lbl in zip(op_count, op_label, strict=True):
700+
ref_rates += f" {cnt/ref_elapsed_wall:g} {lbl}/s"
701+
700702
if not quiet:
701-
print("ref: elapsed: {:g} s event, {:g} s wall{}".format(
702-
ref_elapsed_event, ref_elapsed_wall, ref_rates))
703+
print(f"ref: elapsed: {ref_elapsed_event:g}s event, "
704+
f"{ref_elapsed_wall:g} s wall{ref_rates}")
703705

704706
# }}}
705707

loopy/check.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ def map_subscript(self, expr):
339339
"Type inference did not find type of '%s'"
340340
% idx)
341341
if not type_inf_result[0].is_integral():
342-
raise LoopyError("Non-integral array indices obtained in"
343-
" {}.".format(expr))
342+
raise LoopyError(
343+
f"Non-integral array indices obtained in {expr}")
344344

345345
return self.rec(expr.aggregate)
346346

@@ -489,8 +489,8 @@ def check_multiple_tags_allowed(kernel: LoopKernel) -> None:
489489
for iname in kernel.inames.values():
490490
for comb in illegal_combinations:
491491
if len(filter_iname_tags_by_type(iname.tags, comb)) > 1:
492-
raise LoopyError("iname {} has illegal combination of "
493-
"tags: {}".format(iname.name, iname.tags))
492+
raise LoopyError(f"iname {iname.name} has illegal combination of "
493+
f"tags: {iname.tags}")
494494

495495

496496
def _check_for_double_use_of_hw_axes_inner(
@@ -612,7 +612,7 @@ def check_for_write_races(kernel: LoopKernel) -> None:
612612
for insn in kernel.instructions:
613613
for assignee_name, assignee_indices in zip(
614614
insn.assignee_var_names(),
615-
insn.assignee_subscript_deps()):
615+
insn.assignee_subscript_deps(), strict=True):
616616
assignee_inames = assignee_indices & kernel.all_inames()
617617
if not assignee_inames <= insn.within_inames:
618618
raise LoopyError(
@@ -1359,7 +1359,7 @@ def check_for_nested_base_storage(kernel: LoopKernel) -> None:
13591359

13601360
for ary in kernel.temporary_variables.values():
13611361
if ary.base_storage:
1362-
storage_array = name_to_array.get(ary.base_storage, None)
1362+
storage_array = name_to_array.get(ary.base_storage)
13631363

13641364
if storage_array is None:
13651365
raise LoopyError("Nothing known about storage array "
@@ -1716,16 +1716,16 @@ def _are_sub_array_refs_equivalent(
17161716
from pymbolic.mapper.substitutor import make_subst_func
17171717

17181718
from loopy.symbolic import SubstitutionMapper, simplify_via_aff
1719-
subst_func = make_subst_func({iname1.name: iname2
1720-
for iname1, iname2 in zip(sar1.swept_inames,
1721-
sar2.swept_inames)
1722-
})
1719+
subst_func = make_subst_func({
1720+
iname1.name: iname2
1721+
for iname1, iname2 in zip(sar1.swept_inames, sar2.swept_inames, strict=True)
1722+
})
17231723

17241724
# subst_mapper: maps swept inames from sar1 to sar2
17251725
subst_mapper = SubstitutionMapper(subst_func)
17261726

17271727
for idx1, idx2 in zip(sar1.subscript.index_tuple,
1728-
sar2.subscript.index_tuple):
1728+
sar2.subscript.index_tuple, strict=True):
17291729
subst_idx1 = subst_mapper(idx1)
17301730
assert is_arithmetic_expression(subst_idx1)
17311731
assert is_arithmetic_expression(idx2)
@@ -1991,11 +1991,9 @@ def check_implemented_domains(
19911991
iname, pt.get_coordinate_val(tp, dim).to_python()))
19921992

19931993
lines.append(
1994-
"sample point in {} but not {}: {}".format(
1995-
bigger, smaller, ", ".join(point_axes)))
1994+
f"sample point in {bigger} but not {smaller}: {point_axes}")
19961995
lines.append(
1997-
"gist of constraints in {} but not {}: {}".format(
1998-
bigger, smaller, gist_domain))
1996+
f"gist of constraints in {bigger} but not {smaller}: {gist_domain}")
19991997

20001998
if code is not None:
20011999
print(79*"-")

0 commit comments

Comments
 (0)