Rules and restrictions for Pipeline orchestration functions
developWhen writing the orchestration function for createPipeline, you must follow strict trace-time rules. Violations will throw an error at build time (during the first call).
Prohibited operations during orchestration (trace-time):
- Reading handles: You cannot read an element or property of a handle (e.g.,
handle[0]). This throws:"pipeline intermediate results cannot be read during orchestration". - Arithmetic/Conditions on handles: Using a handle in arithmetic or conditional logic (via
valueOforSymbol.toPrimitive) is forbidden. - Non-deterministic functions: Calling
Math.random()is forbidden; orchestration must be deterministic. - External consumption: Calling any function that consumes a handle (other than a GPU.js kernel created by the same GPU instance) is forbidden.
Legal operations:
- Kernel calls: Calling GPU.js kernels created by the same GPU instance using handles or plain JS values as arguments.
- Non-handle arguments: Using numbers or arrays (uploaded per call) as kernel arguments.
- Captured values: Plain values captured via closures are frozen into the plan at trace time.