From b0c3227d19290fdadcaf419d2a4aab066abf4bd2 Mon Sep 17 00:00:00 2001 From: Kris Rowe Date: Wed, 29 Nov 2023 23:14:01 -0600 Subject: [PATCH] Correctly sync all streams in `device::finishAll()`. (#723) --- src/occa/internal/core/device.cpp | 10 ++++++++-- src/occa/internal/core/device.hpp | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/occa/internal/core/device.cpp b/src/occa/internal/core/device.cpp index 9638e01a7..e59be4dfb 100644 --- a/src/occa/internal/core/device.cpp +++ b/src/occa/internal/core/device.cpp @@ -85,8 +85,14 @@ namespace occa { } void modeDevice_t::finishAll() const { - for(auto* stream : streams) { - if(stream) stream->finish(); + if (streamRing.head) { + auto* start = static_cast(streamRing.head); + auto* current = start; + // Every device + do { + current->finish(); + current = static_cast(current->rightRingEntry); + } while (current != start); } } diff --git a/src/occa/internal/core/device.hpp b/src/occa/internal/core/device.hpp index 6613ef87b..a90ae19f0 100644 --- a/src/occa/internal/core/device.hpp +++ b/src/occa/internal/core/device.hpp @@ -21,7 +21,6 @@ namespace occa { gc::ring_t streamTagRing; stream currentStream; - std::vector streams; udim_t bytesAllocated; udim_t maxBytesAllocated;