From f3250097bccbade4168b02417e04fee5cd990494 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Wed, 12 Dec 2018 08:20:25 +0000 Subject: [PATCH] fix bug and mac compile --- paddle/fluid/operators/jit/benchmark.cc | 3 +-- paddle/fluid/operators/jit/helper.h | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/paddle/fluid/operators/jit/benchmark.cc b/paddle/fluid/operators/jit/benchmark.cc index ef7ccc64adf..5cc82b69f8b 100644 --- a/paddle/fluid/operators/jit/benchmark.cc +++ b/paddle/fluid/operators/jit/benchmark.cc @@ -12,9 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -// #include // for memcpy -// #include #include +#include #include #include #include "gflags/gflags.h" diff --git a/paddle/fluid/operators/jit/helper.h b/paddle/fluid/operators/jit/helper.h index 11bbd6a56cf..d1bbe103814 100644 --- a/paddle/fluid/operators/jit/helper.h +++ b/paddle/fluid/operators/jit/helper.h @@ -49,15 +49,17 @@ inline typename KernelTuples::func_type GetJitCode( // pool: (KernelKey(type, place), vector) auto& creator_map = JitCodeCreatorPool().Instance().AllCreators(); auto iter = creator_map.find(kkey); - auto& creators = iter->second; - for (auto& cur : creators) { - auto i = dynamic_cast*>(cur.get()); - if (i && i->UseMe(attr)) { - auto p = i->CreateJitCode(attr); - if (p) { - auto f = p->template getCode(); - codes.Insert(key, std::move(p)); - return f; + if (iter != creator_map.end()) { + auto& creators = iter->second; + for (auto& cur : creators) { + auto i = dynamic_cast*>(cur.get()); + if (i && i->UseMe(attr)) { + auto p = i->CreateJitCode(attr); + if (p) { + auto f = p->template getCode(); + codes.Insert(key, std::move(p)); + return f; + } } } } -- GitLab