提交 d538513f 编写于 作者: T tensor-tang

fix the compile error on mac

上级 28eb7d84
...@@ -30,13 +30,13 @@ class GenBase : public Kernel { ...@@ -30,13 +30,13 @@ class GenBase : public Kernel {
virtual const char* name() const = 0; virtual const char* name() const = 0;
virtual size_t getSize() const = 0; virtual size_t getSize() const = 0;
virtual const unsigned char* getCodeInternal() = 0; virtual const unsigned char* getCodeInternal() = 0;
template <typename FUNC> template <typename Func>
const FUNC getCode() { Func getCode() {
const unsigned char* code = this->getCodeInternal(); const unsigned char* code = this->getCodeInternal();
if (FLAGS_dump_jitcode) { if (FLAGS_dump_jitcode) {
this->dumpCode(code); this->dumpCode(code);
} }
return reinterpret_cast<const FUNC>(code); return reinterpret_cast<Func>(const_cast<unsigned char*>(code));
} }
protected: protected:
......
...@@ -30,7 +30,7 @@ namespace jit { ...@@ -30,7 +30,7 @@ namespace jit {
template <KernelType KT, typename T, typename Func, typename Attr, template <KernelType KT, typename T, typename Func, typename Attr,
typename PlaceType> typename PlaceType>
inline const Func GetJitCode(Attr attr) { inline Func GetJitCode(Attr attr) {
size_t key = JitCodeKey<Attr>(attr); size_t key = JitCodeKey<Attr>(attr);
auto& codes = JitCodePool<KT>().Instance(); auto& codes = JitCodePool<KT>().Instance();
if (codes.Has(key)) { if (codes.Has(key)) {
...@@ -80,7 +80,7 @@ inline Func GetRefer() { ...@@ -80,7 +80,7 @@ inline Func GetRefer() {
template <KernelType KT, typename T, typename Func, typename Attr, template <KernelType KT, typename T, typename Func, typename Attr,
typename PlaceType = platform::CPUPlace> typename PlaceType = platform::CPUPlace>
const Func Get(Attr attr) { Func Get(Attr attr) {
auto jitfunc = GetJitCode<KT, T, Func, Attr, PlaceType>(attr); auto jitfunc = GetJitCode<KT, T, Func, Attr, PlaceType>(attr);
if (jitfunc) { if (jitfunc) {
return jitfunc; return jitfunc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册