# Compute.LastGpuMicroseconds

Read the last available native GPU duration in microseconds after completing a dispatch. This does not measure the whole frame.

Last updated: 2026-09-09

Package: runtime.Compute | Status: registered-intrinsic

Tags: builtin, compute, gameplay, gpu, yeho

Built into Yeho; no package import is needed. Native services require an admitted host and the correct resource lifecycle.

```yh
Compute.LastGpuMicroseconds() -> int
```


## GPU · [gpu]

Run a real GPU reward pass, then read the last available device duration in microseconds. Timing varies and is not an end-to-end speed claim.

Verification: executed

```yh
[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])) }
Console.Log(Text.From(Compute.LastGpuMicroseconds()))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.runtime__compute_lastgpumicroseconds"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Executed backend: metal

Observed output:

```text
200
160
120
1439
```

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/runtime--Compute.LastGpuMicroseconds/gpu --backend metal -o /tmp/yeho-example
/tmp/yeho-example
```


The example checks the call shape. Opening windows, recording audio, changing files, network operations, and process operations have real effects when run. Follow the corresponding package lifecycle before using live resources.

Source: yeho/src/compiler/common/intrinsic_registry.cpp

AI training permission: https://demonhunterlabs.com/ai-use
