mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
* redesign for faster cpu/gpu synch * load + more async CPU * use command encoder API and move more ops to use it * make fence back-end generic + CPU only fence * faster build * fix async eval * fixes + handle temporaries * fix / improve cpu conv * remove unused status, fix siblings * fix extensions * fix * fix no cpu build * format * comments * fix perf regression, remove unecessary abort * fix events, task limit cpu * fix waiting * fix donation / temporaries in normalization
17 lines
407 B
C++
17 lines
407 B
C++
// Copyright © 2025 Apple Inc.
|
|
|
|
#include "mlx/backend/cpu/encoder.h"
|
|
|
|
namespace mlx::core::cpu {
|
|
|
|
CommandEncoder& get_command_encoder(Stream stream) {
|
|
static std::unordered_map<int, CommandEncoder> encoder_map;
|
|
auto it = encoder_map.find(stream.index);
|
|
if (it == encoder_map.end()) {
|
|
it = encoder_map.emplace(stream.index, stream).first;
|
|
}
|
|
return it->second;
|
|
}
|
|
|
|
} // namespace mlx::core::cpu
|