diff --git a/pytato/__init__.py b/pytato/__init__.py index c6a425fba30d7e2e454a73b28609fc39700124be..1ce5e25260183711ba68bea7f793506af8628c75 100644 --- a/pytato/__init__.py +++ b/pytato/__init__.py @@ -39,7 +39,7 @@ from pytato.array import ( ) -from pytato.codegen.loopy import generate_loopy +from pytato.target.loopy.codegen import generate_loopy from pytato.target import Target from pytato.target.loopy import PyOpenCLTarget from pytato.visualization import get_dot_graph, show_dot_graph diff --git a/pytato/codegen/__init__.py b/pytato/codegen.py similarity index 99% rename from pytato/codegen/__init__.py rename to pytato/codegen.py index ae9936971340143e4734aad622196a926cb2f555..24fbddd9c252b47c242f1c8055800ea813b653da 100644 --- a/pytato/codegen/__init__.py +++ b/pytato/codegen.py @@ -51,13 +51,6 @@ References Should be referenced as :class:`pytato.array.DataInterface`. -Generating Code ---------------- - -.. currentmodule:: pytato - -.. automodule:: pytato.codegen.loopy - Code Generation Helpers ------------------------- diff --git a/pytato/target/loopy.py b/pytato/target/loopy/__init__.py similarity index 97% rename from pytato/target/loopy.py rename to pytato/target/loopy/__init__.py index 8996e934af81ff679947c23305eeab3aa78a78b6..f1f5925d14f98140401c032db6977043e474d1b2 100644 --- a/pytato/target/loopy.py +++ b/pytato/target/loopy/__init__.py @@ -28,6 +28,12 @@ __doc__ = """ .. autoclass:: LoopyTarget .. autoclass:: PyOpenCLTarget .. autoclass:: BoundPyOpenCLProgram + + +Generating code +^^^^^^^^^^^^^^^ + +.. automodule:: pytato.target.loopy.codegen """ from dataclasses import dataclass diff --git a/pytato/codegen/loopy.py b/pytato/target/loopy/codegen.py similarity index 99% rename from pytato/codegen/loopy.py rename to pytato/target/loopy/codegen.py index c7ee1a51aa603bf51f464fd816b4b6f586a677dd..5d1fcdcf87011a04128e94aaa0530824de43cdef 100644 --- a/pytato/codegen/loopy.py +++ b/pytato/target/loopy/codegen.py @@ -43,22 +43,17 @@ from pytato.scalar_expr import ScalarExpression from pytato.codegen import preprocess, normalize_outputs, SymbolicIndex __doc__ = """ -.. currentmodule:: pytato.codegen.loopy +.. currentmodule:: pytato.target.loopy.codegen .. autofunction:: generate_loopy -Loopy Codegen Internals -^^^^^^^^^^^^^^^^^^^^^^^ - .. autoclass:: LoopyExpressionContext .. autoclass:: ImplementedResult .. autoclass:: StoredResult .. autoclass:: InlinedResult .. autoclass:: SubstitutionRuleResult - .. autoclass:: CodeGenState .. autoclass:: CodeGenMapper - .. autoclass:: InlinedExpressionGenMapper .. autofunction:: domain_for_shape @@ -634,7 +629,7 @@ def get_initial_codegen_state(namespace: Namespace, target: LoopyTarget, def generate_loopy(result: Union[Array, DictOfNamedArrays, Dict[str, Array]], target: Optional[LoopyTarget] = None, options: Optional[lp.Options] = None) -> BoundProgram: - r"""Code generation entry point. + r"""Loopy code generation entry point. :param result: Outputs of the computation. :param target: Code generation target. diff --git a/pytato/visualization.py b/pytato/visualization.py index 17831a8946648a4332abe39cc866fe2cf3de8162..3aa3f79fcd05849416642aff73e19f09db602454 100644 --- a/pytato/visualization.py +++ b/pytato/visualization.py @@ -194,7 +194,7 @@ def get_dot_graph(result: Union[Array, DictOfNamedArrays]) -> str: graph of the computation of *result*. :arg result: Outputs of the computation (cf. - :func:`pytato.codegen.loopy.generate_loopy`). + :func:`pytato.target.loopy.codegen.generate_loopy`). """ outputs: DictOfNamedArrays = normalize_outputs(result) del result @@ -250,7 +250,7 @@ def show_dot_graph(result: Union[Array, DictOfNamedArrays]) -> None: """Show a graph representing the computation of *result* in a browser. :arg result: Outputs of the computation (cf. - :func:`pytato.codegen.loopy.generate_loopy`). + :func:`pytato.target.loopy.codegen.generate_loopy`). """ dot_code: str