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

fix bug and mac compile

上级 bc0df6a9
...@@ -12,9 +12,8 @@ ...@@ -12,9 +12,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. */ * limitations under the License. */
// #include <cstring> // for memcpy
// #include <random>
#include <iostream> #include <iostream>
#include <random>
#include <string> #include <string>
#include <vector> #include <vector>
#include "gflags/gflags.h" #include "gflags/gflags.h"
......
...@@ -49,15 +49,17 @@ inline typename KernelTuples::func_type GetJitCode( ...@@ -49,15 +49,17 @@ inline typename KernelTuples::func_type GetJitCode(
// pool: (KernelKey(type, place), vector<GenCreatorPtr>) // pool: (KernelKey(type, place), vector<GenCreatorPtr>)
auto& creator_map = JitCodeCreatorPool().Instance().AllCreators(); auto& creator_map = JitCodeCreatorPool().Instance().AllCreators();
auto iter = creator_map.find(kkey); auto iter = creator_map.find(kkey);
auto& creators = iter->second; if (iter != creator_map.end()) {
for (auto& cur : creators) { auto& creators = iter->second;
auto i = dynamic_cast<const JitCodeCreator<Attr>*>(cur.get()); for (auto& cur : creators) {
if (i && i->UseMe(attr)) { auto i = dynamic_cast<const JitCodeCreator<Attr>*>(cur.get());
auto p = i->CreateJitCode(attr); if (i && i->UseMe(attr)) {
if (p) { auto p = i->CreateJitCode(attr);
auto f = p->template getCode<Func>(); if (p) {
codes.Insert(key, std::move(p)); auto f = p->template getCode<Func>();
return f; codes.Insert(key, std::move(p));
return f;
}
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册