From 03a0cdbcefe68906458ed0b192bf0998fe747026 Mon Sep 17 00:00:00 2001 From: Eric Lunderberg Date: Mon, 3 May 2021 16:26:00 -0700 Subject: [PATCH] [Vulkan][Runtime] Added dummy implementations for TVMStreamHandle operations rpc_runner_run interacts with stream handlers following PR #7819. Vulkan currently executes adds everything into a single command buffer per CPU thread, so there isn't a corresponding concept of streams. Therefore, added no-op implementations for these DeviceAPI methods. --- src/runtime/vulkan/vulkan.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/runtime/vulkan/vulkan.cc b/src/runtime/vulkan/vulkan.cc index 97241b05514e..3acc159c9829 100644 --- a/src/runtime/vulkan/vulkan.cc +++ b/src/runtime/vulkan/vulkan.cc @@ -373,29 +373,32 @@ class VulkanDeviceAPI final : public DeviceAPI { } public: - // Always use the default stream - TVMStreamHandle CreateStream(Device dev) { - LOG(FATAL) << "Not implemented"; - return nullptr; - } - - void FreeStream(Device dev, TVMStreamHandle stream) { - LOG(FATAL) << "Not implemented"; + // Current vulkan implementation has one "stream" per CPU thread, + // with all commands writing into a single command buffer that is + // submitted on a call to StreamSync. Therefore, for now, these are + // mostly no-ops. If needed in the future, could have multiple + // command buffers to act as multiple streams. + TVMStreamHandle CreateStream(Device dev) final { return nullptr; } + + void FreeStream(Device dev, TVMStreamHandle stream) final { + ICHECK_EQ(stream, static_cast(nullptr)); return; } - void SyncStreamFromTo(Device dev, TVMStreamHandle event_src, TVMStreamHandle event_dst) { - LOG(FATAL) << "Not implemented"; + // Syncing two streams is a nop, since there is only one stream. + void SyncStreamFromTo(Device dev, TVMStreamHandle event_src, TVMStreamHandle event_dst) final { + ICHECK_EQ(event_src, static_cast(nullptr)); + ICHECK_EQ(event_dst, static_cast(nullptr)); return; } void StreamSync(Device dev, TVMStreamHandle stream) final { - ICHECK(stream == nullptr); + ICHECK_EQ(stream, static_cast(nullptr)); VulkanThreadEntry::ThreadLocal()->Stream(dev.device_id)->Synchronize(); } void SetStream(Device dev, TVMStreamHandle stream) final { - LOG(FATAL) << "Not implemented"; + ICHECK_EQ(stream, static_cast(nullptr)); return; }