mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-22 02:58:16 +08:00
Fix fast synch when fence is waited before a command buffer is created (#2657)
This commit is contained in:
@@ -471,6 +471,10 @@ void Device::end_encoding(int index) {
|
||||
CommandEncoder& Device::get_command_encoder(int index) {
|
||||
auto& stream = get_stream_(index);
|
||||
if (stream.encoder == nullptr) {
|
||||
// Ensure there is an active command buffer
|
||||
if (stream.buffer == nullptr) {
|
||||
get_command_buffer(index);
|
||||
}
|
||||
stream.encoder = std::make_unique<CommandEncoder>(stream);
|
||||
stream.fence = std::make_shared<Fence>(device_->newFence());
|
||||
}
|
||||
|
Reference in New Issue
Block a user