# auto

Leave compute placement compatible with the selected backend. Build the same [auto] source separately for CPU oracle or Metal; the tag alone does not prove which processor ran it.

Last updated: 2026-09-09

Package: runtime | Status: experimental

Tags: auto, compute, cpu, gpu, yeho

CPU and GPU data processing with explicit ownership and completion.

```yh
auto
```


## Automatic · [auto]

Keep the same portable source for separate CPU and GPU builds. Choose --backend cpu-oracle or --backend metal explicitly; [auto] is not proof of GPU execution.

Verification: executed

```yh
[auto]
compute ApplyDamage(buffer of int health, int damage)
{
    int index = compute.index
    if index >= health.count { return }
    health[index] = health[index] - damage
}

buffer of int health
health.Add(100)
health.Add(80)
health.Add(60)
computeTask job = dispatch ApplyDamage(health, 10)
wait job
if job.failed { Console.Error(job.error.message) Process.Exit(1) }
for index from 0 < health.count { Console.Log(Text.From(health[index])) }

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.tag__auto"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Expected output:

```text
90
70
50
```

Executed backend: metal

Observed output:

```text
90
70
50
```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/tag--auto/auto --backend metal -o /tmp/yeho-example
/tmp/yeho-example
```




Source: yeho/docs/runtime/execution-boundaries.md; docs/runtime/metal-compute-v1.md

AI training permission: https://demonhunterlabs.com/ai-use
