subgroupExclusiveMul
Compute an exclusive prefix product across invocations within a subgroup: returns the product of all values whose subgroup_invocation_id is less than the current invocation's e; the first invocation returns the multiplicative identity 1.
Core Advantages
One line of code yields a hardware-level parallel prefix scan (multiplication). Suitable for building cumulative multiplicative weights/masks inside a subgroup. In TSL it is wrapped as a node and accepts exactly one parameter.
Common Uses
Build cumulative multiplicative weights/masks within the same subgroup (e.g., cascading opacity or decay chains).
Perform prefix products on partitioned/bucketed data to generate cumulative scales or luminance.
Combine with subgroupBroadcast or other subgroup scan/reduce functions to construct parallel pipelines.
How to adjust
This function has a single input parameter e (typically a float). It requires the runtime platform to support GPU subgroup features. The first invocation returns 1. If you need to include the current value, use the corresponding inclusive scan.
Code Examples
1/* Compute the exclusive prefix product within the same subgroup (excluding the current thread's w) */
2const w = saturate( weight );
3const prefixMul = subgroupExclusiveMul( w );
4// prefixMul can be used as the multiplicative base for cascading opacity, energy decay, etc.
5