{"id":"runtime--Compute.LastGpuMicroseconds","name":"Compute.LastGpuMicroseconds","owner":"yeho","package":"runtime.Compute","kind":"builtin","signature":"Compute.LastGpuMicroseconds() -> int","description":"Read the last available native GPU duration in microseconds after completing a dispatch. This does not measure the whole frame.","context":"Built into Yeho; no package import is needed. Native services require an admitted host and the correct resource lifecycle.","parameters":[],"returns":"int","members":[],"tags":["builtin","compute","gameplay","gpu","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"src/compiler/common/intrinsic_registry.cpp","line":1423,"sha256":"14d29529d2d3c0e2b587f83c7f125b99ada142ed7ae28612701ea6cb9174ac65"},"status":"registered-intrinsic","notes":["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."],"examples":[{"id":"gpu","title":"GPU · [gpu]","description":"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.","code":"[gpu]\ncompute DoubleRewards(buffer of int rewards, int multiplier)\n{\n    int index = compute.index\n    if index >= rewards.count { return }\n    rewards[index] = rewards[index] * multiplier\n}\n\nbuffer of int rewards\nrewards.Add(100)\nrewards.Add(80)\nrewards.Add(60)\ncomputeTask job = dispatch DoubleRewards(rewards, 2)\nwait job\nif job.failed { Console.Error(job.error.message) Process.Exit(1) }\nfor index from 0 < rewards.count { Console.Log(Text.From(rewards[index])) }\nConsole.Log(Text.From(Compute.LastGpuMicroseconds()))\n","tags":["gpu","compute","gameplay"],"run":"metal","verifyRun":true,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.runtime__compute_lastgpumicroseconds\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"executed","sha256":"cae9afc78a3a73e2f3d65055c0cc2645fc661ddb9edbfd08906a74777fe34423","checked":"2026-09-09","diagnostic":"","observedOutput":"200\n160\n120\n1439","checkedBackend":"metal"}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=runtime--Compute.LastGpuMicroseconds","json":"https://demonhunterlabs.com/reference/items/runtime--Compute.LastGpuMicroseconds.json","markdown":"https://demonhunterlabs.com/reference/text/runtime--Compute.LastGpuMicroseconds.md"}
