8 # include <Metal/Metal.h>
17 # define metal_printf VLOG(4) << string_printf
22 METAL_GPU_UNKNOWN = 0,
28 enum AppleGPUArchitecture {
37 static int get_apple_gpu_core_count(id<MTLDevice> device);
38 static MetalGPUVendor get_device_vendor(id<MTLDevice> device);
39 static AppleGPUArchitecture get_apple_gpu_architecture(id<MTLDevice> device);
40 static int optimal_sort_partition_elements(id<MTLDevice> device);
41 static string get_device_name(id<MTLDevice> device);
45 class MetalBufferPool {
46 struct MetalBufferListEntry {
47 MetalBufferListEntry(id<MTLBuffer>
buffer, id<MTLCommandBuffer> command_buffer)
52 MetalBufferListEntry() =
delete;
55 id<MTLCommandBuffer> command_buffer;
57 std::vector<MetalBufferListEntry> buffer_free_list;
58 std::vector<MetalBufferListEntry> buffer_in_use_list;
60 size_t total_temp_mem_size = 0;
63 MetalBufferPool() =
default;
66 id<MTLBuffer> get_buffer(id<MTLDevice> device,
67 id<MTLCommandBuffer> command_buffer,
72 void process_command_buffer_completion(id<MTLCommandBuffer> command_buffer);
#define CCL_NAMESPACE_END
CCL_NAMESPACE_BEGIN struct Options options
ccl_global float * buffer
T length(const vec_base< T, Size > &a)
CCL_NAMESPACE_BEGIN typedef std::mutex thread_mutex