{"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/73780473","id":73780473,"diff_hunk":"@@ -399,20 +399,48 @@ std::string CodeGen_GLSL::get_vector_suffix(Expr e) {\n         // GLSL 1.0 Section 5.5 supports subscript based vector indexing\n         std::string id = print_assignment(e.type(), print_expr(e));\n         if (e.type() != Int(32)) {\n-          id = \"int(\" + id + \")\";\n+            id = \"int(\" + id + \")\";\n         }\n         return std::string(\"[\" + id + \"]\");\n     }\n }\n \n-void CodeGen_GLSL::visit(const Load *) {\n-    internal_error << \"GLSL: unexpected Load node encountered.\\n\";\n+void CodeGen_GLSL::visit(const Load *op) {\n+    string idx = print_expr(op->index);\n+    if (op->type.is_scalar()) {\n+        print_assignment(op->type, op->name + \"[\" + idx + \"]\");\n+    } else {\n+        ostringstream rhs;\n+        rhs << print_type(op->type) << \"(\";\n+        for (int i = 0; i < op->type.lanes(); i++) {\n+            char c = \"rgba\"[i];\n+            if (i > 0) {\n+                rhs << \", \";\n+            }\n+            rhs << op->name << \"[\" << idx << \".\" << c << \"]\";\n+        }\n+        rhs << \")\";\n+        print_assignment(op->type, rhs.str());\n+    }\n }\n \n-void CodeGen_GLSL::visit(const Store *) {\n-    internal_error << \"GLSL: unexpected Store node encountered.\\n\";\n+void CodeGen_GLSL::visit(const Store *op) {\n+    string val = print_expr(op->value);\n+    string idx = print_expr(op->index);\n+    if (op->value.type().is_scalar()) {\n+        do_indent();\n+        stream << op->name << \"[\" << idx << \"] = \" << val << \";\\n\";\n+    } else {\n+        internal_assert(op->value.type().lanes() <= 4);\n+        for (int i = 0; i < op->value.type().lanes(); i++) {\n+            char l = \"rgba\"[i];\n+            do_indent();\n+            stream << op->name << \"[\" << idx << \".\" << l << \"] = \" << val << \".\" << l << \";\\n\";","path":"src/CodeGen_OpenGL_Dev.cpp","position":45,"original_position":45,"commit_id":"399f458709f121934333f298af329547a40bc12d","original_commit_id":"399f458709f121934333f298af329547a40bc12d","user":{"login":"ronen","id":125620,"avatar_url":"https://avatars.githubusercontent.com/u/125620?v=3","gravatar_id":"","url":"https://api.github.com/users/ronen","html_url":"https://github.com/ronen","followers_url":"https://api.github.com/users/ronen/followers","following_url":"https://api.github.com/users/ronen/following{/other_user}","gists_url":"https://api.github.com/users/ronen/gists{/gist_id}","starred_url":"https://api.github.com/users/ronen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronen/subscriptions","organizations_url":"https://api.github.com/users/ronen/orgs","repos_url":"https://api.github.com/users/ronen/repos","events_url":"https://api.github.com/users/ronen/events{/privacy}","received_events_url":"https://api.github.com/users/ronen/received_events","type":"User","site_admin":false},"body":"Is it just me, or should this be:\r\n\r\n```cpp\r\n           stream << op->name << \"[\" << idx << \"].\" << l << \" = \" << val << \".\" << l << \";\\n\";\r\n```","created_at":"2016-08-06T04:07:22Z","updated_at":"2016-08-06T04:07:22Z","html_url":"https://github.com/halide/Halide/pull/1427#discussion_r73780473","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/1427","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/73780473"},"html":{"href":"https://github.com/halide/Halide/pull/1427#discussion_r73780473"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/1427"}}},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/1427","id":80311755,"html_url":"https://github.com/halide/Halide/pull/1427","diff_url":"https://github.com/halide/Halide/pull/1427.diff","patch_url":"https://github.com/halide/Halide/pull/1427.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/1427","number":1427,"state":"open","locked":false,"title":"Support allocations (arrays) inside GL kernels","user":{"login":"abadams","id":515398,"avatar_url":"https://avatars.githubusercontent.com/u/515398?v=3","gravatar_id":"","url":"https://api.github.com/users/abadams","html_url":"https://github.com/abadams","followers_url":"https://api.github.com/users/abadams/followers","following_url":"https://api.github.com/users/abadams/following{/other_user}","gists_url":"https://api.github.com/users/abadams/gists{/gist_id}","starred_url":"https://api.github.com/users/abadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadams/subscriptions","organizations_url":"https://api.github.com/users/abadams/orgs","repos_url":"https://api.github.com/users/abadams/repos","events_url":"https://api.github.com/users/abadams/events{/privacy}","received_events_url":"https://api.github.com/users/abadams/received_events","type":"User","site_admin":false},"body":"This adds some level of support for Allocate/Load/Store nodes (e.g. due to an inline reduction) inside GLSL kernels. It doesn't generate amazing GLSL, but it seems to work for some simple cases.\r\n\r\n@shoaibkamil @ronen PTAL","created_at":"2016-08-05T21:45:54Z","updated_at":"2016-08-06T04:07:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff4298b5c593f6b968ce89be1b6f06fd100ab44f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/1427/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/1427/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/1427/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/399f458709f121934333f298af329547a40bc12d","head":{"label":"halide:fix_opengl","ref":"fix_opengl","sha":"399f458709f121934333f298af329547a40bc12d","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-08-05T06:53:27Z","pushed_at":"2016-08-05T23:24:25Z","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":274675,"stargazers_count":1350,"watchers_count":1350,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"open_issues_count":211,"forks":278,"open_issues":211,"watchers":1350,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"b1fa429c3b1700ef896d50b077fed687f7a61fc2","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-08-05T06:53:27Z","pushed_at":"2016-08-05T23:24:25Z","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":274675,"stargazers_count":1350,"watchers_count":1350,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"open_issues_count":211,"forks":278,"open_issues":211,"watchers":1350,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/1427"},"html":{"href":"https://github.com/halide/Halide/pull/1427"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/1427"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/1427/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/1427/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/1427/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/399f458709f121934333f298af329547a40bc12d"}}}}
{"actor":{"display_login":"ronen"}}