{"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/189488722","pull_request_review_id":121673552,"id":189488722,"diff_hunk":"@@ -0,0 +1,120 @@\n+#include \"Halide.h\"\n+\n+#include <stdio.h>\n+#include <map>\n+\n+namespace {\n+\n+using std::map;\n+using std::pair;\n+using std::string;\n+using std::vector;\n+\n+using namespace Halide;\n+using namespace Halide::Internal;\n+\n+class CollectPrefetches : public IRVisitor {\n+private:\n+    using IRVisitor::visit;\n+\n+    void visit(const Call *op) {\n+        if (op->is_intrinsic(Call::prefetch)) {\n+            prefetches.push_back(op->args);\n+        }\n+    }\n+\n+public:\n+    vector<vector<Expr>> prefetches;\n+};\n+\n+int test1() {\n+    Func f(\"f\"), g(\"g\");\n+    Var x(\"x\");\n+\n+    f(x) = x;\n+    g(x) = f(0) + f(7);\n+\n+    f.compute_root();\n+    g.prefetch(f, x, 8);\n+\n+    Module m = g.compile_to_module({});\n+    CollectPrefetches collect;\n+    m.functions()[0].body.accept(&collect);\n+\n+    vector<vector<Expr>> expected = {{Variable::make(Handle(), f.name()) , 0, 1, 8}};\n+    if (collect.prefetches.size() != expected.size()) {\n+        std::cout << \"Expect \" << expected.size() << \" prefetches instead of \"\n+                  << collect.prefetches.size() << \"\\n\";\n+        return -1;\n+    }\n+    for (size_t i = 0; i < expected.size(); ++i) {\n+        if (expected[i].size() != collect.prefetches[i].size()) {\n+            std::cout << \"Expect prefetch args of size \" << expected[i].size()\n+                      << \", got \" << collect.prefetches[i].size() << \" instead\\n\";\n+            return -1;\n+        }\n+        for (size_t j = 0; j < expected[i].size(); ++j) {\n+            if (!equal(expected[i][j], collect.prefetches[i][j])) {\n+                std::cout << \"Expect \\\"\" << expected[i][j] << \"\\\", got \\\"\"\n+                          << collect.prefetches[i][j] << \" instead\\n\";\n+                return -1;\n+            }\n+        }\n+    }\n+    return 0;\n+}\n+\n+int test2() {\n+    Param<bool> p;\n+\n+    Func f(\"f\"), g(\"g\");\n+    Var x(\"x\");\n+\n+    f(x) = x;\n+    g(x) = f(0) + f(7);\n+\n+    f.compute_root();\n+    g.specialize(p).prefetch(f, x, 8);\n+\n+    Module m = g.compile_to_module({p});\n+    CollectPrefetches collect;\n+    m.functions()[0].body.accept(&collect);\n+\n+    vector<vector<Expr>> expected = {{Variable::make(Handle(), f.name()) , 0, 1, 8}};\n+    if (collect.prefetches.size() != expected.size()) {","path":"test/correctness/prefetch.cpp","position":45,"original_position":84,"commit_id":"b4ed365f7121910682cfe60234654d57ac2d8619","original_commit_id":"b4ed365f7121910682cfe60234654d57ac2d8619","user":{"login":"dsharletg","id":7494796,"avatar_url":"https://avatars1.githubusercontent.com/u/7494796?v=4","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":"Factor out this check that prefetches == expected to a helper function (used 2x here)","created_at":"2018-05-21T03:35:59Z","updated_at":"2018-05-21T03:36:28Z","html_url":"https://github.com/halide/Halide/pull/2965#discussion_r189488722","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/2965","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/189488722"},"html":{"href":"https://github.com/halide/Halide/pull/2965#discussion_r189488722"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/2965"}}},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/2965","id":188287340,"html_url":"https://github.com/halide/Halide/pull/2965","diff_url":"https://github.com/halide/Halide/pull/2965.diff","patch_url":"https://github.com/halide/Halide/pull/2965.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/2965","number":2965,"state":"open","locked":false,"title":"Make prefetch works with specialize","user":{"login":"psuriana","id":2260287,"avatar_url":"https://avatars1.githubusercontent.com/u/2260287?v=4","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 a pass that injects an \"empty\" prefetch node during ScheduleFunctions to make prefetch works with specialization. The actual region to be prefetched is determined in later steps. ","created_at":"2018-05-16T00:04:14Z","updated_at":"2018-05-21T03:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c91dceaae65e4b07657ec249fa7d98d65bbbe12","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/2965/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/2965/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/2965/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/b4ed365f7121910682cfe60234654d57ac2d8619","head":{"label":"halide:prefetch_specialize","ref":"prefetch_specialize","sha":"b4ed365f7121910682cfe60234654d57ac2d8619","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-05-20T03:11:43Z","pushed_at":"2018-05-21T02:05:59Z","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":244418,"stargazers_count":2314,"watchers_count":2314,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":471,"mirror_url":null,"archived":false,"open_issues_count":421,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":471,"open_issues":421,"watchers":2314,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"c91696aea0c56fd76afe300442f32326839f7a59","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-05-20T03:11:43Z","pushed_at":"2018-05-21T02:05:59Z","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":244418,"stargazers_count":2314,"watchers_count":2314,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":471,"mirror_url":null,"archived":false,"open_issues_count":421,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":471,"open_issues":421,"watchers":2314,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/2965"},"html":{"href":"https://github.com/halide/Halide/pull/2965"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/2965"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/2965/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/2965/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/2965/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/b4ed365f7121910682cfe60234654d57ac2d8619"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dsharletg"}}