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

[vulkan] Codegen & runtime improvements #5213

Merged
merged 9 commits into from
Jun 23, 2022
Merged

Conversation

bobcao3
Copy link
Collaborator

@bobcao3 bobcao3 commented Jun 20, 2022

Two changes have been made:

  1. Introduces a "Type compiler" system, that contains an IR that can be built easily from C++ or translated from Taichi SNodes, and then the type IR can be simplified or transformed, then compiles down to SPIR-V. It automatically handles layouts with the concept of a LayoutContext, and it is now used to handle the generation of the argument buffer struct type in the codegen. The next step would be to use this system on the root buffer, and solve the aliasing problem, by using a type transformer that solves the appropriate storage types for root buffers. This also potentially helps the effort of adding sparse fields support into the SPIR-V codegen. This IR is largely inspired by MLIR (but as we can not upgrade our LLVM yet, it would be hard to directly use MLIR, thus this solution)

  2. Changes the runtime code, elimiated the generate_command_list call so that we don't need to pass massive amount of arguments into that function. In addition, external pointer access analysis is re-introduced, with this information host shadow buffers are also introduced to reduce device to host transfer overhead. This finally fixed the performance regression seen on stable fluid and cornell box examples when using old GUI.

@bobcao3 bobcao3 requested review from turbo0628, ailzhang and k-ye June 20, 2022 20:39
@netlify
Copy link

netlify bot commented Jun 20, 2022

Deploy Preview for docsite-preview canceled.

Name Link
🔨 Latest commit 5f03f12
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/62b3432fd4c2cb0008674a6b

@bobcao3 bobcao3 requested a review from PENGUINLIONG June 21, 2022 01:38
Copy link
Member

@PENGUINLIONG PENGUINLIONG left a comment

Choose a reason for hiding this comment

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

lgtm

taichi/backends/vulkan/vulkan_device.cpp Show resolved Hide resolved
taichi/codegen/spirv/snode_struct_compiler.h Show resolved Hide resolved
taichi/runtime/gfx/runtime.cpp Show resolved Hide resolved
taichi/runtime/gfx/runtime.cpp Show resolved Hide resolved
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.

Nice work!! (will be nicer if they can split into smaller PRs in the future haha :P

taichi/codegen/spirv/kernel_utils.cpp Show resolved Hide resolved
taichi/codegen/spirv/spirv_codegen.cpp Outdated Show resolved Hide resolved
@bobcao3 bobcao3 merged commit 46b5632 into taichi-dev:master Jun 23, 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