Skip to content

Commit

Permalink
Improve documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Jul 26, 2024
1 parent 2a66d44 commit f0aa935
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions doc/add-instruction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,24 @@ functionality to check arguments for correctness such as Python type.

By default, register arguments are understood as single registers. The
:py:obj:`vectorize` decorator is an easy way to allow vector arguments
if all register arguments have the same length. The vector size stored
independently of the arguments.
if all register arguments have the same length. The vector size is
stored independently of the arguments. The decorator creates two
instructions, a base version for single registers and a vectorized
version, which is called as follows in the example for length
:py:obj:`n`::

vprefixsum(n, result, operand)

At the higher level, the vector length is usually derived from the
input using the :py:obj:`vectorize` decorator as in
:py:func:`~Compiler.types.sint.prefix_sum`::

@vectorize
def prefix_sum(self):
""" Prefix sum. """
res = sint()
prefixsums(res, self)
return res

All instruction classes should inherit from :py:obj:`Instruction` in
:download:`../Compiler/instructions_base.py`.
Expand Down

0 comments on commit f0aa935

Please sign in to comment.