You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2021/05/04 11:55:05 UTC
[tvm] branch main updated: [Vulkan][Runtime] Added dummy
implementations for TVMStreamHandle operations (#7969)
This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new bfd8c67 [Vulkan][Runtime] Added dummy implementations for TVMStreamHandle operations (#7969)
bfd8c67 is described below
commit bfd8c676aa6dad56624619ebe822e0475c49026a
Author: Lunderberg <Lu...@users.noreply.github.com>
AuthorDate: Tue May 4 04:54:44 2021 -0700
[Vulkan][Runtime] Added dummy implementations for TVMStreamHandle operations (#7969)
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.
Co-authored-by: Eric Lunderberg <el...@octoml.ai>
---
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 97241b0..3acc159 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<void*>(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<void*>(nullptr));
+ ICHECK_EQ(event_dst, static_cast<void*>(nullptr));
return;
}
void StreamSync(Device dev, TVMStreamHandle stream) final {
- ICHECK(stream == nullptr);
+ ICHECK_EQ(stream, static_cast<void*>(nullptr));
VulkanThreadEntry::ThreadLocal()->Stream(dev.device_id)->Synchronize();
}
void SetStream(Device dev, TVMStreamHandle stream) final {
- LOG(FATAL) << "Not implemented";
+ ICHECK_EQ(stream, static_cast<void*>(nullptr));
return;
}