import '../../../globals.js';
/**
 * Executes a kernel in parallel, using async/await to simulate the WGPU execution model.
 *
 * Designed so that we can test WGPU-like code, but use the debugging facilities of the browser to debug it.
 *
 * We'll randomly choose which item to execute next, so that as much as possible things are executed with a random order
 *
 * Things are structured so that execution thread functions will:
 * - await context.start() - at the very start of the call
 * - await all of the inter-thread primitives (like get/set)
 * - resolve when complete
 *
 * Thus the executor will keep ONE thread going at a time, and every time one of those actions is taken, we'll toss
 * the function to resolve that in a list (with the others), and will randomly choose which one to resolve next.
 * This will execute things with a fairly random order.
 *
 * (needs a working knowledge of the WGSL execution model to understand)
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { BaseWorkgroupValues, ParallelKernel, ParallelWorkgroup } from '../imports.js';
export default class ParallelExecutor<WorkgroupValues extends BaseWorkgroupValues> {
    readonly kernel: ParallelKernel<WorkgroupValues>;
    readonly resolves: (() => void)[];
    readonly donePromises: Promise<void>[];
    constructor(kernel: ParallelKernel<WorkgroupValues>);
    dispatch(dispatchX?: number, dispatchY?: number, dispatchZ?: number): Promise<void>;
    /**
     * Kick off the next pending execution thread action.
     */
    next(): void;
    /**
     * Called from execution threads at the start of their execution. We'll pause all of them until we're ready to
     * proceed.
     */
    start(): Promise<void>;
    workgroupBarrier(workgroup: ParallelWorkgroup<WorkgroupValues>): Promise<void>;
    storageBarrier(workgroup: ParallelWorkgroup<WorkgroupValues>): Promise<void>;
    afterSet(): Promise<void>;
    afterGet(): Promise<void>;
}
//# sourceMappingURL=ParallelExecutor.d.ts.map