diff --git a/docs/source/api/kernelcreation/index.rst b/docs/source/api/kernelcreation/index.rst index 582ee16682f913cd8e1fac5a97d90eda505588f7..f455ab9604bf14ce8cbda4ccbca3cc229648d411 100644 --- a/docs/source/api/kernelcreation/index.rst +++ b/docs/source/api/kernelcreation/index.rst @@ -4,10 +4,15 @@ Kernel Creation The primary interface for creating numerical kernels in pystencils is the function `create_kernel`. +Configuration +============= -.. autoclass:: pystencils.CreateKernelConfig +.. automodule:: pystencils.config :members: +Creation +======== + .. autofunction:: pystencils.create_kernel .. autoclass:: pystencils.backend.KernelFunction diff --git a/docs/source/backend/ast.rst b/docs/source/backend/ast.rst index 0d0d794ab28ea230effa0b871e64c77d6a79dec2..41f23016664002fd100544d72c509f9f73d72bdd 100644 --- a/docs/source/backend/ast.rst +++ b/docs/source/backend/ast.rst @@ -2,11 +2,29 @@ Abstract Syntax Tree ******************** +Inheritance Diagramm +==================== + +.. inheritance-diagram:: pystencils.backend.ast.astnode.PsAstNode pystencils.backend.ast.structural pystencils.backend.ast.expressions pystencils.backend.extensions.foreign_ast + :top-classes: pystencils.types.PsAstNode + :parts: 1 + + +Base Classes +============ + .. automodule:: pystencils.backend.ast.astnode :members: +Structural Nodes +================ + .. automodule:: pystencils.backend.ast.structural :members: + +Expressions +=========== + .. automodule:: pystencils.backend.ast.expressions :members: diff --git a/docs/source/backend/extensions.rst b/docs/source/backend/extensions.rst new file mode 100644 index 0000000000000000000000000000000000000000..6fb95cda06b0cc1a7440764fa2f2fe10cd1f84c1 --- /dev/null +++ b/docs/source/backend/extensions.rst @@ -0,0 +1,5 @@ +************************************ +Extensions and Experimental Features +************************************ + +.. automodule:: pystencils.backend.extensions diff --git a/docs/source/backend/index.rst b/docs/source/backend/index.rst index e0e914b4d423fb5b9e32950185c6aa3474976d39..f2fe9346dbe4d38722b69dd9c279d0eb11c98773 100644 --- a/docs/source/backend/index.rst +++ b/docs/source/backend/index.rst @@ -16,6 +16,7 @@ who wish to customize or extend the behaviour of the code generator in their app platforms transformations jit + extensions Internal Representation ----------------------- diff --git a/src/pystencils/backend/extensions/__init__.py b/src/pystencils/backend/extensions/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9c699a3ff02c5ff311c872c70a861a52fea13419 100644 --- a/src/pystencils/backend/extensions/__init__.py +++ b/src/pystencils/backend/extensions/__init__.py @@ -0,0 +1,29 @@ +""" +The module `pystencils.backend.extensions` contains extensions to the pystencils code generator +beyond its core functionality. + +The tools and classes of this module are considered experimental; +their support by the remaining code generator is limited. +They can be used to model and generate code outside of the usual scope of pystencils, +such as non-standard syntax and types. +At the moment, the primary use case is the modelling of C++ syntax. + + +Foreign Syntax Support +====================== + +.. automodule:: pystencils.backend.extensions.foreign_ast + :members: + + +C++ Language Support +==================== + +.. automodule:: pystencils.backend.extensions.cpp + :members: + +""" + +from .foreign_ast import PsForeignExpression + +__all__ = ["PsForeignExpression"] diff --git a/src/pystencils/backend/extensions/foreign_ast.py b/src/pystencils/backend/extensions/foreign_ast.py index 06735a65a84e1a841b841f8bc34ad24ca10e736f..55042ea835e827ebd8f4991cc13af3e5371f89ea 100644 --- a/src/pystencils/backend/extensions/foreign_ast.py +++ b/src/pystencils/backend/extensions/foreign_ast.py @@ -14,12 +14,12 @@ class PsForeignExpression(PsExpression, ABC): Foreign expressions are expressions whose properties are not modelled by the pystencils AST, and which pystencils therefore does not understand. - Support for foreign expressions by the code generator is therefore very limited; - as a rule of thumb, only printing is supported. - Type checking and most transformations will fail when encountering a `PsForeignExpression`. There are many situations where non-supported expressions are needed; the most common use case is C++ syntax. + Support for foreign expressions by the code generator is therefore very limited; + as a rule of thumb, only printing is supported. + Type checking and most transformations will fail when encountering a `PsForeignExpression`. """ __match_args__ = ("children",) diff --git a/src/pystencils/config.py b/src/pystencils/config.py index 8745dbfa73055142dbf7b145685ca89d774bd299..d2af213c1ed7de3ecec67d25e4ee7911aab30d52 100644 --- a/src/pystencils/config.py +++ b/src/pystencils/config.py @@ -121,7 +121,7 @@ class VectorizationConfig: @dataclass class GpuIndexingConfig: - """Configure index translation behaviour inside kernels generated for `Target.SYCL`.""" + """Configure index translation behaviour for kernels generated for GPU targets.""" omit_range_check: bool = False """If set to `True`, omit the iteration counter range check. @@ -134,10 +134,13 @@ class GpuIndexingConfig: sycl_automatic_block_size: bool = True """If set to `True` while generating for `Target.SYCL`, let the SYCL runtime decide on the block size. - If set to `True`, the kernel is generated for execution via ``parallel_for``-dispatch using + If set to `True`, the kernel is generated for execution via + `parallel_for <https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_parallel_for_invoke>`_ + -dispatch using a flat `sycl::range`. In this case, the GPU block size will be inferred by the SYCL runtime. - If set to `False`, the kernel will receive an `nd_item` and has to be executed using ``parallel_for`` + If set to `False`, the kernel will receive an `nd_item` and has to be executed using + `parallel_for <https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_parallel_for_invoke>`_ with an `nd_range`. This allows manual specification of the block size. """