{"action":"created","issue":{"url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/issues/204","repository_url":"https://api.github.com/repos/RadeonOpenCompute/ROCm","labels_url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/issues/204/comments","events_url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/issues/204/events","html_url":"https://github.com/RadeonOpenCompute/ROCm/issues/204","id":257231281,"number":204,"title":"Code generation affected by unrelated kernel","user":{"login":"preda","id":706426,"avatar_url":"https://avatars1.githubusercontent.com/u/706426?v=4","gravatar_id":"","url":"https://api.github.com/users/preda","html_url":"https://github.com/preda","followers_url":"https://api.github.com/users/preda/followers","following_url":"https://api.github.com/users/preda/following{/other_user}","gists_url":"https://api.github.com/users/preda/gists{/gist_id}","starred_url":"https://api.github.com/users/preda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/preda/subscriptions","organizations_url":"https://api.github.com/users/preda/orgs","repos_url":"https://api.github.com/users/preda/repos","events_url":"https://api.github.com/users/preda/events{/privacy}","received_events_url":"https://api.github.com/users/preda/received_events","type":"User","site_admin":false},"labels":[{"id":343482759,"url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/labels/Bug_Functional_Issue","name":"Bug_Functional_Issue","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-09-13T01:33:46Z","updated_at":"2017-11-08T21:55:38Z","closed_at":null,"author_association":"NONE","body":"The exact source that displays the problem can be found here:\r\nhttps://github.com/preda/gpuowl/blob/master/gpuowl.cl#L338\r\n\r\nOn AMDGPU-pro 17.30, RX Vega 64, on Linux:\r\n\r\nI have two OpenCL kernels, that invoke the same function with different arguments:\r\n```\r\nvoid carryConvolution(....) { /* skipped */ }\r\n\r\nkernel void carryConv1K_2K(uint baseBitlen, [etc]) {\r\n  local double lds[4 * 256];\r\n  double2 u[4];\r\n  carryConvolution(4, 2048, lds, u, baseBitlen, etc);\r\n}\r\n\r\n#ifdef ENABLE_BUG\r\nkernel void  carryConv2K_2K(uint baseBitlen, [etc]) {\r\n  local double lds[8 * 256];\r\n  double2 u[8];\r\n  carryConvolution(8, 2048, lds, u, baseBitlen, etc);\r\n}\r\n#endif\r\n```\r\nThe ISA code generated for the first kernel depends on whether the second kernel (the #ifdef one) exists or not. The difference in code and perf is major, see these stats for the first kernel:\r\n\r\n1. When the second kernel is not present:\r\n```\r\n\t\tworkitem_private_segment_byte_size = 0\r\n\t\tworkgroup_group_segment_byte_size = 8192\r\n\t\tkernarg_segment_byte_size = 88\r\n\t\tworkgroup_fbarrier_count = 0\r\n\t\twavefront_sgpr_count = 20\r\n\t\tworkitem_vgpr_count = 83\r\n```\r\n2. When the second kernel is present (but not used):\r\n```\r\n\t\tworkitem_private_segment_byte_size = 80\r\n\t\tworkgroup_group_segment_byte_size = 8192\r\n\t\tkernarg_segment_byte_size = 88\r\n\t\tworkgroup_fbarrier_count = 0\r\n\t\twavefront_sgpr_count = 28\r\n\t\tworkitem_vgpr_count = 87\r\n```\r\n\r\nBoth variants seems to function correctly (aside from performance)."},"comment":{"url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/issues/comments/342973597","html_url":"https://github.com/RadeonOpenCompute/ROCm/issues/204#issuecomment-342973597","issue_url":"https://api.github.com/repos/RadeonOpenCompute/ROCm/issues/204","id":342973597,"user":{"login":"preda","id":706426,"avatar_url":"https://avatars1.githubusercontent.com/u/706426?v=4","gravatar_id":"","url":"https://api.github.com/users/preda","html_url":"https://github.com/preda","followers_url":"https://api.github.com/users/preda/followers","following_url":"https://api.github.com/users/preda/following{/other_user}","gists_url":"https://api.github.com/users/preda/gists{/gist_id}","starred_url":"https://api.github.com/users/preda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/preda/subscriptions","organizations_url":"https://api.github.com/users/preda/orgs","repos_url":"https://api.github.com/users/preda/repos","events_url":"https://api.github.com/users/preda/events{/privacy}","received_events_url":"https://api.github.com/users/preda/received_events","type":"User","site_admin":false},"created_at":"2017-11-08T21:55:38Z","updated_at":"2017-11-08T21:55:38Z","author_association":"NONE","body":"I think you're missing the point -- please read the initial description carefully. I'll try to clarify:\r\n\r\nThe compilation/optimization of the first kernel, let's call it A, depends on whether the kernel B is present or not.\r\n\r\nI'm not talking about a difference between compilation-of-A and compilation-of-B, but about a difference between A [when B is not present] with A [when B is present].\r\n\r\nNow, the opportunities for the optimization of A are obviously unaffected by the presence or not of B. So if the compiler generates worse code for A in one case, that's a bug. The fact that the compiler generates two significantly different compilations of the same kernel (A) depending on a factor that shouldn't affect it (presence or not of B) is a bug.\r\n"}}
{"actor":{"display_login":"preda"}}