mirror of
https://github.com/ml-explore/mlx.git
synced 2025-07-05 16:51:13 +08:00
Remove Event::Signal() (#2052)
This commit is contained in:
parent
60c4154346
commit
08a1bf3f10
@ -24,10 +24,6 @@ void Event::wait() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::signal() {
|
|
||||||
static_cast<MTL::SharedEvent*>(event_.get())->setSignaledValue(value());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Event::wait(Stream stream) {
|
void Event::wait(Stream stream) {
|
||||||
if (stream.device == Device::cpu) {
|
if (stream.device == Device::cpu) {
|
||||||
scheduler::enqueue(stream, [*this]() mutable { wait(); });
|
scheduler::enqueue(stream, [*this]() mutable { wait(); });
|
||||||
@ -42,7 +38,9 @@ void Event::wait(Stream stream) {
|
|||||||
|
|
||||||
void Event::signal(Stream stream) {
|
void Event::signal(Stream stream) {
|
||||||
if (stream.device == Device::cpu) {
|
if (stream.device == Device::cpu) {
|
||||||
scheduler::enqueue(stream, [*this]() mutable { signal(); });
|
scheduler::enqueue(stream, [*this]() mutable {
|
||||||
|
static_cast<MTL::SharedEvent*>(event_.get())->setSignaledValue(value());
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
auto& d = metal::device(stream.device);
|
auto& d = metal::device(stream.device);
|
||||||
d.end_encoding(stream.index);
|
d.end_encoding(stream.index);
|
||||||
|
@ -28,21 +28,19 @@ void Event::wait() {
|
|||||||
ec->cv.wait(lk, [value = value(), ec] { return ec->value >= value; });
|
ec->cv.wait(lk, [value = value(), ec] { return ec->value >= value; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::signal() {
|
void Event::wait(Stream stream) {
|
||||||
|
scheduler::enqueue(stream, [*this]() mutable { wait(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void Event::signal(Stream stream) {
|
||||||
|
scheduler::enqueue(stream, [*this]() mutable {
|
||||||
auto ec = static_cast<EventCounter*>(event_.get());
|
auto ec = static_cast<EventCounter*>(event_.get());
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(ec->mtx);
|
std::lock_guard<std::mutex> lk(ec->mtx);
|
||||||
ec->value = value();
|
ec->value = value();
|
||||||
}
|
}
|
||||||
ec->cv.notify_all();
|
ec->cv.notify_all();
|
||||||
}
|
});
|
||||||
|
|
||||||
void Event::wait(Stream stream) {
|
|
||||||
scheduler::enqueue(stream, [*this]() mutable { wait(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void Event::signal(Stream stream) {
|
|
||||||
scheduler::enqueue(stream, [*this]() mutable { signal(); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Event::is_signaled() const {
|
bool Event::is_signaled() const {
|
||||||
|
@ -16,9 +16,6 @@ class Event {
|
|||||||
// Wait for the event to be signaled at its current value
|
// Wait for the event to be signaled at its current value
|
||||||
void wait();
|
void wait();
|
||||||
|
|
||||||
// Signal the event at its current value
|
|
||||||
void signal();
|
|
||||||
|
|
||||||
// Wait in the given stream for the event to be signaled at its current value
|
// Wait in the given stream for the event to be signaled at its current value
|
||||||
void wait(Stream stream);
|
void wait(Stream stream);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user