cheatah
Module

gpu::metal::emulated

cheatah-gpu v0.5.1-alpha — Biome Standard 0.6.3-alpha

Classes

Functions

fn register_kernel · 2 overloads
void register_kernel(const char *name, void(*fn)(void **buffers, unsigned buffer_count, unsigned long grid_width))#
void register_kernel(const char *name, void(*fn)(void **buffers, unsigned buffer_count, const DispatchShape &shape))#

Register a software stand-in for a compiled MSL compute kernel, keyed by its function name.

Parameters
name

the kernel/function name a pipeline is built for (matches newFunctionWithName).

fn

called per dispatch as fn(buffers, buffer_count, grid_width): buffers[i] is the bound buffer at index i (or null), grid_width is the dispatched thread count along x.

Complexity

O(1) registration.

Host allocation

none (stores the function pointer).

Unit testMetalCompute.AddArrays
System testsystests/metal/test_compute.purr
fn unsigned long live_objects() #

The number of emulator objects still alive — 0 means nothing leaked.

Meaningful when built with -DCHEATAH_GPU_METAL_LEAKCHECK=1 (otherwise always 0); compiled out for production so there is no tracking overhead. This ALERTS on leaks; it does not enforce RAII.

Returns

count of live emulated Metal objects.

Complexity

O(1).

Host allocation

none.

Unit testMetalCompute.LeakClean
System testsystests/metal/test_compute.purr