Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit d32b333

Browse files
Merge pull request #32 from jekbradbury/patch-1
mention `!` in semantics description
2 parents 10c4f35 + 9748ad3 commit d32b333

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/source/semantics.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ There is only one reduction operator for the entire statement because
4343
combinations like :code:`max/+` on different dimensions have different mathematical meanings depending on loop order.
4444
All reduction operators are considered to be associative and commutative to
4545
allow for arbitrary order of evaluation.
46+
Reduction operators may be suffixed with :code:`!` to indicate that the tensor to which values are accumulated should first be initialized with the identity of the reduction operator (e.g., zero for :code:`+`).
47+
Otherwise, values are accumulated directly to the output or temporary tensor passed to the kernel.
4648

4749
Size Expressions
4850
----------------
@@ -69,7 +71,8 @@ evaluating :code:`rhs_expression` at all points in the iteration space defined
6971
by the ranges of the loop index variables and reducing into the entry of the
7072
tensor specified on the left-hand side. The order in which these expressions
7173
are evaluated should not change the result because the reduction is
72-
associative and commutative.
74+
associative and commutative. If :code:`!` is not present, :code:`v` is not
75+
re-initialized, and the reduction takes into account the existing values in :code:`v`.
7376

7477
Expressions
7578
-----------

0 commit comments

Comments
 (0)