{"action":"created","comment":{"url":"https://api.github.com/repos/pfnet-research/menoh/pulls/comments/216922864","pull_request_review_id":154514819,"id":216922864,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjkyMjg2NA==","diff_hunk":"@@ -0,0 +1,163 @@\n+#include <menoh/mkldnn_with_generic_fallback/backend/mkldnn/mkldnn_context.hpp>\n+#include <menoh/mkldnn_with_generic_fallback/backend/mkldnn/operator.hpp>\n+\n+#include <menoh/mkldnn/utility.hpp>\n+\n+namespace menoh_impl {\n+    namespace mkldnn_with_generic_fallback_backend {\n+        namespace mkldnn_backend {\n+\n+            mkldnn_context::mkldnn_context() : context() {\n+                procedure_factory_table_.emplace(\n+                  \"Gemm\", mkldnn_with_generic_fallback_backend::mkldnn_backend::\n+                            make_gemm);\n+            }\n+\n+            optional<std::tuple<std::vector<procedure>, int>>\n+            mkldnn_context::do_process_node_list(\n+              std::string const& context_name, int current_index,\n+              std::vector<node> const& node_list,\n+              std::unordered_map<std::string, array> const&\n+                common_parameter_table,\n+              std::unordered_map<std::string, array> const& common_input_table,\n+              std::unordered_map<std::string, array> const&\n+                required_output_table,\n+              std::vector<\n+                std::pair<std::string, std::unique_ptr<context>>> const&\n+                context_list,\n+              logger_handle logger) {\n+                auto first_node_index = current_index;\n+                std::vector<procedure> procedure_list;\n+                std::vector<mkldnn::primitive> primitive_list;\n+\n+                for(; current_index < node_list.size(); ++current_index) {\n+                    auto const& node = node_list.at(current_index);\n+                    std::vector<array> input_list;\n+                    std::vector<procedure> new_copy_procedure_list;\n+\n+                    for(auto const& input_name : node.input_name_list) {\n+                        do {\n+                            // search in self variable table\n+                            auto found_from_variable_memory_table =\n+                              variable_memory_table_.find(input_name);\n+                            if(found_from_variable_memory_table !=\n+                               variable_memory_table_.end()) {\n+                                *logger << input_name\n+                                        << \" is found in self variable table\"\n+                                        << std::endl;\n+                                input_list.push_back(\n+                                  menoh_impl::mkldnn_backend::memory_to_array(\n+                                    found_from_variable_memory_table->second));\n+                                break;\n+                            }\n+\n+                            // search in common parameter and input table\n+                            auto found_from_common_table =\n+                              [&](auto const& table) {\n+                                  auto found = table.find(input_name);\n+                                  if(found != table.end()) {\n+                                      assert(found->second.dims().size() == 2 ||\n+                                             found->second.dims().size() == 4);\n+                                      input_list.push_back(found->second);\n+                                      return true;\n+                                  }\n+                                  return false;\n+                              };\n+                            if(found_from_common_table(\n+                                 common_parameter_table)) {\n+                                *logger << input_name\n+                                        << \" is found in common parameter table\"\n+                                        << std::endl;\n+                                break;\n+                            }\n+                            if(found_from_common_table(common_input_table)) {\n+                                *logger << input_name\n+                                        << \" is found in common input table\"\n+                                        << std::endl;\n+                                break;\n+                            }\n+\n+                            // search in other contexts' variable table\n+                            bool is_found_from_other_context = false;\n+                            for(auto const& context_pair : context_list) {\n+                                if(context_pair.first == context_name) {\n+                                    continue; // skip self\n+                                }\n+                                auto found =\n+                                  context_pair.second->try_to_get_variable(\n+                                    input_name);\n+                                if(found) {\n+                                    *logger << input_name\n+                                            << \" is found in other context's \"\n+                                               \"varibale table: \"\n+                                            << context_pair.first << std::endl;\n+                                    procedure copy_proc; // copy from other\n+                                                         // context to array\n+                                    array arr;\n+                                    std::tie(copy_proc, arr) = *found;\n+                                    assert(arr.dims().size() == 2 ||\n+                                           arr.dims().size() == 4);\n+                                    new_copy_procedure_list.push_back(\n+                                      copy_proc);\n+                                    input_list.push_back(arr);\n+                                    auto format =\n+                                      arr.dims().size() == 2\n+                                        ? mkldnn::memory::format::nc\n+                                        : mkldnn::memory::format::nchw;\n+                                    is_found_from_other_context = true;\n+                                    break;\n+                                }\n+                            }\n+                            assert(is_found_from_other_context);\n+                        } while(false);\n+                    }\n+\n+                    // make primitives and\n+                    std::vector<mkldnn::primitive> new_primitive_list;\n+                    std::vector<std::pair<std::string, mkldnn::memory>>\n+                      new_output_memory_list;\n+                    std::vector<mkldnn::memory> new_temp_memory_list;\n+                    try {\n+                        auto factory =\n+                          procedure_factory_table_.at(node.op_type);\n+                        std::tie(new_primitive_list, new_output_memory_list,\n+                                 new_temp_memory_list) =\n+                          factory.operator()(current_index, node_list,\n+                                             input_list, required_output_table,\n+                                             engine_);\n+                    } catch(...) { break; }\n+                    primitive_list.insert(primitive_list.end(),\n+                                          new_primitive_list.begin(),\n+                                          new_primitive_list.end());\n+                    // add copy procedures\n+                    procedure_list.insert(\n+                      procedure_list.end(),\n+                      std::make_move_iterator(new_copy_procedure_list.begin()),\n+                      std::make_move_iterator(new_copy_procedure_list.end()));\n+\n+                    // update context\n+                    variable_memory_table_.insert(\n+                      std::make_move_iterator(new_output_memory_list.begin()),\n+                      std::make_move_iterator(new_output_memory_list.end()));\n+                    temp_memory_list_.insert(\n+                      temp_memory_list_.end(),\n+                      std::make_move_iterator(new_temp_memory_list.begin()),\n+                      std::make_move_iterator(new_temp_memory_list.end()));\n+                }\n+\n+                // when any nodes are not processed","path":"menoh/mkldnn_with_generic_fallback/backend/mkldnn/mkldnn_context.cpp","position":148,"original_position":148,"commit_id":"8bfe8fcc5f8ce53e990a711379458651798628d7","original_commit_id":"8bfe8fcc5f8ce53e990a711379458651798628d7","user":{"login":"msakai","id":157688,"node_id":"MDQ6VXNlcjE1NzY4OA==","avatar_url":"https://avatars1.githubusercontent.com/u/157688?v=4","gravatar_id":"","url":"https://api.github.com/users/msakai","html_url":"https://github.com/msakai","followers_url":"https://api.github.com/users/msakai/followers","following_url":"https://api.github.com/users/msakai/following{/other_user}","gists_url":"https://api.github.com/users/msakai/gists{/gist_id}","starred_url":"https://api.github.com/users/msakai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msakai/subscriptions","organizations_url":"https://api.github.com/users/msakai/orgs","repos_url":"https://api.github.com/users/msakai/repos","events_url":"https://api.github.com/users/msakai/events{/privacy}","received_events_url":"https://api.github.com/users/msakai/received_events","type":"User","site_admin":false},"body":"\"when no nodes were processed\" might be better.","created_at":"2018-09-12T07:28:01Z","updated_at":"2018-09-12T07:28:01Z","html_url":"https://github.com/pfnet-research/menoh/pull/98#discussion_r216922864","pull_request_url":"https://api.github.com/repos/pfnet-research/menoh/pulls/98","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pfnet-research/menoh/pulls/comments/216922864"},"html":{"href":"https://github.com/pfnet-research/menoh/pull/98#discussion_r216922864"},"pull_request":{"href":"https://api.github.com/repos/pfnet-research/menoh/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/pfnet-research/menoh/pulls/98","id":214123551,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MTIzNTUx","html_url":"https://github.com/pfnet-research/menoh/pull/98","diff_url":"https://github.com/pfnet-research/menoh/pull/98.diff","patch_url":"https://github.com/pfnet-research/menoh/pull/98.patch","issue_url":"https://api.github.com/repos/pfnet-research/menoh/issues/98","number":98,"state":"open","locked":false,"title":"Mkldnn with generic fallback backend","user":{"login":"okdshin","id":1490699,"node_id":"MDQ6VXNlcjE0OTA2OTk=","avatar_url":"https://avatars1.githubusercontent.com/u/1490699?v=4","gravatar_id":"","url":"https://api.github.com/users/okdshin","html_url":"https://github.com/okdshin","followers_url":"https://api.github.com/users/okdshin/followers","following_url":"https://api.github.com/users/okdshin/following{/other_user}","gists_url":"https://api.github.com/users/okdshin/gists{/gist_id}","starred_url":"https://api.github.com/users/okdshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okdshin/subscriptions","organizations_url":"https://api.github.com/users/okdshin/orgs","repos_url":"https://api.github.com/users/okdshin/repos","events_url":"https://api.github.com/users/okdshin/events{/privacy}","received_events_url":"https://api.github.com/users/okdshin/received_events","type":"User","site_admin":false},"body":"This PR adds new backend that  uses MKLDNN and \"Generic\" (i.e. pure C++ implementation). When op is not supported by MKLDNN, Generic is used (fallback).\r\nFYI: This PR contains fallback system only so operators must be added.\r\nThis PR depends on PR #94. ","created_at":"2018-09-09T02:06:22Z","updated_at":"2018-09-12T07:28:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac95a7013e924aa4d44cd9d727e75d9846cd6d44","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pfnet-research/menoh/pulls/98/commits","review_comments_url":"https://api.github.com/repos/pfnet-research/menoh/pulls/98/comments","review_comment_url":"https://api.github.com/repos/pfnet-research/menoh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pfnet-research/menoh/issues/98/comments","statuses_url":"https://api.github.com/repos/pfnet-research/menoh/statuses/8bfe8fcc5f8ce53e990a711379458651798628d7","head":{"label":"pfnet-research:mkldnn_with_generic_fallback_backend","ref":"mkldnn_with_generic_fallback_backend","sha":"8bfe8fcc5f8ce53e990a711379458651798628d7","user":{"login":"pfnet-research","id":23070723,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcwNzIz","avatar_url":"https://avatars2.githubusercontent.com/u/23070723?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet-research","html_url":"https://github.com/pfnet-research","followers_url":"https://api.github.com/users/pfnet-research/followers","following_url":"https://api.github.com/users/pfnet-research/following{/other_user}","gists_url":"https://api.github.com/users/pfnet-research/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet-research/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet-research/subscriptions","organizations_url":"https://api.github.com/users/pfnet-research/orgs","repos_url":"https://api.github.com/users/pfnet-research/repos","events_url":"https://api.github.com/users/pfnet-research/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet-research/received_events","type":"Organization","site_admin":false},"repo":{"id":138105757,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgxMDU3NTc=","name":"menoh","full_name":"pfnet-research/menoh","owner":{"login":"pfnet-research","id":23070723,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcwNzIz","avatar_url":"https://avatars2.githubusercontent.com/u/23070723?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet-research","html_url":"https://github.com/pfnet-research","followers_url":"https://api.github.com/users/pfnet-research/followers","following_url":"https://api.github.com/users/pfnet-research/following{/other_user}","gists_url":"https://api.github.com/users/pfnet-research/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet-research/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet-research/subscriptions","organizations_url":"https://api.github.com/users/pfnet-research/orgs","repos_url":"https://api.github.com/users/pfnet-research/repos","events_url":"https://api.github.com/users/pfnet-research/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet-research/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfnet-research/menoh","description":"Menoh: fast DNN inference library with multiple programming language support","fork":false,"url":"https://api.github.com/repos/pfnet-research/menoh","forks_url":"https://api.github.com/repos/pfnet-research/menoh/forks","keys_url":"https://api.github.com/repos/pfnet-research/menoh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet-research/menoh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet-research/menoh/teams","hooks_url":"https://api.github.com/repos/pfnet-research/menoh/hooks","issue_events_url":"https://api.github.com/repos/pfnet-research/menoh/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet-research/menoh/events","assignees_url":"https://api.github.com/repos/pfnet-research/menoh/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet-research/menoh/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet-research/menoh/tags","blobs_url":"https://api.github.com/repos/pfnet-research/menoh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet-research/menoh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet-research/menoh/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet-research/menoh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet-research/menoh/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet-research/menoh/languages","stargazers_url":"https://api.github.com/repos/pfnet-research/menoh/stargazers","contributors_url":"https://api.github.com/repos/pfnet-research/menoh/contributors","subscribers_url":"https://api.github.com/repos/pfnet-research/menoh/subscribers","subscription_url":"https://api.github.com/repos/pfnet-research/menoh/subscription","commits_url":"https://api.github.com/repos/pfnet-research/menoh/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet-research/menoh/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet-research/menoh/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet-research/menoh/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet-research/menoh/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet-research/menoh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet-research/menoh/merges","archive_url":"https://api.github.com/repos/pfnet-research/menoh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet-research/menoh/downloads","issues_url":"https://api.github.com/repos/pfnet-research/menoh/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet-research/menoh/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet-research/menoh/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet-research/menoh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet-research/menoh/labels{/name}","releases_url":"https://api.github.com/repos/pfnet-research/menoh/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet-research/menoh/deployments","created_at":"2018-06-21T01:48:20Z","updated_at":"2018-09-11T06:07:42Z","pushed_at":"2018-09-12T05:12:07Z","git_url":"git://github.com/pfnet-research/menoh.git","ssh_url":"git@github.com:pfnet-research/menoh.git","clone_url":"https://github.com/pfnet-research/menoh.git","svn_url":"https://github.com/pfnet-research/menoh","homepage":"","size":728,"stargazers_count":181,"watchers_count":181,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":18,"open_issues":21,"watchers":181,"default_branch":"master"}},"base":{"label":"pfnet-research:master","ref":"master","sha":"9a49f52aecb2e97cc1462f2f8547ef914499ceb8","user":{"login":"pfnet-research","id":23070723,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcwNzIz","avatar_url":"https://avatars2.githubusercontent.com/u/23070723?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet-research","html_url":"https://github.com/pfnet-research","followers_url":"https://api.github.com/users/pfnet-research/followers","following_url":"https://api.github.com/users/pfnet-research/following{/other_user}","gists_url":"https://api.github.com/users/pfnet-research/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet-research/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet-research/subscriptions","organizations_url":"https://api.github.com/users/pfnet-research/orgs","repos_url":"https://api.github.com/users/pfnet-research/repos","events_url":"https://api.github.com/users/pfnet-research/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet-research/received_events","type":"Organization","site_admin":false},"repo":{"id":138105757,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgxMDU3NTc=","name":"menoh","full_name":"pfnet-research/menoh","owner":{"login":"pfnet-research","id":23070723,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcwNzIz","avatar_url":"https://avatars2.githubusercontent.com/u/23070723?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet-research","html_url":"https://github.com/pfnet-research","followers_url":"https://api.github.com/users/pfnet-research/followers","following_url":"https://api.github.com/users/pfnet-research/following{/other_user}","gists_url":"https://api.github.com/users/pfnet-research/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet-research/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet-research/subscriptions","organizations_url":"https://api.github.com/users/pfnet-research/orgs","repos_url":"https://api.github.com/users/pfnet-research/repos","events_url":"https://api.github.com/users/pfnet-research/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet-research/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfnet-research/menoh","description":"Menoh: fast DNN inference library with multiple programming language support","fork":false,"url":"https://api.github.com/repos/pfnet-research/menoh","forks_url":"https://api.github.com/repos/pfnet-research/menoh/forks","keys_url":"https://api.github.com/repos/pfnet-research/menoh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet-research/menoh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet-research/menoh/teams","hooks_url":"https://api.github.com/repos/pfnet-research/menoh/hooks","issue_events_url":"https://api.github.com/repos/pfnet-research/menoh/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet-research/menoh/events","assignees_url":"https://api.github.com/repos/pfnet-research/menoh/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet-research/menoh/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet-research/menoh/tags","blobs_url":"https://api.github.com/repos/pfnet-research/menoh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet-research/menoh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet-research/menoh/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet-research/menoh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet-research/menoh/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet-research/menoh/languages","stargazers_url":"https://api.github.com/repos/pfnet-research/menoh/stargazers","contributors_url":"https://api.github.com/repos/pfnet-research/menoh/contributors","subscribers_url":"https://api.github.com/repos/pfnet-research/menoh/subscribers","subscription_url":"https://api.github.com/repos/pfnet-research/menoh/subscription","commits_url":"https://api.github.com/repos/pfnet-research/menoh/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet-research/menoh/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet-research/menoh/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet-research/menoh/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet-research/menoh/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet-research/menoh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet-research/menoh/merges","archive_url":"https://api.github.com/repos/pfnet-research/menoh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet-research/menoh/downloads","issues_url":"https://api.github.com/repos/pfnet-research/menoh/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet-research/menoh/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet-research/menoh/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet-research/menoh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet-research/menoh/labels{/name}","releases_url":"https://api.github.com/repos/pfnet-research/menoh/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet-research/menoh/deployments","created_at":"2018-06-21T01:48:20Z","updated_at":"2018-09-11T06:07:42Z","pushed_at":"2018-09-12T05:12:07Z","git_url":"git://github.com/pfnet-research/menoh.git","ssh_url":"git@github.com:pfnet-research/menoh.git","clone_url":"https://github.com/pfnet-research/menoh.git","svn_url":"https://github.com/pfnet-research/menoh","homepage":"","size":728,"stargazers_count":181,"watchers_count":181,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":18,"open_issues":21,"watchers":181,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pfnet-research/menoh/pulls/98"},"html":{"href":"https://github.com/pfnet-research/menoh/pull/98"},"issue":{"href":"https://api.github.com/repos/pfnet-research/menoh/issues/98"},"comments":{"href":"https://api.github.com/repos/pfnet-research/menoh/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/pfnet-research/menoh/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/pfnet-research/menoh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pfnet-research/menoh/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/pfnet-research/menoh/statuses/8bfe8fcc5f8ce53e990a711379458651798628d7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"msakai"}}