recipes · recipe ·

Example · Connect two compute passes

Make a dependency between dispatches explicit.

cpugpurecipe

A larger compute effect often has several passes. One creates data and another transforms it. The second pass must receive the completed result of the first. Here Fill writes a short ramp and Double multiplies it by two. We wait and check failure after each dispatch. This makes the dependency obvious even before you look at a profiler.

start.yh · compute example

Status: complete-program

Example · Connect two compute passes

Make a dependency between dispatches explicit.

gpu · cpu · type checked

[auto]
compute Fill(buffer of int values)
{
    int index = compute.index
    if index >= values.count { return }
    values[index] = index + 1
}
[auto]
compute Double(buffer of int values)
{
    int index = compute.index
    if index >= values.count { return }
    values[index] = values[index] * 2
}

buffer of int values
values.Resize(4)
computeTask first = dispatch Fill(values)
wait first
if first.failed { Console.Error(first.error.message) Process.Exit(1) }
computeTask job = dispatch Double(values)
wait job
if job.failed { Console.Error(job.error.message) Process.Exit(1) }
for index from 0 < values.count { Console.Log(Text.From(values[index])) }
project.mech
manifestVersion = "2"
package = "api.example.recipe__compute_chain"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Expected output
2
4
6
8
Notes and source

Combine the two arithmetic expressions into one independent kernel and compare output. Measure only after confirming every value still matches.

demonhunterlabs/app/lib/yeho-walkthrough.ts