{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/comments/235428626","pull_request_review_id":177291225,"id":235428626,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTQyODYyNg==","diff_hunk":"@@ -551,23 +629,18 @@ struct GraphFuser {\n       // TODO: Perhaps we should use cloneFrom now, as it seems unlikely\n       // to copy select nodes now that we have refactored to have a Value\n       // distinct from Node.\n-      Node * input_chunk = block->owningGraph()->create(prim::ConstantChunk, 0);\n-      input_chunk->addInput(input);\n-      input_chunk->i_(attr::chunks, chunk->i(attr::chunks));\n-      input_chunk->i_(attr::dim, chunk->i(attr::dim));\n-      insertAt(&insertion_point, input_chunk);\n-\n+      bchunk->addInput(input);\n       chunked_inputs.emplace_back(); // alas, to not be C++17\n-      for (auto chunk_sel : chunk->outputs()) {\n-          Value * input_chunk_sel = input_chunk->addOutput();\n+      for (auto chunk_sel : producer_chunk_outputs) {\n+          Value * input_chunk_sel = bchunk->addOutput();\n           input_chunk_sel->setType(chunk_sel->type());","path":"torch/csrc/jit/passes/graph_fuser.cpp","position":176,"original_position":176,"commit_id":"59d9db196ea96d3fc452c436f17fe8f807fedcca","original_commit_id":"59d9db196ea96d3fc452c436f17fe8f807fedcca","user":{"login":"zou3519","id":5652049,"node_id":"MDQ6VXNlcjU2NTIwNDk=","avatar_url":"https://avatars3.githubusercontent.com/u/5652049?v=4","gravatar_id":"","url":"https://api.github.com/users/zou3519","html_url":"https://github.com/zou3519","followers_url":"https://api.github.com/users/zou3519/followers","following_url":"https://api.github.com/users/zou3519/following{/other_user}","gists_url":"https://api.github.com/users/zou3519/gists{/gist_id}","starred_url":"https://api.github.com/users/zou3519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zou3519/subscriptions","organizations_url":"https://api.github.com/users/zou3519/orgs","repos_url":"https://api.github.com/users/zou3519/repos","events_url":"https://api.github.com/users/zou3519/events{/privacy}","received_events_url":"https://api.github.com/users/zou3519/received_events","type":"User","site_admin":false},"body":"Good point. I'll add an assert on the type for now","created_at":"2018-11-21T15:20:03Z","updated_at":"2018-11-21T15:20:03Z","html_url":"https://github.com/pytorch/pytorch/pull/14055#discussion_r235428626","pull_request_url":"https://api.github.com/repos/pytorch/pytorch/pulls/14055","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/comments/235428626"},"html":{"href":"https://github.com/pytorch/pytorch/pull/14055#discussion_r235428626"},"pull_request":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/14055"}},"in_reply_to_id":235343505},"pull_request":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/14055","id":231388330,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxMzg4MzMw","html_url":"https://github.com/pytorch/pytorch/pull/14055","diff_url":"https://github.com/pytorch/pytorch/pull/14055.diff","patch_url":"https://github.com/pytorch/pytorch/pull/14055.patch","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/14055","number":14055,"state":"open","locked":false,"title":"Allow graph fuser to move chunks past multiple nodes.","user":{"login":"zou3519","id":5652049,"node_id":"MDQ6VXNlcjU2NTIwNDk=","avatar_url":"https://avatars3.githubusercontent.com/u/5652049?v=4","gravatar_id":"","url":"https://api.github.com/users/zou3519","html_url":"https://github.com/zou3519","followers_url":"https://api.github.com/users/zou3519/followers","following_url":"https://api.github.com/users/zou3519/following{/other_user}","gists_url":"https://api.github.com/users/zou3519/gists{/gist_id}","starred_url":"https://api.github.com/users/zou3519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zou3519/subscriptions","organizations_url":"https://api.github.com/users/zou3519/orgs","repos_url":"https://api.github.com/users/zou3519/repos","events_url":"https://api.github.com/users/zou3519/events{/privacy}","received_events_url":"https://api.github.com/users/zou3519/received_events","type":"User","site_admin":false},"body":"Fixes #12290. Also speeds up JIT LSTM forward pass from 8.8ms to 7.8ms; previously, each JIT lstm cell used 2 fused kernels. Now, it only uses one fused kernel (which is how many kernels cudnn uses).\r\n\r\nExplanation:\r\n\r\nLet f, g, h be fusible ops.\r\n```\r\nx = f(v, w)\r\nz = g(x, y)\r\na, b = chunk(z)\r\nc = h(a, b)\r\n```\r\nbecomes (before this PR):\r\n```\r\nx = f(v, w)\r\nx', y' = broadcast_tensors([x, y])\r\nax, bx = chunk(x')\r\nay, by = chunk(y')\r\na = g(ax, ay)\r\nb = g(bx, by)\r\nc = h(a, b)\r\n```\r\nThe graph fuser then puts g, g, and h into one FusionGroup and is unable\r\nto move `x = f(v, w)` into the FusionGroup.\r\n\r\nThis PR lets the graph fuser move `x = f(v, w)` into the FusionGroup.\r\nIt does this by abstracting the broadcast_tensors + multiple chunk nodes\r\ninto one intermediate `prim::BroadcastingChunk[chunks, dim]` node.\r\n\r\nA `BroadcastingChunk[chunks, dim](*inputs)` node is equivalent to:\r\n- broadcasting all of *inputs\r\n- chunk-ing each broadcasted input into `chunks` chunks along dim `dim`.\r\n\r\nAbstracting the broadcasting chunk behavior away, it is now a lot easier\r\nfor the graph fuser to move (broadcast + chunk) past an operation. After\r\nthis PR, the above graph becomes:\r\n```\r\nx = f(v, w)\r\nax, bx, ay, by = BroadcastingChunk(x, y)\r\na = g(ax, ay)\r\nb = g(bx, by)\r\nc = h(a, b)\r\n```\r\nNow, to move `x = f(v, w)` after the BroadcastingChunk, one just needs\r\nto add f's operands to the BroadcastingChunk:\r\n```\r\nay, by, av, bv, aw, bw = BroadcastingChunk(y, v, w)\r\nax = f(av, aw)\r\nby = f(bv, bw)\r\na = g(ax, ay)\r\nb = g(bx, by)\r\nc = h(a, b)\r\n```\r\n\r\ncc @apaszke @mruberry @zdevito \r\n","created_at":"2018-11-16T01:25:13Z","updated_at":"2018-11-21T15:20:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"914336fab6bf6d1204bdcedc359f35bcf6925d51","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":679953983,"node_id":"MDU6TGFiZWw2Nzk5NTM5ODM=","url":"https://api.github.com/repos/pytorch/pytorch/labels/jit","name":"jit","color":"c5def5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/pytorch/pulls/14055/commits","review_comments_url":"https://api.github.com/repos/pytorch/pytorch/pulls/14055/comments","review_comment_url":"https://api.github.com/repos/pytorch/pytorch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/14055/comments","statuses_url":"https://api.github.com/repos/pytorch/pytorch/statuses/59d9db196ea96d3fc452c436f17fe8f807fedcca","head":{"label":"zou3519:broadcasting-chunk","ref":"broadcasting-chunk","sha":"59d9db196ea96d3fc452c436f17fe8f807fedcca","user":{"login":"zou3519","id":5652049,"node_id":"MDQ6VXNlcjU2NTIwNDk=","avatar_url":"https://avatars3.githubusercontent.com/u/5652049?v=4","gravatar_id":"","url":"https://api.github.com/users/zou3519","html_url":"https://github.com/zou3519","followers_url":"https://api.github.com/users/zou3519/followers","following_url":"https://api.github.com/users/zou3519/following{/other_user}","gists_url":"https://api.github.com/users/zou3519/gists{/gist_id}","starred_url":"https://api.github.com/users/zou3519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zou3519/subscriptions","organizations_url":"https://api.github.com/users/zou3519/orgs","repos_url":"https://api.github.com/users/zou3519/repos","events_url":"https://api.github.com/users/zou3519/events{/privacy}","received_events_url":"https://api.github.com/users/zou3519/received_events","type":"User","site_admin":false},"repo":{"id":103550456,"node_id":"MDEwOlJlcG9zaXRvcnkxMDM1NTA0NTY=","name":"pytorch","full_name":"zou3519/pytorch","private":false,"owner":{"login":"zou3519","id":5652049,"node_id":"MDQ6VXNlcjU2NTIwNDk=","avatar_url":"https://avatars3.githubusercontent.com/u/5652049?v=4","gravatar_id":"","url":"https://api.github.com/users/zou3519","html_url":"https://github.com/zou3519","followers_url":"https://api.github.com/users/zou3519/followers","following_url":"https://api.github.com/users/zou3519/following{/other_user}","gists_url":"https://api.github.com/users/zou3519/gists{/gist_id}","starred_url":"https://api.github.com/users/zou3519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zou3519/subscriptions","organizations_url":"https://api.github.com/users/zou3519/orgs","repos_url":"https://api.github.com/users/zou3519/repos","events_url":"https://api.github.com/users/zou3519/events{/privacy}","received_events_url":"https://api.github.com/users/zou3519/received_events","type":"User","site_admin":false},"html_url":"https://github.com/zou3519/pytorch","description":"Tensors and Dynamic neural networks in Python  with strong GPU acceleration","fork":true,"url":"https://api.github.com/repos/zou3519/pytorch","forks_url":"https://api.github.com/repos/zou3519/pytorch/forks","keys_url":"https://api.github.com/repos/zou3519/pytorch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zou3519/pytorch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zou3519/pytorch/teams","hooks_url":"https://api.github.com/repos/zou3519/pytorch/hooks","issue_events_url":"https://api.github.com/repos/zou3519/pytorch/issues/events{/number}","events_url":"https://api.github.com/repos/zou3519/pytorch/events","assignees_url":"https://api.github.com/repos/zou3519/pytorch/assignees{/user}","branches_url":"https://api.github.com/repos/zou3519/pytorch/branches{/branch}","tags_url":"https://api.github.com/repos/zou3519/pytorch/tags","blobs_url":"https://api.github.com/repos/zou3519/pytorch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zou3519/pytorch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zou3519/pytorch/git/refs{/sha}","trees_url":"https://api.github.com/repos/zou3519/pytorch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zou3519/pytorch/statuses/{sha}","languages_url":"https://api.github.com/repos/zou3519/pytorch/languages","stargazers_url":"https://api.github.com/repos/zou3519/pytorch/stargazers","contributors_url":"https://api.github.com/repos/zou3519/pytorch/contributors","subscribers_url":"https://api.github.com/repos/zou3519/pytorch/subscribers","subscription_url":"https://api.github.com/repos/zou3519/pytorch/subscription","commits_url":"https://api.github.com/repos/zou3519/pytorch/commits{/sha}","git_commits_url":"https://api.github.com/repos/zou3519/pytorch/git/commits{/sha}","comments_url":"https://api.github.com/repos/zou3519/pytorch/comments{/number}","issue_comment_url":"https://api.github.com/repos/zou3519/pytorch/issues/comments{/number}","contents_url":"https://api.github.com/repos/zou3519/pytorch/contents/{+path}","compare_url":"https://api.github.com/repos/zou3519/pytorch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zou3519/pytorch/merges","archive_url":"https://api.github.com/repos/zou3519/pytorch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zou3519/pytorch/downloads","issues_url":"https://api.github.com/repos/zou3519/pytorch/issues{/number}","pulls_url":"https://api.github.com/repos/zou3519/pytorch/pulls{/number}","milestones_url":"https://api.github.com/repos/zou3519/pytorch/milestones{/number}","notifications_url":"https://api.github.com/repos/zou3519/pytorch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zou3519/pytorch/labels{/name}","releases_url":"https://api.github.com/repos/zou3519/pytorch/releases{/id}","deployments_url":"https://api.github.com/repos/zou3519/pytorch/deployments","created_at":"2017-09-14T15:36:38Z","updated_at":"2018-11-14T15:29:03Z","pushed_at":"2018-11-16T01:24:38Z","git_url":"git://github.com/zou3519/pytorch.git","ssh_url":"git@github.com:zou3519/pytorch.git","clone_url":"https://github.com/zou3519/pytorch.git","svn_url":"https://github.com/zou3519/pytorch","homepage":"http://pytorch.org","size":123053,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"f930c4307c264a5fa1d7c7b6a779641d69b8c66a","user":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"repo":{"id":65600975,"node_id":"MDEwOlJlcG9zaXRvcnk2NTYwMDk3NQ==","name":"pytorch","full_name":"pytorch/pytorch","private":false,"owner":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pytorch/pytorch","description":"Tensors and Dynamic neural networks in Python  with strong GPU acceleration","fork":false,"url":"https://api.github.com/repos/pytorch/pytorch","forks_url":"https://api.github.com/repos/pytorch/pytorch/forks","keys_url":"https://api.github.com/repos/pytorch/pytorch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/pytorch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/pytorch/teams","hooks_url":"https://api.github.com/repos/pytorch/pytorch/hooks","issue_events_url":"https://api.github.com/repos/pytorch/pytorch/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/pytorch/events","assignees_url":"https://api.github.com/repos/pytorch/pytorch/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/pytorch/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/pytorch/tags","blobs_url":"https://api.github.com/repos/pytorch/pytorch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/pytorch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/pytorch/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/pytorch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/pytorch/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/pytorch/languages","stargazers_url":"https://api.github.com/repos/pytorch/pytorch/stargazers","contributors_url":"https://api.github.com/repos/pytorch/pytorch/contributors","subscribers_url":"https://api.github.com/repos/pytorch/pytorch/subscribers","subscription_url":"https://api.github.com/repos/pytorch/pytorch/subscription","commits_url":"https://api.github.com/repos/pytorch/pytorch/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/pytorch/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/pytorch/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/pytorch/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/pytorch/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/pytorch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/pytorch/merges","archive_url":"https://api.github.com/repos/pytorch/pytorch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/pytorch/downloads","issues_url":"https://api.github.com/repos/pytorch/pytorch/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/pytorch/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/pytorch/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/pytorch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/pytorch/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/pytorch/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/pytorch/deployments","created_at":"2016-08-13T05:26:41Z","updated_at":"2018-11-21T14:40:14Z","pushed_at":"2018-11-21T15:18:09Z","git_url":"git://github.com/pytorch/pytorch.git","ssh_url":"git@github.com:pytorch/pytorch.git","clone_url":"https://github.com/pytorch/pytorch.git","svn_url":"https://github.com/pytorch/pytorch","homepage":"http://pytorch.org","size":89288,"stargazers_count":21492,"watchers_count":21492,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5131,"mirror_url":null,"archived":false,"open_issues_count":2169,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5131,"open_issues":2169,"watchers":21492,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/14055"},"html":{"href":"https://github.com/pytorch/pytorch/pull/14055"},"issue":{"href":"https://api.github.com/repos/pytorch/pytorch/issues/14055"},"comments":{"href":"https://api.github.com/repos/pytorch/pytorch/issues/14055/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/14055/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/14055/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/pytorch/statuses/59d9db196ea96d3fc452c436f17fe8f807fedcca"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"zou3519"}}