Skip to content

Commit

Permalink
Merge branch 'main' into withtag
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener authored Jan 10, 2025
2 parents 7b60f42 + 82634b7 commit da547b6
Show file tree
Hide file tree
Showing 116 changed files with 2,225 additions and 1,945 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ jobs:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
EXTRA_INSTALL="mypy pytest types-colorama types-Pygments"
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
build_py_project_in_conda_env
python -m pip install mypy
./run-mypy.sh
pytest:
Expand Down Expand Up @@ -194,9 +195,9 @@ jobs:
cd /home/firedrake/firedrake/src/firedrake
# patch so exception messages get shown
curl -L https://gist.githubusercontent.com/inducer/17d7134ace215f0df1f3627eac4195c7/raw/63edfaf2ec8bf06987896569a4f24264df490e9e/firedrake-debug-patch.diff | patch -p1
curl -L https://gist.githubusercontent.com/inducer/17d7134ace215f0df1f3627eac4195c7/raw/ec5470a7d8587b6e1f336f3ef1d0ece5e26f236a/firedrake-debug-patch.diff | patch -p1
pytest --tb=native -rsxw --durations=10 -m 'not parallel' tests/multigrid/
pytest --tb=native -rsxw --durations=10 tests/firedrake/regression -k "poisson_strong or stokes_mini or dg_advection"
validate_cff:
name: Validate CITATION.cff
Expand Down
3 changes: 1 addition & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,10 @@ Ruff:

Mypy:
script: |
EXTRA_INSTALL="pybind11 numpy"
EXTRA_INSTALL="mypy pybind11 numpy types-colorama types-Pygments"
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
build_py_project_in_venv
python -m pip install mypy
./run-mypy.sh
tags:
- python3
Expand Down
23 changes: 0 additions & 23 deletions MANIFEST.in

This file was deleted.

3 changes: 1 addition & 2 deletions contrib/c-integer-semantics.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ def main():
func.argtypes = [ctypes.c_longlong, ctypes.c_longlong]
func.restype = ctypes.c_longlong

cdiv = int_exp.cdiv # noqa
cmod = int_exp.cmod # noqa
cmod = int_exp.cmod
int_floor_div = int_exp.loopy_floor_div_int64
int_floor_div_pos_b = int_exp.loopy_floor_div_pos_b_int64
int_mod_pos_b = int_exp.loopy_mod_pos_b_int64
Expand Down
6 changes: 3 additions & 3 deletions contrib/mem-pattern-explorer/pattern_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, gsize, lsize, subgroup_size=32, decay_constant=0.75):

self.arrays = []

def l(self, index): # noqa: E741,E743
def l(self, index): # noqa: E743
subscript = [np.newaxis] * self.ind_length
subscript[len(self.gsize) + index] = slice(None)

Expand Down Expand Up @@ -147,7 +147,7 @@ def get_plot_data(self):
div_ceil(nelements, self.elements_per_row),
self.elements_per_row,)
shaped_array = np.zeros(
base_shape + (self.nattributes,),
(*base_shape, self.nattributes),
dtype=np.float32)
shaped_array.reshape(-1, self.nattributes)[:nelements] = self.array

Expand All @@ -160,7 +160,7 @@ def get_plot_data(self):
else:
subgroup.fill(1)

rgb_array = np.zeros(base_shape + (3,))
rgb_array = np.zeros((*base_shape, 3))
if 1:
if len(self.ctx.gsize) > 1:
# g.0 -> red
Expand Down
34 changes: 10 additions & 24 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from urllib.request import urlopen


_conf_url = "https://raw.githubusercontent.com/inducer/sphinxconfig/main/sphinxconfig.py" # noqa
_conf_url = "https://raw.githubusercontent.com/inducer/sphinxconfig/main/sphinxconfig.py"
with urlopen(_conf_url) as _inf:
exec(compile(_inf.read(), _conf_url, "exec"), globals())

Expand Down Expand Up @@ -35,20 +35,6 @@
"pyrsistent": ("https://pyrsistent.readthedocs.io/en/latest/", None),
}

# Some modules need to import things just so that sphinx can resolve symbols in
# type annotations. Often, we do not want these imports (e.g. of PyOpenCL) when
# in normal use (because they would introduce unintended side effects or hard
# dependencies). This flag exists so that these imports only occur during doc
# build. Since sphinx appears to resolve type hints lexically (as it should),
# this needs to be cross-module (since, e.g. an inherited arraycontext
# docstring can be read by sphinx when building meshmode, a dependent package),
# this needs a setting of the same name across all packages involved, that's
# why this name is as global-sounding as it is.
import sys


sys._BUILDING_SPHINX_DOCS = True

nitpicky = True

nitpick_ignore_regex = [
Expand All @@ -62,13 +48,13 @@
["py:class", r"immutables\.(.+)"],

# Reference not found from "<unknown>"? I'm not even sure where to look.
["py:class", r"Expression"],
["py:class", r"ExpressionNode"],

# Type aliases
["py:class", r"InameStr"],
["py:class", r"ConcreteCallablesTable"],
["py:class", r"LoopNestTree"],
["py:class", r"LoopTree"],
["py:class", r"ToLoopyTypeConvertible"],
["py:class", r"ToStackMatchConvertible"],
]

autodoc_type_aliases = {
"ToLoopyTypeConvertible": "ToLoopyTypeConvertible",
"ExpressionT": "ExpressionT",
"InameStr": "InameStr",
"ShapeType": "ShapeType",
"StridesType": "StridesType",
}
10 changes: 2 additions & 8 deletions doc/ref_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ consist of arithmetic operations and calls to functions.
If the outermost operation of the RHS expression is a function call,
the RHS value may be a tuple, and multiple (still scalar) arrays appear
as LHS values. (This is the only sense in which tuple types are supported.)
Each statement is parametrized by zero or more loop variables ("inames").
Each statement is parameterized by zero or more loop variables ("inames").
A statement is executed once for each integer point defined by the domain
forest for the iname tuple given for that statement
(:attr:`loopy.InstructionBase.within_inames`). Each execution of a
Expand Down Expand Up @@ -656,8 +656,6 @@ Helper values

.. {{{
.. autoclass:: auto

.. autoclass:: UniqueName

.. autoclass:: Optional
Expand Down Expand Up @@ -693,11 +691,7 @@ The Kernel Object
Do not create :class:`LoopKernel` objects directly. Instead, refer to
:ref:`creating-kernels`.

.. autoclass:: LoopKernel

.. autoclass:: KernelState
:members:
:undoc-members:
.. automodule:: loopy.kernel

Implementation Details: The Base Array
--------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1681,15 +1681,15 @@ Each line of output will look roughly like::
data type accessed.

- lid_strides: A :class:`dict` of **{** :class:`int` **:**
:class:`pymbolic.primitives.Expression` or :class:`int` **}** that specifies
:data:`~pymbolic.typing.Expression` or :class:`int` **}** that specifies
local strides for each local id in the memory access index. Local ids not
found will not be present in ``lid_strides.keys()``. Uniform access (i.e.
work-items within a sub-group access the same item) is indicated by setting
``lid_strides[0]=0``, but may also occur when no local id 0 is found, in
which case the 0 key will not be present in lid_strides.

- gid_strides: A :class:`dict` of **{** :class:`int` **:**
:class:`pymbolic.primitives.Expression` or :class:`int` **}** that specifies
:data:`~pymbolic.typing.Expression` or :class:`int` **}** that specifies
global strides for each global id in the memory access index. Global ids not
found will not be present in ``gid_strides.keys()``.

Expand Down
2 changes: 1 addition & 1 deletion examples/python/ispc-stream-harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def transform(knl, vars, stream_dtype):

knl = lp.add_and_infer_dtypes(knl, dict.fromkeys(vars, stream_dtype))

knl = lp.set_argument_order(knl, vars + ["n"])
knl = lp.set_argument_order(knl, [*vars, "n"])

return knl

Expand Down
7 changes: 5 additions & 2 deletions loopy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations


__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"

__license__ = """
Expand Down Expand Up @@ -478,7 +481,7 @@ def register_preamble_generators(kernel: LoopKernel, preamble_generators):
"and would thus disrupt loopy's caches"
% pgen)

new_pgens = (pgen,) + new_pgens
new_pgens = (pgen, *new_pgens)

return kernel.copy(preamble_generators=new_pgens)

Expand All @@ -496,7 +499,7 @@ def register_symbol_manglers(kernel, manglers):
"and would disrupt loopy's caches"
% m)

new_manglers = (m,) + new_manglers
new_manglers = (m, *new_manglers)

return kernel.copy(symbol_manglers=new_manglers)

Expand Down
2 changes: 2 additions & 0 deletions loopy/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import loopy.cli


Expand Down
35 changes: 19 additions & 16 deletions loopy/auto_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations


__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"

__license__ = """
Expand All @@ -21,7 +24,7 @@
"""

from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional, Tuple
from typing import TYPE_CHECKING
from warnings import warn

import numpy as np
Expand Down Expand Up @@ -77,26 +80,26 @@ def fill_rand(ary):
@dataclass
class TestArgInfo:
name: str
ref_array: "cla.Array"
ref_storage_array: "cla.Array"
ref_array: cla.Array
ref_storage_array: cla.Array

ref_pre_run_array: "cla.Array"
ref_pre_run_storage_array: "cla.Array"
ref_pre_run_array: cla.Array
ref_pre_run_storage_array: cla.Array

ref_shape: Tuple[int, ...]
ref_strides: Tuple[int, ...]
ref_shape: tuple[int, ...]
ref_strides: tuple[int, ...]
ref_alloc_size: int
ref_numpy_strides: Tuple[int, ...]
ref_numpy_strides: tuple[int, ...]
needs_checking: bool

# The attributes below are being modified in make_args, hence this dataclass
# cannot be frozen.
test_storage_array: Optional["cla.Array"] = None
test_array: Optional["cla.Array"] = None
test_shape: Optional[Tuple[int, ...]] = None
test_strides: Optional[Tuple[int, ...]] = None
test_numpy_strides: Optional[Tuple[int, ...]] = None
test_alloc_size: Optional[Tuple[int, ...]] = None
test_storage_array: cla.Array | None = None
test_array: cla.Array | None = None
test_shape: tuple[int, ...] | None = None
test_strides: tuple[int, ...] | None = None
test_numpy_strides: tuple[int, ...] | None = None
test_alloc_size: tuple[int, ...] | None = None


# {{{ "reference" arguments
Expand Down Expand Up @@ -410,12 +413,12 @@ def auto_test_vs_ref(
if ref_entrypoint is None:
if len(ref_prog.entrypoints) != 1:
raise LoopyError("Unable to guess entrypoint for ref_prog.")
ref_entrypoint = list(ref_prog.entrypoints)[0]
ref_entrypoint = next(iter(ref_prog.entrypoints))

if test_entrypoint is None:
if len(test_prog.entrypoints) != 1:
raise LoopyError("Unable to guess entrypoint for ref_prog.")
test_entrypoint = list(test_prog.entrypoints)[0]
test_entrypoint = next(iter(test_prog.entrypoints))

ref_prog = lp.preprocess_kernel(ref_prog)
test_prog = lp.preprocess_kernel(test_prog)
Expand Down
Loading

0 comments on commit da547b6

Please sign in to comment.