From d538513fce27c9442553b39a1cff9e482c922196 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Tue, 11 Dec 2018 18:07:07 +0000 Subject: [PATCH] fix the compile error on mac --- paddle/fluid/operators/jit/gen_base.h | 6 +++--- paddle/fluid/operators/jit/helper.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/operators/jit/gen_base.h b/paddle/fluid/operators/jit/gen_base.h index 3b874cf2b0..586f4389c0 100644 --- a/paddle/fluid/operators/jit/gen_base.h +++ b/paddle/fluid/operators/jit/gen_base.h @@ -30,13 +30,13 @@ class GenBase : public Kernel { virtual const char* name() const = 0; virtual size_t getSize() const = 0; virtual const unsigned char* getCodeInternal() = 0; - template - const FUNC getCode() { + template + Func getCode() { const unsigned char* code = this->getCodeInternal(); if (FLAGS_dump_jitcode) { this->dumpCode(code); } - return reinterpret_cast(code); + return reinterpret_cast(const_cast(code)); } protected: diff --git a/paddle/fluid/operators/jit/helper.h b/paddle/fluid/operators/jit/helper.h index 09a6bc3d9d..b7580f6efb 100644 --- a/paddle/fluid/operators/jit/helper.h +++ b/paddle/fluid/operators/jit/helper.h @@ -30,7 +30,7 @@ namespace jit { template -inline const Func GetJitCode(Attr attr) { +inline Func GetJitCode(Attr attr) { size_t key = JitCodeKey(attr); auto& codes = JitCodePool().Instance(); if (codes.Has(key)) { @@ -80,7 +80,7 @@ inline Func GetRefer() { template -const Func Get(Attr attr) { +Func Get(Attr attr) { auto jitfunc = GetJitCode(attr); if (jitfunc) { return jitfunc; -- GitLab