8000 Type creation by inducer · Pull Request #942 · inducer/loopy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Type creation #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all 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,762 changes: 325 additions & 1,437 deletions .basedpyright/baseline.json

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions doc/ref_internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ References

Mostly things that Sphinx (our documentation tool) should resolve but won't.

.. class:: EllipsisType

See :data:`types.EllipsisType`.

.. class:: ToTagSetConvertible

An iterable of :class:`~pytools.tag.Tag` instances, a single :class:`~pytools.tag.Tag`,
or *None*.

.. class:: ASTType

A type variable, representing an AST node. For now, either :class:`cgen.Generable`
Expand Down Expand Up @@ -102,3 +111,8 @@ Mostly things that Sphinx (our documentation tool) should resolve but won't.
.. class:: PwAff

See :class:`islpy.PwAff`.

.. class:: BasicSet

See :class:`islpy.BasicSet`.

17 changes: 10 additions & 7 deletions loopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
THE SOFTWARE.
"""

import os
from typing import TYPE_CHECKING

from pytools import strtobool

from loopy.auto_test import auto_test_vs_ref
from loopy.codegen import PreambleInfo, generate_body, generate_code, generate_code_v2
Expand Down Expand Up @@ -213,6 +217,10 @@
from loopy.version import MOST_RECENT_LANGUAGE_VERSION, VERSION


if TYPE_CHECKING:
from collections.abc import Callable


__all__ = [
"MOST_RECENT_LANGUAGE_VERSION",
"VERSION",
Expand Down Expand Up @@ -495,11 +503,6 @@ def register_symbol_manglers(kernel, manglers):

# {{{ cache control

import os

from pytools import strtobool


# Caching is enabled by default, but can be disabled by setting
# the environment variables LOOPY_NO_CACHE or CG_NO_CACHE to a
# 'true' value.
Expand Down Expand Up @@ -674,10 +677,10 @@ def make_einsum(spec, arg_names, **knl_creation_kwargs):

# {{{ default target

_DEFAULT_TARGET = None
_DEFAULT_TARGET: Callable[[], TargetBase] | None = None


def set_default_target(target):
def set_default_target(target: Callable[[], TargetBase] | None):
# deliberately undocumented for now
global _DEFAULT_TARGET
_DEFAULT_TARGET = target
Expand Down
15 changes: 4 additions & 11 deletions loopy/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
)
from pytools.tag import Tag, Taggable, TagT

import loopy.codegen
import loopy.kernel.data # to help out Sphinx
from loopy.diagnostic import CannotBranchDomainTree, LoopyError, StaticValueFindingError
from loopy.kernel.data import (
Expand All @@ -73,15 +72,14 @@
)
from loopy.tools import update_persistent_hash
from loopy.types import LoopyType, NumpyType
from loopy.typing import fset_union, not_none
from loopy.typing import PreambleGenerator, SymbolMangler, fset_union, not_none


if TYPE_CHECKING:
from collections.abc import (
Callable,
Collection,
Hashable,
Iterator,
Mapping,
Sequence,
Set,
Expand Down Expand Up @@ -187,13 +185,8 @@ class LoopKernel(Taggable):
name: str = "loopy_kernel"

preambles: Sequence[tuple[str, str]] = ()
preamble_generators: Sequence[
Callable[
[loopy.codegen.PreambleInfo],
Iterator[tuple[str, str]]]
] = ()
symbol_manglers: Sequence[
Callable[[LoopKernel, str], tuple[LoopyType, str] | None]] = ()
preamble_generators: Sequence[PreambleGenerator] = ()
symbol_manglers: Sequence[SymbolMangler] = ()
linearization: Sequence[ScheduleItem] | None = None
iname_slab_increments: constantdict[InameStr, tuple[int, int]] = field(
default_factory=constantdict)
Expand All @@ -212,7 +205,7 @@ class LoopKernel(Taggable):
with non-parallel implementation tags.
"""

applied_iname_rewrites: tuple[dict[InameStr, Expression], ...] = ()
applied_iname_rewrites: Sequence[Mapping[InameStr, Expression]] = ()
"""
A list of past substitution dictionaries that
were applied to the kernel. These are stored so that they may be repeated
Expand Down
Loading
Loading
0