kernel.workgroup.reduce
← kernel dialect
Reduce one or more independent scalar or rank-1 vector payloads at one workgroup convergence point. Each result has the type of the operand in the same position. All payloads share the combining kind and math requirement; no combination occurs between payloads. Each active contribution participates once per component; association is unspecified. Floating sums and products default to native target arithmetic, which may change signed zeros, flush subnormals, or relax nonfinite handling. The optional preserve requirement instead evaluates each combine with the source format's arithmetic semantics. Neither mode promises serial-reference bits, reproducibility, or a correctly rounded real-number sum. Integer arithmetic and the selected floating-extremum kind keep their exact semantics.
Operation contract
| Property |
Value |
| Semantic phase |
executable |
| Traits |
Convergent, HasAnyAncestor(kernel.def, pipeline.strand) |
| Target contracts |
kernel.synchronization |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Operand |
values |
any |
variadic |
Nonempty independent per-invocation payloads to reduce. |
| Result |
results |
any |
variadic |
Workgroup-uniform results corresponding positionally to the payloads. |
| Attribute |
kind |
enum CombiningKind |
required |
Combining operation. |
| Attribute |
math |
flags CollectiveMathFlags |
optional |
Optional floating-point preservation requirement; omission selects native arithmetic. |
Verification constraints
VariadicValuesMatch(values, results)
Examples
%sum = kernel.workgroup.reduce<addf> %v : f32
%sum, %moment = kernel.workgroup.reduce<addf> %value, %squared : f32, vector<4xf32>