{"action":"created","issue":{"url":"https://api.github.com/repos/StanfordLegion/legion/issues/413","repository_url":"https://api.github.com/repos/StanfordLegion/legion","labels_url":"https://api.github.com/repos/StanfordLegion/legion/issues/413/labels{/name}","comments_url":"https://api.github.com/repos/StanfordLegion/legion/issues/413/comments","events_url":"https://api.github.com/repos/StanfordLegion/legion/issues/413/events","html_url":"https://github.com/StanfordLegion/legion/issues/413","id":347198902,"node_id":"MDU6SXNzdWUzNDcxOTg5MDI=","number":413,"title":"Extend loop optimizer to handle modulo on launch bounds","user":{"login":"manopapad","id":215728,"node_id":"MDQ6VXNlcjIxNTcyOA==","avatar_url":"https://avatars1.githubusercontent.com/u/215728?v=4","gravatar_id":"","url":"https://api.github.com/users/manopapad","html_url":"https://github.com/manopapad","followers_url":"https://api.github.com/users/manopapad/followers","following_url":"https://api.github.com/users/manopapad/following{/other_user}","gists_url":"https://api.github.com/users/manopapad/gists{/gist_id}","starred_url":"https://api.github.com/users/manopapad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manopapad/subscriptions","organizations_url":"https://api.github.com/users/manopapad/orgs","repos_url":"https://api.github.com/users/manopapad/repos","events_url":"https://api.github.com/users/manopapad/events{/privacy}","received_events_url":"https://api.github.com/users/manopapad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"elliottslaughter","id":3129,"node_id":"MDQ6VXNlcjMxMjk=","avatar_url":"https://avatars0.githubusercontent.com/u/3129?v=4","gravatar_id":"","url":"https://api.github.com/users/elliottslaughter","html_url":"https://github.com/elliottslaughter","followers_url":"https://api.github.com/users/elliottslaughter/followers","following_url":"https://api.github.com/users/elliottslaughter/following{/other_user}","gists_url":"https://api.github.com/users/elliottslaughter/gists{/gist_id}","starred_url":"https://api.github.com/users/elliottslaughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliottslaughter/subscriptions","organizations_url":"https://api.github.com/users/elliottslaughter/orgs","repos_url":"https://api.github.com/users/elliottslaughter/repos","events_url":"https://api.github.com/users/elliottslaughter/events{/privacy}","received_events_url":"https://api.github.com/users/elliottslaughter/received_events","type":"User","site_admin":false},"assignees":[{"login":"elliottslaughter","id":3129,"node_id":"MDQ6VXNlcjMxMjk=","avatar_url":"https://avatars0.githubusercontent.com/u/3129?v=4","gravatar_id":"","url":"https://api.github.com/users/elliottslaughter","html_url":"https://github.com/elliottslaughter","followers_url":"https://api.github.com/users/elliottslaughter/followers","following_url":"https://api.github.com/users/elliottslaughter/following{/other_user}","gists_url":"https://api.github.com/users/elliottslaughter/gists{/gist_id}","starred_url":"https://api.github.com/users/elliottslaughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliottslaughter/subscriptions","organizations_url":"https://api.github.com/users/elliottslaughter/orgs","repos_url":"https://api.github.com/users/elliottslaughter/repos","events_url":"https://api.github.com/users/elliottslaughter/events{/privacy}","received_events_url":"https://api.github.com/users/elliottslaughter/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-08-02T22:38:43Z","updated_at":"2018-11-18T00:57:33Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The following snippet is a simplified version of a pattern we use in Soleil, to wrap around the domain in an index-space launch. Regent's loop optimizer cannot currently handle this pattern, which means we have to use sequential launches. This is fine for now, but might become more of an issue when we switch to DCR.\r\n\r\n```\r\nimport 'regent'\r\ntask foo(r : region(ispace(int3d),int))\r\nwhere reads writes(r) do\r\n  for idx in r do\r\n    r[idx] += 1\r\n  end\r\nend\r\ntask main()\r\n  var r = region(ispace(int3d,{8,8,8}), int)\r\n  fill(r, 42)\r\n  var cs = ispace(int3d,{2,2,2})\r\n  var p = partition(equal, r, cs)\r\n  __demand(__parallel)\r\n  for c in cs do\r\n    foo(p[(c + {1,0,0} + cs.bounds.hi) % cs.bounds.hi])\r\n  end\r\nend\r\nregentlib.start(main)\r\n```"},"comment":{"url":"https://api.github.com/repos/StanfordLegion/legion/issues/comments/439659157","html_url":"https://github.com/StanfordLegion/legion/issues/413#issuecomment-439659157","issue_url":"https://api.github.com/repos/StanfordLegion/legion/issues/413","id":439659157,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTY1OTE1Nw==","user":{"login":"manopapad","id":215728,"node_id":"MDQ6VXNlcjIxNTcyOA==","avatar_url":"https://avatars1.githubusercontent.com/u/215728?v=4","gravatar_id":"","url":"https://api.github.com/users/manopapad","html_url":"https://github.com/manopapad","followers_url":"https://api.github.com/users/manopapad/followers","following_url":"https://api.github.com/users/manopapad/following{/other_user}","gists_url":"https://api.github.com/users/manopapad/gists{/gist_id}","starred_url":"https://api.github.com/users/manopapad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manopapad/subscriptions","organizations_url":"https://api.github.com/users/manopapad/orgs","repos_url":"https://api.github.com/users/manopapad/repos","events_url":"https://api.github.com/users/manopapad/events{/privacy}","received_events_url":"https://api.github.com/users/manopapad/received_events","type":"User","site_admin":false},"created_at":"2018-11-18T00:57:33Z","updated_at":"2018-11-18T00:57:33Z","author_association":"CONTRIBUTOR","body":"I was looking at this today and realized that my code snippet is wrong. The following expression is not safe:\r\n```\r\n(c + {1,0,0} + cs.bounds.hi) % cs.bounds.hi\r\n```\r\nIt should instead be:\r\n```\r\n(c + {1,0,0} + cs.bounds.hi+{1,1,1}) % (cs.bounds.hi+{1,1,1})\r\n```\r\nwhich is equivalent to what we actually do in Soleil:\r\n```\r\nvar cs = ispace(int3d,{NX,NY,NZ})\r\nfor c in cs do\r\n  foo(p[(c + {1,0,0} + {NX,NY,NZ}) % {NX,NY,NZ}])\r\nend\r\n```\r\nThis is starting to get pretty complex, but I don't immediately see any other (non-built-in) way to communicate to the compiler that we want to modulo over the loop bounds."}}
{"actor":{"display_login":"manopapad"}}