Browse Source

feat(core): move more exceptions to base exception

mgb::cg::GraphError
mgb::NumRangeChecker::Error
mgb::VarSanityCheck::Error
GitOrigin-RevId: 4d79e3629c
tags/v0.6.0
Megvii Engine Team 5 years ago
parent
commit
6137adc05a
3 changed files with 26 additions and 14 deletions
  1. +10
    -5
      src/core/include/megbrain/graph/bases.h
  2. +8
    -5
      src/plugin/include/megbrain/plugin/num_range_checker.h
  3. +8
    -4
      src/plugin/include/megbrain/plugin/var_sanity_check.h

+ 10
- 5
src/core/include/megbrain/graph/bases.h View File

@@ -48,6 +48,15 @@

namespace mgb {

class GraphError : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};

} // namespace mgb

namespace mgb {

//! computing graph
namespace cg {

@@ -55,11 +64,7 @@ namespace static_infer {
struct DepElement;
};

class GraphError: public MegBrainError {
public:
using MegBrainError::MegBrainError;
};

using GraphError = mgb::GraphError;
class OperatorNodeBase;
class ComputingGraph;



+ 8
- 5
src/plugin/include/megbrain/plugin/num_range_checker.h View File

@@ -16,6 +16,13 @@
#include "megbrain/graph/event.h"
#include "megbrain/utils/thin/hash_table.h"

namespace mgb {
class NumRangeCheckerError final : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};
} // namespace mgb

namespace mgb {

/*!
@@ -47,11 +54,7 @@ namespace mgb {
std::string format_msg(const HostTensorND &hv, float range);

public:
class Error final: public MegBrainError {
public:
using MegBrainError::MegBrainError;
};

using Error = NumRangeCheckerError;
NumRangeChecker(cg::ComputingGraph *graph, float range);
};
}


+ 8
- 4
src/plugin/include/megbrain/plugin/var_sanity_check.h View File

@@ -20,6 +20,13 @@
#include <cstdint>
#include <thread>

namespace mgb {
class VarSanityCheckError : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};
} // namespace mgb

namespace mgb {

/*!
@@ -87,10 +94,7 @@ class VarSanityCheck final : public PluginBase {
public:
VarSanityCheck(cg::ComputingGraph* graph);

class Error : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};
using Error = VarSanityCheckError;

/*!
* \brief perform basic sanity check after opr exec


Loading…
Cancel
Save