From 181af56cbed74404d4912a785dc97f0f67b0988e Mon Sep 17 00:00:00 2001 From: jackzhang235 <56432943+jackzhang235@users.noreply.github.com> Date: Tue, 31 Mar 2020 13:24:19 +0800 Subject: [PATCH] [MLU][lib_increased] add some basic mlu definition (#3275) --- lite/api/paddle_place.h | 3 ++- lite/core/context.h | 1 + lite/core/op_registry.cc | 12 ++++++++++++ lite/core/op_registry.h | 27 ++++++++++++++++++++++++++- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lite/api/paddle_place.h b/lite/api/paddle_place.h index cd68ca5187..1de46a3946 100644 --- a/lite/api/paddle_place.h +++ b/lite/api/paddle_place.h @@ -54,7 +54,8 @@ enum class TargetType : int { kXPU = 9, kBM = 10, kAny = 6, // any target - NUM = 11, // number of fields. + kMLU = 11, + NUM = 12, // number of fields. }; enum class PrecisionType : int { kUnk = 0, diff --git a/lite/core/context.h b/lite/core/context.h index 978fb5d67a..88fe00d0f2 100644 --- a/lite/core/context.h +++ b/lite/core/context.h @@ -52,6 +52,7 @@ using XPUContext = Context; using OpenCLContext = Context; using FPGAContext = Context; using BMContext = Context; +using MLUContext = Context; template <> class Context { diff --git a/lite/core/op_registry.cc b/lite/core/op_registry.cc index 4b6d3282ed..fe1dff3c99 100644 --- a/lite/core/op_registry.cc +++ b/lite/core/op_registry.cc @@ -107,6 +107,9 @@ std::list> KernelRegistry::Create( case TARGET(kBM): { CREATE_KERNEL(kBM); } break; + case TARGET(kMLU): { + CREATE_KERNEL(kMLU); + } break; default: CHECK(false) << "not supported kernel target " << TargetToStr(target); } @@ -139,6 +142,15 @@ KernelRegistry::KernelRegistry() INIT_FOR(kCUDA, kInt64, kNCHW); INIT_FOR(kCUDA, kInt64, kNHWC); + INIT_FOR(kMLU, kFloat, kNHWC); + INIT_FOR(kMLU, kFloat, kNCHW); + INIT_FOR(kMLU, kFP16, kNHWC); + INIT_FOR(kMLU, kFP16, kNCHW); + INIT_FOR(kMLU, kInt8, kNHWC); + INIT_FOR(kMLU, kInt8, kNCHW); + INIT_FOR(kMLU, kInt16, kNHWC); + INIT_FOR(kMLU, kInt16, kNCHW); + INIT_FOR(kHost, kFloat, kNCHW); INIT_FOR(kHost, kAny, kNCHW); INIT_FOR(kHost, kFloat, kNHWC); diff --git a/lite/core/op_registry.h b/lite/core/op_registry.h index 6f8f1e8bc6..3c41c1fd8a 100644 --- a/lite/core/op_registry.h +++ b/lite/core/op_registry.h @@ -268,7 +268,32 @@ class KernelRegistry final { DATALAYOUT(kAny)> *, // KernelRegistryForTarget * // + DATALAYOUT(kAny)> *, // + + KernelRegistryForTarget *, // + KernelRegistryForTarget *, // + KernelRegistryForTarget *, // + KernelRegistryForTarget *, // + KernelRegistryForTarget *, // + KernelRegistryForTarget *, // + KernelRegistryForTarget *, // + KernelRegistryForTarget * // >; KernelRegistry(); -- GitLab