struct

ML::Metal::GraphEncoder

Inherits Struct / Value / Object

GraphEncoder — drop-in replacement for ComputeEncoder that builds a ComputeGraph. Same API (set_pipeline, set_buffer, set_value, dispatch_*, memory_barrier). memory_barrier is a no-op — the graph computes optimal barriers automatically.

Usage: graph = ComputeGraph.new enc = GraphEncoder.new(graph)

... same calls as ComputeEncoder ...

graph.compile! graph.encode(cmd)

Constructors

Instance methods

dispatch(grid : Tuple(Int32, Int32, Int32), size : Tuple(Int32, Int32, Int32)) : self
Source
dispatch_1d(count : Int32, tg_size : Int32 = 256) : self
Source
dispatch_threadgroups(grid : Tuple(Int32, Int32, Int32), size : Tuple(Int32, Int32, Int32)) : self
Source
dispatch_threadgroups_indirect(buf : MetalBuffer, offset : Int64, size : Tuple(Int32, Int32, Int32)) : self
Source
end_encoding
Source
memory_barrier

memory_barrier is a NO-OP — the graph handles barriers automatically

Source
set_buffer(buf : MetalBuffer, index : Int32, access : BufferAccess = BufferAccess::Read, offset : Int64 = 0, length : Int64 = -1, partition : Int32 = -1) : self

Buffer binding with access mode (default: :read) length: -1 = entire buffer. partition: ≥0 = Block Integrity key (different partitions don't conflict)

Source
set_pipeline(p : ComputePipeline) : self
Source
set_threadgroup_memory(length : Int32, index : Int32) : self
Source
set_value(val : UInt32, index : Int32) : self
Source
set_value(val : Float32, index : Int32) : self
Source