{"action":"created","issue":{"url":"https://api.github.com/repos/flame/blis/issues/148","repository_url":"https://api.github.com/repos/flame/blis","labels_url":"https://api.github.com/repos/flame/blis/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/flame/blis/issues/148/comments","events_url":"https://api.github.com/repos/flame/blis/issues/148/events","html_url":"https://github.com/flame/blis/issues/148","id":248038916,"number":148,"title":"Possible missing sanity check in bli_determine_blocksize_b_sub()","user":{"login":"hominhquan","id":1337056,"avatar_url":"https://avatars3.githubusercontent.com/u/1337056?v=4","gravatar_id":"","url":"https://api.github.com/users/hominhquan","html_url":"https://github.com/hominhquan","followers_url":"https://api.github.com/users/hominhquan/followers","following_url":"https://api.github.com/users/hominhquan/following{/other_user}","gists_url":"https://api.github.com/users/hominhquan/gists{/gist_id}","starred_url":"https://api.github.com/users/hominhquan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hominhquan/subscriptions","organizations_url":"https://api.github.com/users/hominhquan/orgs","repos_url":"https://api.github.com/users/hominhquan/repos","events_url":"https://api.github.com/users/hominhquan/events{/privacy}","received_events_url":"https://api.github.com/users/hominhquan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-04T15:25:13Z","updated_at":"2017-08-04T20:12:59Z","closed_at":null,"body":"\r\nIn `bli_determine_blocksize_b_sub()`  -  from frame/base/bli_blksz.c:285, I think a sanity check should be added for the case `dim_left_now == 0`. The reason is as follow : \r\n       \r\ndim_t bli_determine_blocksize_b_sub(....)\r\n{\r\n\r\n\t// Compute how much of the matrix dimension is left, including the\r\n\t// chunk that will correspond to the blocksize we are computing now.\r\n\tdim_left_now = dim - i;\r\n\r\n\t// Sanity check : if dim_left_now is zero then return zero without\r\n\t// going any further.\r\n\t// For bli_determine_blocksize_f_sub(), this check was somehow luckily done\r\n\t// by comparing to b_max. Here, since we intelligently return b_alg if\r\n\t// dim_left_now multiple of b_alg, we must take care of the case where\r\n\t// dim_left_now is zero, because zero modulo anything is zero.\r\n\tif ( dim_left_now == 0 )\r\n\t\treturn 0;\r\n\r\n\tdim_at_edge = dim_left_now % b_alg;\r\n\r\n\t// If dim_left_now is a multiple of b_alg, we can safely return b_alg\r\n\t// without going any further.\r\n\tif ( dim_at_edge == 0 )\r\n\t\treturn b_alg;\r\n\r\n}"},"comment":{"url":"https://api.github.com/repos/flame/blis/issues/comments/320342740","html_url":"https://github.com/flame/blis/issues/148#issuecomment-320342740","issue_url":"https://api.github.com/repos/flame/blis/issues/148","id":320342740,"user":{"login":"fgvanzee","id":5487570,"avatar_url":"https://avatars1.githubusercontent.com/u/5487570?v=4","gravatar_id":"","url":"https://api.github.com/users/fgvanzee","html_url":"https://github.com/fgvanzee","followers_url":"https://api.github.com/users/fgvanzee/followers","following_url":"https://api.github.com/users/fgvanzee/following{/other_user}","gists_url":"https://api.github.com/users/fgvanzee/gists{/gist_id}","starred_url":"https://api.github.com/users/fgvanzee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgvanzee/subscriptions","organizations_url":"https://api.github.com/users/fgvanzee/orgs","repos_url":"https://api.github.com/users/fgvanzee/repos","events_url":"https://api.github.com/users/fgvanzee/events{/privacy}","received_events_url":"https://api.github.com/users/fgvanzee/received_events","type":"User","site_admin":false},"created_at":"2017-08-04T20:12:59Z","updated_at":"2017-08-04T20:12:59Z","body":"@hominhquan Can you give an example of when this sanity check would be needed? The only case I can think of in which it would apply is if computation is performed on a matrix where the dimension being partitioned is equal to zero. (But this situation should actually be handled by higher-level code, so the sanity check would never be used there either.)"}}
{"actor":{"display_login":"fgvanzee"}}