Skip to content

ParallelWorkgroupArray

Overview

Represents a storage-level array.

We need to track which execution threads/invocations have written to which indices, so that we can (a) ensure that we won't get data races (and will have uniform control flow), and (b) in the future potentially simulate cases where we might get more undefined-like behavior between which values we get.

For workgroup-level arrays, we only need to track the local invocation within that workgroup wrote to that index.

TODO: for NOW, we'll lock out and fail on reads (if another thread wrote), OR multiple-thread writes, HOWEVER TODO: we should make it possible to return arbitrary results (and track values) for other cases

See ParallelExecutor for more high-level documentation.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class ParallelWorkgroupArray

import { ParallelWorkgroupArray } from 'scenerystack/alpenglow';

Constructor

new ParallelWorkgroupArray( data : T[], indeterminateValue : T )

Instance Methods

get( context : ParallelContext<WorkgroupValues>, index : number ) : Promise<T>

set( context : ParallelContext<WorkgroupValues>, index : number, value : T ) : Promise<void>

synchronize( workgroupId : Vector3 )

Source Code

See the source for ParallelWorkgroupArray.ts in the alpenglow repository.