You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 28, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: docs/source/semantics.rst
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -32,19 +32,21 @@ Each index variable has an associated range :code:`[b,e)` over which it operates
32
32
That range is inferred by its use, as described below.
33
33
Index variables go out of scope after the statement, allowing the reuse of short variable names like :code:`i`.
34
34
35
-
Implied Reductions
36
-
------------------
35
+
Implied Reductions and operators
36
+
--------------------------------
37
37
38
38
If an index variable appears on the right but not on the left of a statement,
39
39
it is a reduction index for the statement.
40
40
If a statement has one or more reduction variables then it must specify a :code:`reduction`
41
41
operator such as :code:`+` or :code:`max`.
42
42
There is only one reduction operator for the entire statement because
43
43
combinations like :code:`max/+` on different dimensions have different mathematical meanings depending on loop order.
44
-
All reduction operators are considered to be associative and commutative to
45
-
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.
44
+
All reduction operators are considered to be associative and commutative to allow for arbitrary order of evaluation.
45
+
46
+
Reduction operators may be suffixed with :code:`!` (for example :code:`+=!`) to indicate that the
47
+
tensor to which values are accumulated should first be initialized with the identity of the reduction
48
+
operator (e.g., :code:`0` for :code:`+`). Otherwise, values are accumulated directly to the output or
0 commit comments