runtime · runtime ·
compute.index
Identify the current data-parallel invocation. Check the index against each buffer's count before indexing.
CPU and GPU data processing with explicit ownership and completion.
compute.indexStatus: experimental
GPU · [gpu]
Double a batch of reward values on native Metal. The [gpu] tag requires an accelerator backend; CPU oracle cannot silently satisfy it.
gpu · compute · gameplay · executed
[gpu]
compute DoubleRewards(buffer of int rewards, int multiplier)
{
int index = compute.index
if index >= rewards.count { return }
rewards[index] = rewards[index] * multiplier
}
buffer of int rewards
rewards.Add(100)
rewards.Add(80)
rewards.Add(60)
computeTask job = dispatch DoubleRewards(rewards, 2)
wait job
if job.failed { Console.Error(job.error.message) Process.Exit(1) }
for index from 0 < rewards.count { Console.Log(Text.From(rewards[index])) }
project.mech
manifestVersion = "2"
package = "api.example.runtime__compute_index"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
[app]
kind = "headless"
Expected output
200 160 120
Notes and source
yeho/docs/runtime/execution-boundaries.md; docs/runtime/metal-compute-v1.md