runtime · runtime ·
CPU-GPU-pipeline
Prepare data on the CPU, process independent elements on the GPU, wait for completion, and consume the results on the CPU.
CPU and GPU data processing with explicit ownership and completion.
CPU-GPU-pipelineStatus: experimental
CPU + GPU · one pipeline
The CPU prepares rewards, the GPU doubles them, then the CPU totals the finished buffer. There is no [both] tag. Ordinary host code and a [gpu] kernel cooperate explicitly.
hybrid · cpu · gpu · compute · pipeline · executed
[gpu]
compute DoubleRewards(buffer of int rewards)
{
int index = compute.index
if index >= rewards.count { return }
rewards[index] = rewards[index] * 2
}
// CPU: prepare a small game reward batch.
buffer of int rewards
for level from 1 <= 4 { rewards.Add(level * 10) }
// GPU: process independent elements.
computeTask job = dispatch DoubleRewards(rewards)
wait job
if job.failed { Console.Error(job.error.message) Process.Exit(1) }
// CPU: consume only after the GPU has finished.
int total = 0
for index from 0 < rewards.count { total = total + rewards[index] }
Console.Log(Text.From(total))
project.mech
manifestVersion = "2"
package = "api.example.runtime__cpu_gpu_pipeline"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
[app]
kind = "headless"
Expected output
200
Notes and source
yeho/docs/runtime/execution-boundaries.md; docs/runtime/metal-compute-v1.md