Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm] [refactor] LLVMProgramImpl code clean up: part-2 #5187

Merged

Conversation

jim19930609
Copy link
Contributor

Related issue = #4800, #5114

Removed Program::get_llvm_program_impl() interface, so we dont have to expose backend-specific LlvmProgramImpl along with Program.

@netlify
Copy link

netlify bot commented Jun 16, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit c02d2f3
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/62ac0d0613ddcc00072ebd46
😎 Deploy Preview https://deploy-preview-5187--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I vaguely remember this function - the main motivation of get_llvm_program_implwas a "temp" hack and we wanted to remove it in the future (as opposed to exposing a more backend agnostic version). Please correct me if I'm wrong! @k-ye

@jim19930609
Copy link
Contributor Author

jim19930609 commented Jun 17, 2022

Hmmm I vaguely remember this function - the main motivation of get_llvm_program_implwas a "temp" hack and we wanted to remove it in the future (as opposed to exposing a more backend agnostic version). Please correct me if I'm wrong! @k-ye

I guess we'll have to get rid of get_llvm_program_impl() since it exposes LlvmProgramImpl in the header file, which couples the entire LLVM backend with the higher-level Base classes (any file that include "program.h").

IMO, removing the backend-agnostic interface get_program_impl() could be a second step, which helps keep the higher-level interface clean. This is difficult because we put too many members and implementations in the "Program" object:

2022-06-17 10-03-53 的屏幕截图

Ideally, we should move most of these members to "ProgramImpl", and make "Program" an interface class. In that way, lower-level objects such as CodeGenLLVM can keep "LlvmProgramImpl" instead of "Program".

@k-ye
Copy link
Member

k-ye commented Jun 17, 2022

I agree that we should remove get_llvm_program_impl() first. One nit: inside codegen, instead of writing static_cast<LlvmProgramImpl*>(program->get_program_impl()), we could write a small helper here?

@jim19930609 jim19930609 requested a review from ailzhang June 17, 2022 05:03
Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jim19930609 jim19930609 merged commit 8750b3c into taichi-dev:master Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants