Module: Toy::Device
- Defined in:
- lib/toy/compute.rb,
lib/toy/compute_cuda.rb,
lib/toy/compute_metal.rb
Class Method Summary collapse
- .from_scratch_recipe ⇒ Object
- .gpt2_engine ⇒ Object
- .llama_engine ⇒ Object
- .name ⇒ Object
-
.shutdown ⇒ Object
toy#90 — device teardown hook (THE one that matters).
- .warm_start_recipe ⇒ Object
Class Method Details
.from_scratch_recipe ⇒ Object
119 120 121 |
# File 'lib/toy/compute.rb', line 119 def self.from_scratch_recipe Toy::LLM::Recipes::FromScratch.new end |
.gpt2_engine ⇒ Object
115 116 117 |
# File 'lib/toy/compute.rb', line 115 def self.gpt2_engine Toy::LLM::Engine::GPT2SeqEngine.new end |
.llama_engine ⇒ Object
111 112 113 |
# File 'lib/toy/compute.rb', line 111 def self.llama_engine Toy::LLM::Engine::LlamaSeqEngine.new end |
.name ⇒ Object
107 108 109 |
# File 'lib/toy/compute.rb', line 107 def self.name "cpu" end |
.shutdown ⇒ Object
toy#90 — device teardown hook (THE one that matters). ggml-metal keeps a process-lifetime residency-set collection on its singleton device and asserts at the C++ static-destructor device-free that the collection is empty (vendor/ggml/src/ggml-metal/ggml-metal-device.m :618). A consumer that builds experiment_metal (toy new –lib) runs the binary directly — it gets NO GGML_METAL_NO_RESIDENCY=1 (that env is injected only by toy’s own CLI subprocesses), so any Metal buffer still alive at exit aborts the process (exit 134) AFTER correct compute (toy#27 runs 3-4). Spinel has no at_exit, so a device- agnostic body MUST call Toy::Device.shutdown before returning; tnn_shutdown_engines frees every live Metal session’s weights_buf (removing it from the residency set), satisfying the assert. RUNTIME-UNVERIFIED on gx10 (Linux) — Mac gate proves the exit-0.
132 133 134 |
# File 'lib/toy/compute.rb', line 132 def self.shutdown nil end |