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

OpenGL backend (stage 1) #535

Merged
merged 19 commits into from
Feb 27, 2020
Merged

OpenGL backend (stage 1) #535

merged 19 commits into from
Feb 27, 2020

Conversation

archibate
Copy link
Collaborator

Related issue id = #492

@archibate
Copy link
Collaborator Author

This is a fragment of #495.

@archibate archibate requested review from yuanming-hu and k-ye and removed request for yuanming-hu February 25, 2020 15:19
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good in general except for a few places to be changed slightly.

cmake/TaichiCore.cmake Outdated Show resolved Hide resolved
taichi/platform/opengl/opengl_data_types.h Outdated Show resolved Hide resolved
taichi/program.cpp Outdated Show resolved Hide resolved
@k-ye
Copy link
Member

k-ye commented Feb 26, 2020

I found a styling issue. Taichi codebase follows this

void foo() {
  // ...
}

instead of starting { at a new line... Before merging, could you run the formatter to fix those :)?

cmake/TaichiCore.cmake Outdated Show resolved Hide resolved
examples/opengl_backend.py Outdated Show resolved Hide resolved
@yuanming-hu
Copy link
Member

Before merging, could you run the formatter to fix those :)?

The formatter we use is clang-format-6.0. Note that different versions of clang-format gives you slightly different results. Sorry, I didn't make this explicit in the developer guideline. Btw, is there a code format checker service for github? Maybe we can add that to the ckecks, just like Travis amd AppVeyor.

@yuanming-hu
Copy link
Member

Sooner or later we may want to introduce something like cpplint to Taichi so that some bugs can be detected early. Not sure if there's a way to set that up just like Travis. I've might have seen other projects using related services though.

@k-ye
Copy link
Member

k-ye commented Feb 26, 2020

The formatter we use is clang-format-6.0. Note that different versions of clang-format gives you slightly different results.

Hmm, I thought the styling is determined by clang_format_style, e.g. LLVM or Google?

Sooner or later we may want to introduce something like cpplint to Taichi

I see. TBH I don't know much about the CI infra. But can we add a run-linter step? And if that step fails, it means the code doesn't comply with Taichi's coding style, so the authors should format their code before merging?

@yuanming-hu
Copy link
Member

Hmm, I thought the styling is determined by clang_format_style, e.g. LLVM or Google?

Ideally, yes. In practice, I find the version of clang-format also affects the result. So it's (clang-format-version + .clang-format) that determines the final code format :-)

I see. TBH I don't know much about the CI infra. But can we add a run-linter step? And if that step fails, it means the code doesn't comply with Taichi's coding style, so the authors should format their code before merging?

Yeah we used to have a githook for running clang-format. Not sure if we should re-enable that. The downside is that with these enabled it would take a couple more seconds for git commit and not every developer would take the time to install the linters.

Returning to bed now and happy to talk more about code format issues tmr. (I was getting up to use the bathroom yet for some reason ended up with coding... LOL)

@k-ye
Copy link
Member

k-ye commented Feb 26, 2020

I see. I guess we can enforce formatting when the project becomes more mature... (And sorry about discussing this here @archibate , this should have been discussed this in #466 ... )

Returning to bed now and happy to talk more about code format issues tmr.

LOL, I thought you travelled to another time zone

@archibate
Copy link
Collaborator Author

archibate commented Feb 26, 2020

I found a styling issue. Taichi codebase follows this

void foo() {
  // ...
}

instead of starting { at a new line... Before merging, could you run the formatter to fix those :)?

Oh! I see... I think we'd better run ti format after all stages done instead of now, so that git merge won't bother me with conflicts :)

@archibate
Copy link
Collaborator Author

worker 'gw0' crashed while running 'tests/python/test_ad_atomic.py::test_ad_reduce'
================== 1 failed, 251 passed in 453.86s (0:07:33) ==================

Why is pytest always crashing these days...

@k-ye
Copy link
Member

k-ye commented Feb 26, 2020

Why is pytest always crashing these days...

Actually, is it a legit usage to have multiple OpenGL context in multiple threads? I somehow remembered this singleton design of OpenGL, could that be the root cause...?

@archibate
Copy link
Collaborator Author

Actually, is it a legit usage to have multiple OpenGL context in multiple threads? I somehow remembered this singleton design of OpenGL, could that be the root cause...?

This happens in other PRs too, where GL codes are not merged at all.

@archibate
Copy link
Collaborator Author

I believe #523 will solve this after its merge.

@yuanming-hu
Copy link
Member

I see. I guess we can enforce formatting when the project becomes more mature... (And sorry about discussing this here @archibate , this should have been discussed this in #466 ... )

I think we'd better run ti format after all stages done instead of now, so that git merge won't bother me with conflicts :)

Yeah, right before we release v0.6.0, let's reformat everything, and enforce every future commit follow certain code format.

Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

I've done one more pass. I think this is ready to squash & merge after the potential memory leakages are fixed. What do you think @k-ye?

taichi/platform/opengl/opengl_api.cpp Outdated Show resolved Hide resolved
taichi/platform/opengl/opengl_api.cpp Outdated Show resolved Hide resolved
taichi/platform/opengl/opengl_api.cpp Outdated Show resolved Hide resolved
[skip ci] test inout data[3] success

[skip ci] try to pass kernel arguments
Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

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

I think i only have a few nits, otherwise LGTM! (I don't have much experience with OpenGL, but i think in general it looks good )

python/taichi/lang/__init__.py Outdated Show resolved Hide resolved
taichi/backends/struct_opengl.cpp Show resolved Hide resolved
taichi/program.cpp Show resolved Hide resolved
@archibate
Copy link
Collaborator Author

Looks good. Preparing g2 now.

@archibate archibate requested a review from k-ye February 27, 2020 14:05
@archibate
Copy link
Collaborator Author

Anybody?

@yuanming-hu
Copy link
Member

Sorry I have a few meetings this morning. I think this PR looks good now. Merging! Thank you again for this amazing piece of contribution!!

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