-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Fix custom op multi-gpu scaling #9283
Conversation
|
||
std::vector<Engine::VarHandle> vars; | ||
for (const auto& i : arrs) vars.push_back(i.var()); | ||
Engine::Get()->PushSync([=](RunContext rctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will worker thread and main thread push operations to the engine at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine. Engine is thread safe
Just FYI, every GPU-instance has two GPUs present, so feel free to write a test for this case. |
cv_.wait(lock, [&] {return !q_.empty() || destructing_;}); | ||
while (!q_.empty()) { | ||
auto fn = q_.front(); | ||
lock.unlock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when after we unlock, something is pushed to the queue ? Will we pop the correct item from the queue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is on 1 consumer thread, so its ok
* refactor custom op * fix * fix * fix * fix
* refactor custom op * fix * fix * fix * fix
* refactor custom op * fix * fix * fix * fix
* refactor custom op * fix * fix * fix * fix
Description
(Brief description on what this PR is about)
Checklist
Essentials
make lint
)Changes
Comments