Browse Source

fix(dnn): fix dnn run cd4 on cpu

GitOrigin-RevId: 5eae7496e5
release-1.10
Megvii Engine Team 3 years ago
parent
commit
8f17b84ad8
2 changed files with 34 additions and 3 deletions
  1. +21
    -0
      dnn/include/megdnn/handle.h
  2. +13
    -3
      dnn/src/common/relayout_format.cpp

+ 21
- 0
dnn/include/megdnn/handle.h View File

@@ -26,6 +26,27 @@ public:
ATLAS = 13,
CAMBRICON = 12,
};
static std::string handle_type_name(HandleType handle) {
#define INSTANCE_HANDLE(name) \
case HandleType::name: \
return #name

switch (handle) {
INSTANCE_HANDLE(NAIVE);
INSTANCE_HANDLE(FALLBACK);
INSTANCE_HANDLE(X86);
INSTANCE_HANDLE(ARM_COMMON);
INSTANCE_HANDLE(ARMV7);
INSTANCE_HANDLE(AARCH64);
INSTANCE_HANDLE(CUDA);
INSTANCE_HANDLE(ROCM);
INSTANCE_HANDLE(ATLAS);
INSTANCE_HANDLE(CAMBRICON);
default:
return "Unknown";
}
#undef INSTANCE_HANDLE
}

//! Device vendor
enum class HandleVendorType : uint32_t {


+ 13
- 3
dnn/src/common/relayout_format.cpp View File

@@ -395,9 +395,19 @@ void RelayoutFormat::deduce_format(TensorFormat src, TensorFormat& dst) {
(
handle()->type() != Handle::HandleType::NAIVE &&
handle()->type() != Handle::HandleType::X86)) {
megdnn_throw(
"Dump with Image2DPack4TensorFormat is not available on CUDA compnode, "
"try export CUDA_VISIBLE_DEVICES=\'\'");
if (Handle::HandleType::CUDA == handle()->type()) {
megdnn_throw(
"Dump with Image2DPack4TensorFormat is not available on CUDA "
"compnode, "
"try export CUDA_VISIBLE_DEVICES=\'\'");

} else {
auto handle_number = handle()->type();
megdnn_throw(ssprintf(
"Dump with Image2DPack4TensorFormat is not available on %s "
"compnode, try export %cGB_USE_%cEGDNN_DBG=2 ",
Handle::handle_type_name(handle_number).c_str(), 'M', 'M'));
}
}
#undef CHECK_SRC
}


Loading…
Cancel
Save