GitHub PullRequestReviewCommentEvent at 2014-11-21 21:45:14
Repository: Halide
Actor: zvookin
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/20744321","id":20744321,"diff_hunk":"@@ -176,18 +271,28 @@ CodeGen::~CodeGen() {\n     builder = NULL;\n }\n \n-bool CodeGen::llvm_initialized = false;\n-bool CodeGen::llvm_X86_enabled = false;\n-bool CodeGen::llvm_ARM_enabled = false;\n-bool CodeGen::llvm_AArch64_enabled = false;\n-bool CodeGen::llvm_NVPTX_enabled = false;\n-bool CodeGen::llvm_Mips_enabled = false;\n+bool CodeGen_LLVM::llvm_initialized = false;\n+bool CodeGen_LLVM::llvm_X86_enabled = false;\n+bool CodeGen_LLVM::llvm_ARM_enabled = false;\n+bool CodeGen_LLVM::llvm_AArch64_enabled = false;\n+bool CodeGen_LLVM::llvm_NVPTX_enabled = false;\n+bool CodeGen_LLVM::llvm_Mips_enabled = false;\n \n-void CodeGen::compile(Stmt stmt, string name,\n+void CodeGen_LLVM::compile(Stmt stmt, string name,\n                       const vector<Argument> &args,\n                       const vector<Buffer> &images_to_embed) {\n+    init_module();\n+\n+    // Fix the target triple\n+    module = get_initial_module_for_target(target, context);\n+\n+    llvm::Triple triple = get_target_triple();","path":"src/CodeGen_LLVM.cpp","position":183,"original_position":183,"commit_id":"46ea807ae533c63e25a637443d683dfd44974ab6","original_commit_id":"46ea807ae533c63e25a637443d683dfd44974ab6","user":{"login":"zvookin","id":1501716,"avatar_url":"https://avatars.githubusercontent.com/u/1501716?v=3","gravatar_id":"","url":"https://api.github.com/users/zvookin","html_url":"https://github.com/zvookin","followers_url":"https://api.github.com/users/zvookin/followers","following_url":"https://api.github.com/users/zvookin/following{/other_user}","gists_url":"https://api.github.com/users/zvookin/gists{/gist_id}","starred_url":"https://api.github.com/users/zvookin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zvookin/subscriptions","organizations_url":"https://api.github.com/users/zvookin/orgs","repos_url":"https://api.github.com/users/zvookin/repos","events_url":"https://api.github.com/users/zvookin/events{/privacy}","received_events_url":"https://api.github.com/users/zvookin/received_events","type":"User","site_admin":false},"body":"I think we should factor the LLVM specific code out of Target, possibly into CodeGen_LLVM, possibly into another class. This includes all the initmod stuff, linking, etc.","created_at":"2014-11-21T21:45:14Z","updated_at":"2014-11-21T21:45:14Z","html_url":"https://github.com/halide/Halide/pull/560#discussion_r20744321","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/560","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/20744321"},"html":{"href":"https://github.com/halide/Halide/pull/560#discussion_r20744321"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/560"}}},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/560","id":24816280,"html_url":"https://github.com/halide/Halide/pull/560","diff_url":"https://github.com/halide/Halide/pull/560.diff","patch_url":"https://github.com/halide/Halide/pull/560.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/560","number":560,"state":"open","locked":false,"title":"Small refactoring of CodeGen classes to fix naming of CodeGen, make LLVM logic common.","user":{"login":"zvookin","id":1501716,"avatar_url":"https://avatars.githubusercontent.com/u/1501716?v=3","gravatar_id":"","url":"https://api.github.com/users/zvookin","html_url":"https://github.com/zvookin","followers_url":"https://api.github.com/users/zvookin/followers","following_url":"https://api.github.com/users/zvookin/following{/other_user}","gists_url":"https://api.github.com/users/zvookin/gists{/gist_id}","starred_url":"https://api.github.com/users/zvookin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zvookin/subscriptions","organizations_url":"https://api.github.com/users/zvookin/orgs","repos_url":"https://api.github.com/users/zvookin/repos","events_url":"https://api.github.com/users/zvookin/events{/privacy}","received_events_url":"https://api.github.com/users/zvookin/received_events","type":"User","site_admin":false},"body":"This PR makes the naming of our CodeGen classes a bit more logical and eliminates duplicated code in compiling for LLVM. I originally started on this while tracking down the optimize_module crash, which turned out to be something else, but I feel this is an improvement to the code and sets up some other changes as follows:\r\n\r\n1) Adding a top-level CodeGen class which is independent of LLVM. This should make some parts of StmtCompiler cleaner and can make it clear that functionality such as function_takes_user_context is not connected to LLVM.\r\n\r\n2) CodeGen_Posix should go away. It has nothing to do with Posix and can either be folded in to CodeGen_LLVM, or made into a helper class. (CodeGen_Allocation or some such.)\r\n\r\n3) All LLVM specific codegen for GPU backends should be built on Halide IR so that we can do things like call GPU code from the C backend. (There is not much of a use case for doing this from C, but it makes a lot of sense for a JavaScript backend, which I hope we will have.) Hopefully this will allow getting rid of the templated CodeGen_GPU_Host classes.","created_at":"2014-11-21T03:05:19Z","updated_at":"2014-11-21T21:45:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e427612e933022fbd75c069f80884ce5bcb7395","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/560/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/560/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments/{number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/560/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/46ea807ae533c63e25a637443d683dfd44974ab6","head":{"label":"halide:codegen_compile_refactor","ref":"codegen_compile_refactor","sha":"46ea807ae533c63e25a637443d683dfd44974ab6","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for image processing and computational photography","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments/{number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","created_at":"2012-07-31T04:05:25Z","updated_at":"2014-11-21T16:20:12Z","pushed_at":"2014-11-21T19:13:14Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":113735,"stargazers_count":875,"watchers_count":875,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":142,"mirror_url":null,"open_issues_count":76,"forks":142,"open_issues":76,"watchers":875,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"2c4a8dfbc6b83fc0a9d2d0abe9e45caee2be9201","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for image processing and computational photography","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments/{number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","created_at":"2012-07-31T04:05:25Z","updated_at":"2014-11-21T16:20:12Z","pushed_at":"2014-11-21T19:13:14Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":113735,"stargazers_count":875,"watchers_count":875,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":142,"mirror_url":null,"open_issues_count":76,"forks":142,"open_issues":76,"watchers":875,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/560"},"html":{"href":"https://github.com/halide/Halide/pull/560"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/560"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/560/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/560/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/560/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/46ea807ae533c63e25a637443d683dfd44974ab6"}}}}