{"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/173898620","pull_request_review_id":103163419,"id":173898620,"diff_hunk":"@@ -673,42 +689,50 @@ struct JITFuncCallContext {\n \n }  // namespace\n \n+struct Pipeline::JITCallArgs {\n+    size_t size{0};\n+    const void *fixed_store[64];\n+    const void **store;\n+\n+    JITCallArgs(size_t size) : size(size) {\n+        if (size > (sizeof(fixed_store) / sizeof(fixed_store[0]))) {\n+            // TODO(zalman): Call new[]?\n+            store = (const void **)malloc(sizeof(void *) * size);\n+        } else {\n+            store = fixed_store;\n+        }\n+    }\n+\n+  ~JITCallArgs() {\n+      if (store != fixed_store) {\n+          free(store);\n+      }\n+    }\n+};\n+\n // Make a vector of void *'s to pass to the jit call using the\n // currently bound value for all of the params and image\n // params.\n-vector<const void *> Pipeline::prepare_jit_call_arguments(Realization dst, const Target &target,\n-                                                          const ParamMap &param_map, void *user_context,\n-                                                          bool is_bounds_inference) {\n+void Pipeline::prepare_jit_call_arguments(Realization dst, const Target &target,\n+                                          const ParamMap &param_map, void *user_context,\n+                                          bool is_bounds_inference, JITCallArgs &args_result) {\n     user_assert(defined()) << \"Can't realize an undefined Pipeline\\n\";\n \n     compile_jit(target);\n \n     JITModule &compiled_module = contents->jit_module;\n     internal_assert(compiled_module.argv_function());\n \n-    struct OutputBufferType {\n-        Function func;\n-        Type type;\n-        int dims;\n-    };\n-    vector<OutputBufferType> output_buffer_types;\n-    for (Function f : contents->outputs) {\n-        for (Type t : f.output_types()) {\n-            OutputBufferType obt = {f, t, f.dimensions()};\n-            output_buffer_types.push_back(obt);\n-        }\n-    }\n-\n-    user_assert(output_buffer_types.size() == dst.size())\n+    user_assert(contents->output_buffer_types.size() == dst.size())\n         << \"Realization contains wrong number of Images (\" << dst.size()\n-        << \") for realizing pipeline with \" << output_buffer_types.size()\n+        << \") for realizing pipeline with \" << contents->output_buffer_types.size()\n         << \" outputs\\n\";\n \n     // Check the type and dimensionality of the buffer\n     for (size_t i = 0; i < dst.size(); i++) {\n-        Function func = output_buffer_types[i].func;\n-        int  dims = output_buffer_types[i].dims;\n-        Type type = output_buffer_types[i].type;\n+        Function &func = contents->output_buffer_types[i].func;\n+        int  dims = contents->output_buffer_types[i].dims;\n+        Type &type = contents->output_buffer_types[i].type;\n         user_assert(dst[i].dimensions() == dims)","path":"src/Pipeline.cpp","position":122,"original_position":122,"commit_id":"53705531ad981e7d98d3bd44af190bb570bc7eef","original_commit_id":"53705531ad981e7d98d3bd44af190bb570bc7eef","user":{"login":"zvookin","id":1501716,"avatar_url":"https://avatars2.githubusercontent.com/u/1501716?v=4","gravatar_id":"","url":"https://api.github.com/users/zvookin","html_url":"https://github.com/zvookin","followers_url":"https://api.github.com/users/zvookin/followers","following_url":"https://api.github.com/users/zvookin/following{/other_user}","gists_url":"https://api.github.com/users/zvookin/gists{/gist_id}","starred_url":"https://api.github.com/users/zvookin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zvookin/subscriptions","organizations_url":"https://api.github.com/users/zvookin/orgs","repos_url":"https://api.github.com/users/zvookin/repos","events_url":"https://api.github.com/users/zvookin/events{/privacy}","received_events_url":"https://api.github.com/users/zvookin/received_events","type":"User","site_admin":false},"body":"Is it checked if no_asserts is on? Should we keep this code for that case? (I can go either way in that it seems prudent, on the other hand, no_asserts definitely gives us license to not do the check and should save as many cycles as possible.) The cost of making output_buffer_types now is minimal, but checking it twice is certainly not useful.","created_at":"2018-03-12T18:19:57Z","updated_at":"2018-03-12T18:19:57Z","html_url":"https://github.com/halide/Halide/pull/2807#discussion_r173898620","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/2807","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/173898620"},"html":{"href":"https://github.com/halide/Halide/pull/2807#discussion_r173898620"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/2807"}},"in_reply_to_id":173681407},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/2807","id":174256890,"html_url":"https://github.com/halide/Halide/pull/2807","diff_url":"https://github.com/halide/Halide/pull/2807.diff","patch_url":"https://github.com/halide/Halide/pull/2807.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/2807","number":2807,"state":"open","locked":false,"title":"Remove some dynamic allocation and refcounted object copies from realize path.","user":{"login":"zvookin","id":1501716,"avatar_url":"https://avatars2.githubusercontent.com/u/1501716?v=4","gravatar_id":"","url":"https://api.github.com/users/zvookin","html_url":"https://github.com/zvookin","followers_url":"https://api.github.com/users/zvookin/followers","following_url":"https://api.github.com/users/zvookin/following{/other_user}","gists_url":"https://api.github.com/users/zvookin/gists{/gist_id}","starred_url":"https://api.github.com/users/zvookin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zvookin/subscriptions","organizations_url":"https://api.github.com/users/zvookin/orgs","repos_url":"https://api.github.com/users/zvookin/repos","events_url":"https://api.github.com/users/zvookin/events{/privacy}","received_events_url":"https://api.github.com/users/zvookin/received_events","type":"User","site_admin":false},"body":"Should speed up realize calls to precompiled Pipelines a bit. Per discussion on issue:\r\n    https://github.com/halide/Halide/issues/2800\r\nand maybe affecting issue:\r\n    https://github.com/halide/Halide/issues/2731\r\n","created_at":"2018-03-12T01:50:42Z","updated_at":"2018-03-12T18:19:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbd0462dd5f5ad1a270043627432e3749708c8a2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/2807/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/2807/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/2807/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/53705531ad981e7d98d3bd44af190bb570bc7eef","head":{"label":"halide:realize_optimization","ref":"realize_optimization","sha":"53705531ad981e7d98d3bd44af190bb570bc7eef","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars2.githubusercontent.com/u/1548551?v=4","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars2.githubusercontent.com/u/1548551?v=4","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for fast, portable data-parallel computation","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments{/number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","deployments_url":"https://api.github.com/repos/halide/Halide/deployments","created_at":"2012-07-31T04:05:25Z","updated_at":"2018-03-12T18:19:57Z","pushed_at":"2018-03-12T17:55:56Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":243181,"stargazers_count":2192,"watchers_count":2192,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":442,"mirror_url":null,"archived":false,"open_issues_count":384,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":442,"open_issues":384,"watchers":2192,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"bb490e25eb2a4dfcc18202226ceab45ed24b4aa7","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars2.githubusercontent.com/u/1548551?v=4","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars2.githubusercontent.com/u/1548551?v=4","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for fast, portable data-parallel computation","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments{/number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","deployments_url":"https://api.github.com/repos/halide/Halide/deployments","created_at":"2012-07-31T04:05:25Z","updated_at":"2018-03-12T18:19:57Z","pushed_at":"2018-03-12T17:55:56Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":243181,"stargazers_count":2192,"watchers_count":2192,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":442,"mirror_url":null,"archived":false,"open_issues_count":384,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":442,"open_issues":384,"watchers":2192,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/2807"},"html":{"href":"https://github.com/halide/Halide/pull/2807"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/2807"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/2807/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/2807/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/2807/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/53705531ad981e7d98d3bd44af190bb570bc7eef"}},"author_association":"OWNER"}}
{"actor":{"display_login":"zvookin"}}