fix version and expose command queue getter (#1892)

This commit is contained in:
Awni Hannun
2025-02-20 15:25:15 -08:00
committed by GitHub
parent 10b271d963
commit 8ff84b5c43
6 changed files with 45 additions and 40 deletions

View File

@@ -254,9 +254,6 @@ Device::~Device() {
void Device::new_queue(int index) {
auto thread_pool = metal::new_scoped_memory_pool();
// Multiple threads can ask the device for queues
// We lock this as a critical section for safety
auto q = device_->newCommandQueue(MAX_BUFFERS_PER_QUEUE);
debug_set_stream_queue_label(q, index);
if (!q) {
@@ -269,6 +266,10 @@ void Device::new_queue(int index) {
}
}
MTL::CommandQueue* Device::get_queue(Stream stream) {
return get_stream_(stream.index).queue;
}
bool Device::command_buffer_needs_commit(int index) {
auto& stream = get_stream_(index);
if (stream.buffer_ops > max_ops_per_buffer_ ||

View File

@@ -178,6 +178,9 @@ class Device {
}
void new_queue(int index);
MTL::CommandQueue* get_queue(Stream stream);
MTL::CommandBuffer* get_command_buffer(int index);
bool command_buffer_needs_commit(int index);
void commit_command_buffer(int index);