{"id":"tag--gpu","name":"gpu","owner":"yeho","package":"runtime","kind":"runtime","signature":"gpu","description":"Require an accelerator for a compute function with [gpu]. The Mac examples use native Metal and fail rather than silently selecting CPU execution.","context":"CPU and GPU data processing with explicit ownership and completion.","parameters":[],"returns":"","members":[],"tags":["compute","cpu","gameplay","gpu","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"docs/runtime/execution-boundaries.md; docs/runtime/metal-compute-v1.md"},"status":"experimental","notes":[],"examples":[{"id":"gpu","title":"GPU · [gpu]","description":"Double a batch of reward values on native Metal. The [gpu] tag requires an accelerator backend; CPU oracle cannot silently satisfy it.","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])) }\n","tags":["gpu","compute","gameplay"],"run":"metal","expected":"200\n160\n120","verifyRun":true,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.tag__gpu\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"executed","sha256":"56c500a4ce911fde0e5f150119ec556b020c8c7c661d7057aa269444b9545290","checked":"2026-09-09","diagnostic":"","observedOutput":"200\n160\n120","checkedBackend":"metal"}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=tag--gpu","json":"https://demonhunterlabs.com/reference/items/tag--gpu.json","markdown":"https://demonhunterlabs.com/reference/text/tag--gpu.md"}
