{"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/62112563","id":62112563,"diff_hunk":"@@ -248,6 +338,103 @@ Function::Function(const std::string &n) : contents(new FunctionContents) {\n     contents.ptr->name = n;\n }\n \n+void deep_copy_update_definition_helper(IntrusivePtr<FunctionContents> &contents,\n+                                        UpdateDefinition &dst,\n+                                        const UpdateDefinition &src,\n+                                        DeepCopyMap &copied_map) {\n+    dst.values = src.values;\n+    dst.args = src.args;\n+    dst.schedule = Schedule();\n+    src.schedule.deep_copy(dst.schedule, copied_map);","path":"src/Function.cpp","position":115,"original_position":115,"commit_id":"4717d7057cd60b47654d99aa8f6d8ea24bce1ce7","original_commit_id":"4717d7057cd60b47654d99aa8f6d8ea24bce1ce7","user":{"login":"dsharletg","id":7494796,"avatar_url":"https://avatars.githubusercontent.com/u/7494796?v=3","gravatar_id":"","url":"https://api.github.com/users/dsharletg","html_url":"https://github.com/dsharletg","followers_url":"https://api.github.com/users/dsharletg/followers","following_url":"https://api.github.com/users/dsharletg/following{/other_user}","gists_url":"https://api.github.com/users/dsharletg/gists{/gist_id}","starred_url":"https://api.github.com/users/dsharletg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsharletg/subscriptions","organizations_url":"https://api.github.com/users/dsharletg/orgs","repos_url":"https://api.github.com/users/dsharletg/repos","events_url":"https://api.github.com/users/dsharletg/events{/privacy}","received_events_url":"https://api.github.com/users/dsharletg/received_events","type":"User","site_admin":false},"body":"Another option which I've seen elsewhere in this branch is to make a Schedule::deep_copy(DeepCopyMap &) member function of Schedule that returns a deep copy. That would be consistent with e.g. ReductionDomain::deep_copy.","created_at":"2016-05-04T20:51:49Z","updated_at":"2016-05-04T20:51:49Z","html_url":"https://github.com/halide/Halide/pull/1182#discussion_r62112563","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/1182","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/62112563"},"html":{"href":"https://github.com/halide/Halide/pull/1182#discussion_r62112563"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/1182"}}},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/1182","id":68780360,"html_url":"https://github.com/halide/Halide/pull/1182","diff_url":"https://github.com/halide/Halide/pull/1182.diff","patch_url":"https://github.com/halide/Halide/pull/1182.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/1182","number":1182,"state":"open","locked":false,"title":"Func wrapper","user":{"login":"psuriana","id":2260287,"avatar_url":"https://avatars.githubusercontent.com/u/2260287?v=3","gravatar_id":"","url":"https://api.github.com/users/psuriana","html_url":"https://github.com/psuriana","followers_url":"https://api.github.com/users/psuriana/followers","following_url":"https://api.github.com/users/psuriana/following{/other_user}","gists_url":"https://api.github.com/users/psuriana/gists{/gist_id}","starred_url":"https://api.github.com/users/psuriana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psuriana/subscriptions","organizations_url":"https://api.github.com/users/psuriana/orgs","repos_url":"https://api.github.com/users/psuriana/repos","events_url":"https://api.github.com/users/psuriana/events{/privacy}","received_events_url":"https://api.github.com/users/psuriana/received_events","type":"User","site_admin":false},"body":"Add support for function wrapper, which can be defined locally or globally. \r\nLocal/custom wrapper is defined by the following syntax: `f.in(g)`. Every call to `f` by `g` will be replaced to call to its wrapper, which happens during the lowering stage. The wrapper function returned can then be scheduled as in typical function.\r\nUsage:\r\n```\r\n     f(x, y) = x + y;\r\n     g(x, y) = f(x, y);\r\n     f.compute_root();\r\n     f.in(g).compute_at(g, y);\r\n     g.realize(20, 20);\r\n```\r\n, which is equivalent to:\r\n```\r\n     for (int y = 0; y < 20; y++) {\r\n       for (int x = 0; x < 20; x++) {\r\n         f(x, y) = x + y;\r\n       }\r\n     }\r\n     for (int y = 0; y < 20; y++) {\r\n       for (int x = 0; x < 20; x++) {\r\n         f_in_g(x, y) = f(x, y);\r\n       }\r\n       for (int x = 0; x < 20; x++) {\r\n         g(x, y) = f_in_g(x, y);\r\n       }\r\n     }\r\n```\r\nGlobal wrapper is defined by the following syntax: `f.in()`. Every call to `f` by all functions (excluding by itself) in the pipeline will be replaced to call to the wrapper, which happens during the lowering stage. Custom wrapper always takes precedence over the global wrapper, i.e. if both are defined, then we replace it with the custom wrapper.\r\nUsage:\r\n```\r\n     f(x, y) = x + y;\r\n     g(x, y) = f(x, y);\r\n     h(x, y) = f(x, y) + g(x, y);\r\n     f.compute_root();\r\n     f.in().compute_root();\r\n     g.compute_root();\r\n     h.realize(20, 20);\r\n\r\n```\r\n, which is equivalent to:\r\n```\r\n     for (int y = 0; y < 20; y++) {\r\n       for (int x = 0; x < 20; x++) {\r\n         f(x, y) = x + y;\r\n       }\r\n     }\r\n     for (int y = 0; y < 20; y++) {\r\n       for (int x = 0; x < 20; x++) {\r\n         f_wrapper(x, y) = f(x, y);\r\n       }\r\n     }\r\n     for (int y = 0; y < 20; y++) {\r\n       for (int x = 0; x < 20; x++) {\r\n         g(x, y) = f_wrapper(x, y);\r\n       }\r\n     }\r\n     for (int y = 0; y < 20; y++) {\r\n       for (int x = 0; x < 20; x++) {\r\n         h(x, y) = f_wrapper(x, y) + g(x, y);\r\n       }\r\n     }\r\n```","created_at":"2016-05-03T21:44:07Z","updated_at":"2016-05-04T20:51:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"023b55354aedf18ef7fbbda3b41793a09d848488","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/1182/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/1182/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/1182/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/4717d7057cd60b47654d99aa8f6d8ea24bce1ce7","head":{"label":"halide:func_wrapper","ref":"func_wrapper","sha":"4717d7057cd60b47654d99aa8f6d8ea24bce1ce7","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","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://avatars.githubusercontent.com/u/1548551?v=3","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 image processing and computational photography","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":"2016-05-03T12:29:16Z","pushed_at":"2016-05-04T20:49: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":263260,"stargazers_count":1279,"watchers_count":1279,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":254,"mirror_url":null,"open_issues_count":177,"forks":254,"open_issues":177,"watchers":1279,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"f2d6d255b3e8ef5609453dfa48bbc64b9cab5309","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","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://avatars.githubusercontent.com/u/1548551?v=3","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 image processing and computational photography","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":"2016-05-03T12:29:16Z","pushed_at":"2016-05-04T20:49: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":263260,"stargazers_count":1279,"watchers_count":1279,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":254,"mirror_url":null,"open_issues_count":177,"forks":254,"open_issues":177,"watchers":1279,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/1182"},"html":{"href":"https://github.com/halide/Halide/pull/1182"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/1182"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/1182/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/1182/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/1182/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/4717d7057cd60b47654d99aa8f6d8ea24bce1ce7"}}}}