ML
Metal Compute Graph — automatic barrier optimization via dependency analysis
Instead of manually inserting memory barriers between every dispatch, the graph tracks buffer read/write access per operation and compiles them into "waves" of independent operations. Only one barrier per wave boundary, and all ops within a wave execute concurrently.
Usage: graph = ComputeGraph.new graph.add_op(pipeline) do |op| op.buffer(input, 0, :read) op.buffer(output, 1, :write) op.value(dim, 2) op.dispatch_threadgroups({grid_x, grid_y, 1}, {32, 2, 1}) end graph.compile! graph.encode(cmd) # encodes all ops with minimal barriers
Constants
VERSION = "0.1.0"
Class methods
buffer_pool
Global buffer pool instance