Darknet/YOLO v6.0-37-gb57f9029
Object Detection Framework
 
Loading...
Searching...
No Matches
metal_backend.hpp File Reference

Minimal Metal compute wrapper used by the Apple MPS path. More...

#include <cstddef>
#include <cstdint>
Include dependency graph for metal_backend.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  MetalBuffer
 Opaque Metal buffer handle and size in bytes. More...
 
struct  MetalDispatchBuffer
 Buffer binding for a dispatch (buffer + offset). More...
 
struct  MetalDispatchBytes
 Inline POD bytes for a dispatch (small constant args). More...
 
struct  MetalDispatchTexture
 Opaque Metal texture handle for kernels that accept textures. More...
 

Functions

void metal_begin_frame ()
 Begin/end a logical frame (enqueue work for a command buffer).
 
bool metal_buffer_alloc (size_t size, MetalBuffer *out)
 
bool metal_buffer_download (const MetalBuffer *buffer, size_t offset, void *data, size_t length)
 
bool metal_buffer_fill (const MetalBuffer *buffer, size_t offset, uint8_t value, size_t length)
 
void metal_buffer_free (MetalBuffer *buffer)
 
bool metal_buffer_upload (const MetalBuffer *buffer, size_t offset, const void *data, size_t length)
 
bool metal_dispatch_1d (const char *kernel_name, size_t threads, size_t threads_per_group, const MetalDispatchTexture *textures, size_t texture_count, const MetalDispatchBuffer *buffers, size_t buffer_count, const MetalDispatchBytes *bytes, size_t bytes_count, void *command_buffer)
 Dispatch a 1D compute kernel.
 
bool metal_dispatch_2d (const char *kernel_name, size_t width, size_t height, size_t threads_per_group_x, size_t threads_per_group_y, const MetalDispatchTexture *textures, size_t texture_count, const MetalDispatchBuffer *buffers, size_t buffer_count, const MetalDispatchBytes *bytes, size_t bytes_count, void *command_buffer)
 Dispatch a 2D compute kernel.
 
bool metal_dispatch_texture_kernel (const char *kernel_name, void *grid_texture_handle, size_t threads_per_group_x, size_t threads_per_group_y, const MetalDispatchTexture *textures, size_t texture_count, const MetalDispatchBuffer *buffers, size_t buffer_count, const MetalDispatchBytes *bytes, size_t bytes_count, void *command_buffer)
 Dispatch a kernel using a texture as the grid shape source.
 
void metal_end_frame ()
 Commit and wait for the thread-local command buffer.
 
void metal_flush ()
 Commit and wait for outstanding thread-local work, if any.
 
bool metal_init ()
 
bool metal_is_available ()
 
bool metal_self_test ()
 
void metal_shutdown ()
 

Detailed Description

Minimal Metal compute wrapper used by the Apple MPS path.