Commit 8eebf5f6 by Tianqi Chen Committed by GitHub

[RUNTIME] Fault tolerant vulkan init error (#1107)

parent dc62760e
...@@ -661,6 +661,7 @@ void VulkanWorkspace::Init() { ...@@ -661,6 +661,7 @@ void VulkanWorkspace::Init() {
std::lock_guard<std::mutex> lock(this->mu); std::lock_guard<std::mutex> lock(this->mu);
if (initialized_) return; if (initialized_) return;
initialized_ = true; initialized_ = true;
try {
instance_ = CreateInstance(); instance_ = CreateInstance();
context_ = GetContext(instance_); context_ = GetContext(instance_);
LOG(INFO) << "Initialzie Vulkan with " << context_.size() << " devices.."; LOG(INFO) << "Initialzie Vulkan with " << context_.size() << " devices..";
...@@ -669,6 +670,10 @@ void VulkanWorkspace::Init() { ...@@ -669,6 +670,10 @@ void VulkanWorkspace::Init() {
<< ")=\'" << context_[i].phy_device_prop.deviceName << ")=\'" << context_[i].phy_device_prop.deviceName
<< "\' phy_dev_id=" << context_[i].phy_device; << "\' phy_dev_id=" << context_[i].phy_device;
} }
} catch (const dmlc::Error& err) {
LOG(INFO) << "Cannot initialize vulkan: " << err.what() << "\n"
<< "You can still compile vulkan module but cannot run locally";
}
} }
bool InitVulkan(TVMArgs args, TVMRetValue* rv) { bool InitVulkan(TVMArgs args, TVMRetValue* rv) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment