mainScanWGSL¶
Overview¶
A raked scan implementation capable of non-commutable cases, where:
- All threads load state into workgroup memory in a coalesced fashion
- All threads perform an inclusive sequential scan on their data (of grainSize elements)
- All threads perform an inclusive scan of the "reuced" values for each thread (Hillis-Steele)
- The remaining values are filled in with the previous scanned value.workgroup
- The workgroup memory is written to the main output in a coalesced fashion
Based on the described coarsened scan in "Programming Massively Parallel Processors" by Hwu, Kirk and Hajj, chap11.
Additionally, reductions can be stored in a separate array (for use in multi-level scans), AND/OR scanned reductions can be added into final results (also for use in multi-level scans).
@author Jonathan Olson <jonathan.olson@colorado.edu>
Type mainScanWGSLOptions¶
- binaryOp: BinaryOp<T>
- inPlace?: boolean
- storeReduction?: boolean
- addScannedReduction?: boolean
- addScannedDoubleReduction?: boolean
- areScannedReductionsExclusive?: boolean
- input?: BufferSlot<T[]> | null
Iff inPlace:false - output?: BufferSlot<T[]> | null
- data?: BufferSlot<T[]> | null
Iff inPlace:true - reduction?: BufferSlot<T[]> | null
iff storeReduction:true - scannedReduction?: BufferSlot<T[]> | null
iff addScannedReduction:true - scannedDoubleReduction?: BufferSlot<T[]> | null
iff addScannedDoubleReduction:true - getAddedValue?: scanComprehensiveWGSLOptions<T>[ 'getAddedValue' ]
only if addScannedReduction:false - & RakedSizable & Pick<scanComprehensiveWGSLOptions<T>, "exclusive" | "lengthExpression" | "inputOrder" | "inputAccessOrder" | "factorOutSubexpressions" | "stripeReducedOutput">
Source Code¶
See the source for mainScanWGSL.ts in the alpenglow repository.