{"action":"created","comment":{"url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/comments/198737152","pull_request_review_id":132720303,"id":198737152,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODczNzE1Mg==","diff_hunk":"@@ -0,0 +1,71 @@\n+/*\n+ This file is part of Leela Chess Zero.\n+ Copyright (C) 2018 The LCZero Authors\n+\n+ Leela Chess is free software: you can redistribute it and/or modify\n+ it under the terms of the GNU General Public License as published by\n+ the Free Software Foundation, either version 3 of the License, or\n+ (at your option) any later version.\n+\n+ Leela Chess is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ GNU General Public License for more details.\n+\n+ You should have received a copy of the GNU General Public License\n+ along with Leela Chess.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+#include \"neural/blas/convolution1.h\"","path":"src/neural/blas/convolution1.cc","position":19,"original_position":19,"commit_id":"0c67f1009e73d49500dc47c37b7130335c710597","original_commit_id":"0c67f1009e73d49500dc47c37b7130335c710597","user":{"login":"frpays","id":3645324,"node_id":"MDQ6VXNlcjM2NDUzMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3645324?v=4","gravatar_id":"","url":"https://api.github.com/users/frpays","html_url":"https://github.com/frpays","followers_url":"https://api.github.com/users/frpays/followers","following_url":"https://api.github.com/users/frpays/following{/other_user}","gists_url":"https://api.github.com/users/frpays/gists{/gist_id}","starred_url":"https://api.github.com/users/frpays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frpays/subscriptions","organizations_url":"https://api.github.com/users/frpays/orgs","repos_url":"https://api.github.com/users/frpays/repos","events_url":"https://api.github.com/users/frpays/events{/privacy}","received_events_url":"https://api.github.com/users/frpays/received_events","type":"User","site_admin":false},"body":"> sorted includes. :)\r\n> But clang-format would do that for you.\r\n\r\nI will pass clang-format on the final result.\r\n","created_at":"2018-06-28T07:48:32Z","updated_at":"2018-06-28T07:48:32Z","html_url":"https://github.com/LeelaChessZero/lc0/pull/87#discussion_r198737152","pull_request_url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/comments/198737152"},"html":{"href":"https://github.com/LeelaChessZero/lc0/pull/87#discussion_r198737152"},"pull_request":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87"}},"in_reply_to_id":198642496},"pull_request":{"url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87","id":195291922,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MjkxOTIy","html_url":"https://github.com/LeelaChessZero/lc0/pull/87","diff_url":"https://github.com/LeelaChessZero/lc0/pull/87.diff","patch_url":"https://github.com/LeelaChessZero/lc0/pull/87.patch","issue_url":"https://api.github.com/repos/LeelaChessZero/lc0/issues/87","number":87,"state":"open","locked":false,"title":"Batch computation for BLAS.","user":{"login":"frpays","id":3645324,"node_id":"MDQ6VXNlcjM2NDUzMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3645324?v=4","gravatar_id":"","url":"https://api.github.com/users/frpays","html_url":"https://github.com/frpays","followers_url":"https://api.github.com/users/frpays/followers","following_url":"https://api.github.com/users/frpays/following{/other_user}","gists_url":"https://api.github.com/users/frpays/gists{/gist_id}","starred_url":"https://api.github.com/users/frpays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frpays/subscriptions","organizations_url":"https://api.github.com/users/frpays/orgs","repos_url":"https://api.github.com/users/frpays/repos","events_url":"https://api.github.com/users/frpays/events{/privacy}","received_events_url":"https://api.github.com/users/frpays/received_events","type":"User","site_admin":false},"body":"x2 overall speedup.\r\n\r\nI was able to re-order the dimension of V/M matrices, so that I could join the inner sgemm of the Winograd convolve3  into on single sgemm for every tile. Since the weights-tile matrix does not change, this leads to about x2 speed-up.\r\nI also made various optimisations into the scatter/gather methods of the Winograd convolve3. I also reduced significantly the allocations and the pressures on new/delete. Now the vector allocations are once for all the computation. I also removed an unnecessary copy that dealt with the skip-connection.\r\nFinally, I reduced the memory footprint of the computation, removing the input buffer and relying on 3 rotating buffers.\r\n\r\nBenchmarks:\r\n\r\nhttps://docs.google.com/spreadsheets/d/1eU2gb67V69_7yXFzIaF2WI4djF1pXGAih-rwhrstmg0\r\n\r\n(less complete but formerly https://docs.google.com/spreadsheets/d/1vjPisPj2mbjc2Ic481E57h9O8o7ClyqYVXgU4HWoADQ/)\r\n\r\nReferences:\r\n\r\nhttps://arxiv.org/pdf/1509.09308.pdf\r\nhttps://ai.intel.com/winograd/\r\nhttps://ai.intel.com/winograd-2/\r\n\r\n### Testing welcome.\r\n\r\nWe are tracking a crash on MacOS under Mux condition with OpenCL and BLAS. One command line that is known to crash (between a few seconds and a few minutes) is the following:\r\n\r\n```\r\n./lc0 --backend=multiplexing \"--backend-opts=a(backend=blas,threads=8),b(backend=opencl,threads=3)\" -t 11 --minibatch-size=64\r\n\r\n``` \r\nThe crash will not happen every time immediately. You have to run up to 100k nodes (possibly in different runs) to experience it. Sometimes you get it in less a 1K nodes. It's replicable, but very random.\r\n\r\n**The crash may not come from these changes.  See https://github.com/LeelaChessZero/lc0/issues/98.**\r\n\r\nYou are welcome to test either this setup or another, the one you are used to run, and report your findings.\r\n\r\nMany thanks in advance.\r\n","created_at":"2018-06-15T21:58:44Z","updated_at":"2018-06-28T07:48:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18a04bd694e32f32b657764eb552297d570a5f46","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87/commits","review_comments_url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87/comments","review_comment_url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LeelaChessZero/lc0/issues/87/comments","statuses_url":"https://api.github.com/repos/LeelaChessZero/lc0/statuses/0c67f1009e73d49500dc47c37b7130335c710597","head":{"label":"frpays:dev-blas2","ref":"dev-blas2","sha":"0c67f1009e73d49500dc47c37b7130335c710597","user":{"login":"frpays","id":3645324,"node_id":"MDQ6VXNlcjM2NDUzMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3645324?v=4","gravatar_id":"","url":"https://api.github.com/users/frpays","html_url":"https://github.com/frpays","followers_url":"https://api.github.com/users/frpays/followers","following_url":"https://api.github.com/users/frpays/following{/other_user}","gists_url":"https://api.github.com/users/frpays/gists{/gist_id}","starred_url":"https://api.github.com/users/frpays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frpays/subscriptions","organizations_url":"https://api.github.com/users/frpays/orgs","repos_url":"https://api.github.com/users/frpays/repos","events_url":"https://api.github.com/users/frpays/events{/privacy}","received_events_url":"https://api.github.com/users/frpays/received_events","type":"User","site_admin":false},"repo":{"id":135753887,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU3NTM4ODc=","name":"lc0","full_name":"frpays/lc0","owner":{"login":"frpays","id":3645324,"node_id":"MDQ6VXNlcjM2NDUzMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3645324?v=4","gravatar_id":"","url":"https://api.github.com/users/frpays","html_url":"https://github.com/frpays","followers_url":"https://api.github.com/users/frpays/followers","following_url":"https://api.github.com/users/frpays/following{/other_user}","gists_url":"https://api.github.com/users/frpays/gists{/gist_id}","starred_url":"https://api.github.com/users/frpays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frpays/subscriptions","organizations_url":"https://api.github.com/users/frpays/orgs","repos_url":"https://api.github.com/users/frpays/repos","events_url":"https://api.github.com/users/frpays/events{/privacy}","received_events_url":"https://api.github.com/users/frpays/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/frpays/lc0","description":"The rewritten engine, originally for tensorflow. Now all other backends have been ported here.","fork":true,"url":"https://api.github.com/repos/frpays/lc0","forks_url":"https://api.github.com/repos/frpays/lc0/forks","keys_url":"https://api.github.com/repos/frpays/lc0/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frpays/lc0/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frpays/lc0/teams","hooks_url":"https://api.github.com/repos/frpays/lc0/hooks","issue_events_url":"https://api.github.com/repos/frpays/lc0/issues/events{/number}","events_url":"https://api.github.com/repos/frpays/lc0/events","assignees_url":"https://api.github.com/repos/frpays/lc0/assignees{/user}","branches_url":"https://api.github.com/repos/frpays/lc0/branches{/branch}","tags_url":"https://api.github.com/repos/frpays/lc0/tags","blobs_url":"https://api.github.com/repos/frpays/lc0/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frpays/lc0/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frpays/lc0/git/refs{/sha}","trees_url":"https://api.github.com/repos/frpays/lc0/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frpays/lc0/statuses/{sha}","languages_url":"https://api.github.com/repos/frpays/lc0/languages","stargazers_url":"https://api.github.com/repos/frpays/lc0/stargazers","contributors_url":"https://api.github.com/repos/frpays/lc0/contributors","subscribers_url":"https://api.github.com/repos/frpays/lc0/subscribers","subscription_url":"https://api.github.com/repos/frpays/lc0/subscription","commits_url":"https://api.github.com/repos/frpays/lc0/commits{/sha}","git_commits_url":"https://api.github.com/repos/frpays/lc0/git/commits{/sha}","comments_url":"https://api.github.com/repos/frpays/lc0/comments{/number}","issue_comment_url":"https://api.github.com/repos/frpays/lc0/issues/comments{/number}","contents_url":"https://api.github.com/repos/frpays/lc0/contents/{+path}","compare_url":"https://api.github.com/repos/frpays/lc0/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frpays/lc0/merges","archive_url":"https://api.github.com/repos/frpays/lc0/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frpays/lc0/downloads","issues_url":"https://api.github.com/repos/frpays/lc0/issues{/number}","pulls_url":"https://api.github.com/repos/frpays/lc0/pulls{/number}","milestones_url":"https://api.github.com/repos/frpays/lc0/milestones{/number}","notifications_url":"https://api.github.com/repos/frpays/lc0/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frpays/lc0/labels{/name}","releases_url":"https://api.github.com/repos/frpays/lc0/releases{/id}","deployments_url":"https://api.github.com/repos/frpays/lc0/deployments","created_at":"2018-06-01T19:03:35Z","updated_at":"2018-06-14T18:28:33Z","pushed_at":"2018-06-24T20:22:25Z","git_url":"git://github.com/frpays/lc0.git","ssh_url":"git@github.com:frpays/lc0.git","clone_url":"https://github.com/frpays/lc0.git","svn_url":"https://github.com/frpays/lc0","homepage":"","size":34725,"stargazers_count":1,"watchers_count":1,"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":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"release"}},"base":{"label":"LeelaChessZero:master","ref":"master","sha":"342466824e985e7fea2c89559c4b137aedc41857","user":{"login":"LeelaChessZero","id":39777295,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzc3Mjk1","avatar_url":"https://avatars1.githubusercontent.com/u/39777295?v=4","gravatar_id":"","url":"https://api.github.com/users/LeelaChessZero","html_url":"https://github.com/LeelaChessZero","followers_url":"https://api.github.com/users/LeelaChessZero/followers","following_url":"https://api.github.com/users/LeelaChessZero/following{/other_user}","gists_url":"https://api.github.com/users/LeelaChessZero/gists{/gist_id}","starred_url":"https://api.github.com/users/LeelaChessZero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeelaChessZero/subscriptions","organizations_url":"https://api.github.com/users/LeelaChessZero/orgs","repos_url":"https://api.github.com/users/LeelaChessZero/repos","events_url":"https://api.github.com/users/LeelaChessZero/events{/privacy}","received_events_url":"https://api.github.com/users/LeelaChessZero/received_events","type":"Organization","site_admin":false},"repo":{"id":135489692,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU0ODk2OTI=","name":"lc0","full_name":"LeelaChessZero/lc0","owner":{"login":"LeelaChessZero","id":39777295,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzc3Mjk1","avatar_url":"https://avatars1.githubusercontent.com/u/39777295?v=4","gravatar_id":"","url":"https://api.github.com/users/LeelaChessZero","html_url":"https://github.com/LeelaChessZero","followers_url":"https://api.github.com/users/LeelaChessZero/followers","following_url":"https://api.github.com/users/LeelaChessZero/following{/other_user}","gists_url":"https://api.github.com/users/LeelaChessZero/gists{/gist_id}","starred_url":"https://api.github.com/users/LeelaChessZero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeelaChessZero/subscriptions","organizations_url":"https://api.github.com/users/LeelaChessZero/orgs","repos_url":"https://api.github.com/users/LeelaChessZero/repos","events_url":"https://api.github.com/users/LeelaChessZero/events{/privacy}","received_events_url":"https://api.github.com/users/LeelaChessZero/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LeelaChessZero/lc0","description":"The rewritten engine, originally for tensorflow. Now all other backends have been ported here.","fork":false,"url":"https://api.github.com/repos/LeelaChessZero/lc0","forks_url":"https://api.github.com/repos/LeelaChessZero/lc0/forks","keys_url":"https://api.github.com/repos/LeelaChessZero/lc0/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LeelaChessZero/lc0/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LeelaChessZero/lc0/teams","hooks_url":"https://api.github.com/repos/LeelaChessZero/lc0/hooks","issue_events_url":"https://api.github.com/repos/LeelaChessZero/lc0/issues/events{/number}","events_url":"https://api.github.com/repos/LeelaChessZero/lc0/events","assignees_url":"https://api.github.com/repos/LeelaChessZero/lc0/assignees{/user}","branches_url":"https://api.github.com/repos/LeelaChessZero/lc0/branches{/branch}","tags_url":"https://api.github.com/repos/LeelaChessZero/lc0/tags","blobs_url":"https://api.github.com/repos/LeelaChessZero/lc0/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LeelaChessZero/lc0/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LeelaChessZero/lc0/git/refs{/sha}","trees_url":"https://api.github.com/repos/LeelaChessZero/lc0/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LeelaChessZero/lc0/statuses/{sha}","languages_url":"https://api.github.com/repos/LeelaChessZero/lc0/languages","stargazers_url":"https://api.github.com/repos/LeelaChessZero/lc0/stargazers","contributors_url":"https://api.github.com/repos/LeelaChessZero/lc0/contributors","subscribers_url":"https://api.github.com/repos/LeelaChessZero/lc0/subscribers","subscription_url":"https://api.github.com/repos/LeelaChessZero/lc0/subscription","commits_url":"https://api.github.com/repos/LeelaChessZero/lc0/commits{/sha}","git_commits_url":"https://api.github.com/repos/LeelaChessZero/lc0/git/commits{/sha}","comments_url":"https://api.github.com/repos/LeelaChessZero/lc0/comments{/number}","issue_comment_url":"https://api.github.com/repos/LeelaChessZero/lc0/issues/comments{/number}","contents_url":"https://api.github.com/repos/LeelaChessZero/lc0/contents/{+path}","compare_url":"https://api.github.com/repos/LeelaChessZero/lc0/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LeelaChessZero/lc0/merges","archive_url":"https://api.github.com/repos/LeelaChessZero/lc0/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LeelaChessZero/lc0/downloads","issues_url":"https://api.github.com/repos/LeelaChessZero/lc0/issues{/number}","pulls_url":"https://api.github.com/repos/LeelaChessZero/lc0/pulls{/number}","milestones_url":"https://api.github.com/repos/LeelaChessZero/lc0/milestones{/number}","notifications_url":"https://api.github.com/repos/LeelaChessZero/lc0/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LeelaChessZero/lc0/labels{/name}","releases_url":"https://api.github.com/repos/LeelaChessZero/lc0/releases{/id}","deployments_url":"https://api.github.com/repos/LeelaChessZero/lc0/deployments","created_at":"2018-05-30T19:41:42Z","updated_at":"2018-06-27T11:10:38Z","pushed_at":"2018-06-27T23:21:00Z","git_url":"git://github.com/LeelaChessZero/lc0.git","ssh_url":"git@github.com:LeelaChessZero/lc0.git","clone_url":"https://github.com/LeelaChessZero/lc0.git","svn_url":"https://github.com/LeelaChessZero/lc0","homepage":"","size":34663,"stargazers_count":19,"watchers_count":19,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"archived":false,"open_issues_count":48,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":24,"open_issues":48,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87"},"html":{"href":"https://github.com/LeelaChessZero/lc0/pull/87"},"issue":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/issues/87"},"comments":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/LeelaChessZero/lc0/statuses/0c67f1009e73d49500dc47c37b7130335c710597"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"frpays"}}