Skip to content

v.run()

Use v.run() to submit GPU work.

v.run(node);

v.run() does not wait for the GPU to finish.

Pass an array to batch multiple nodes in one submission.

const A = v.pass(K1, { data });
const B = v.pass(K2, { otherData });
v.run([A, B]);

This is the simplest way to batch work in Volten.

When batched passes use different data, they can be submitted together without needing to know about each other.

When batched passes use the same data, order matters.

const A = v.pass(K1, { data });
const B = v.pass(K2, { data });
v.run([A, B]);

Both nodes touch the same concrete buffer, so Volten preserves the array order: A runs before B.

That means v.run([A, B]) is still safe for simple sequential work over the same buffer.

If one pass should consume a buffer produced by another pass, to make the dependency requirement clear, you can also use a handle from the first node.

const A = v.pass(K1, { input, output: mid });
const B = v.pass(K2, { input: A.output, output: result });
v.run(B);

Here, A runs before B.

The next page covers nodes, handles, and Volten’s dependency graph in more detail.