Permalink
Browse files

Stick current NvDlaBackend to fp16

  • Loading branch information...
lubatang committed Jan 22, 2019
1 parent b742bc6 commit 715a5177b16400f87c55d194bb2198bca27affec
@@ -152,7 +152,6 @@ void NvDlaBackend::RegisterLowers(LowerRegistry& pRegistry) const

}


//===----------------------------------------------------------------------===//
// Non member functions
//===----------------------------------------------------------------------===//
@@ -163,6 +162,6 @@ TargetBackend* CreateNvDlaBackend(const TargetOptions& pOptions)

extern "C" void InitializeNvDlaONNCBackend()
{
onnc::TargetRegistry::RegisterTargetBackend(getTheNvDlaTarget(),
onnc::TargetRegistry::RegisterTargetBackend(getFp16NvDlaTarget(),
CreateNvDlaBackend);
}
@@ -11,30 +11,35 @@

using namespace onnc;

//===----------------------------------------------------------------------===//
// Non-member functions
//===----------------------------------------------------------------------===//
namespace {

static unsigned int NvDlaMatchFn(const Quadruple& pQuadruple)
template<Quadruple::SubArchType SubArch>
unsigned int NvDlaMatchFn(const Quadruple& pQuadruple)
{
unsigned int score = 0;
if (Quadruple::nvdla == pQuadruple.getArch()) {
score += 10;
if (SubArch == pQuadruple.getSubArch())
score += 10;
}

return score;
}

} // anonymous namespace

Target& onnc::getTheNvDlaTarget()
Target& onnc::getFp16NvDlaTarget()
{
static Target nvdla_target;
return nvdla_target;
}


//===----------------------------------------------------------------------===//
// Initialization Function.
//===----------------------------------------------------------------------===//
extern "C" void InitializeNvDlaONNCPlatform() {
onnc::TargetRegistry::RegisterTarget(onnc::getTheNvDlaTarget(), "nvdla",
"NvDla DLA", NvDlaMatchFn);
onnc::TargetRegistry::RegisterTarget(
onnc::getFp16NvDlaTarget(),
"nvdla fp16",
"NvDla Fp16",
NvDlaMatchFn<Quadruple::NvDlaSubArch_fp16>);
}
@@ -11,7 +11,7 @@

namespace onnc {

Target& getTheNvDlaTarget();
Target& getFp16NvDlaTarget();

} // namespace of onnc

0 comments on commit 715a517

Please sign in to comment.