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

[Bug] Fix incorrect CFG Graph structure due to missing Block wiith OffloadedStmts on LLVM backend #8113

Merged
merged 5 commits into from
Jun 2, 2023

Conversation

jim19930609
Copy link
Contributor

@jim19930609 jim19930609 commented May 31, 2023

Issue: fix #8057

Brief Summary

🤖 Generated by Copilot at 33e01dc

This pull request refactors the codegen modules and the IR cloning mechanism to support the new IR structure that wraps offloaded tasks in Block nodes. It updates the compile_task functions of different backends to take an IRNode pointer instead of an OffloadedStmt pointer. It also adds a new clone function to taichi/analysis/clone.cpp and a new special field to IRNode to facilitate the cloning process.

Walkthrough

🤖 Generated by Copilot at 33e01dc

  • Add a new function clone to deep copy statements (link, link)
  • Modify the function compile_task and its subclasses to take an IRNode pointer instead of an OffloadedStmt pointer as the last argument (link, link, link, link, link, link, link, link, link)
  • Add a new field special to class IRNode to indicate whether the node is a special node that should not be cloned or modified by certain passes (link)
  • Set the special field of the root node of the IR to true before cloning the offloaded statements and to false after cloning them in the function offload_to_executable in taichi/transforms/compile_to_offloads.cpp (link, link)
  • Wrap the cloned offloaded statements in a Block node before passing them to compile_task in the functions compile_kernel_to_module in taichi/codegen/codegen.cpp and compile in taichi/codegen/dx12/codegen_dx12.cpp (link, link)
  • Use the task_name method of the IRNode to get the name of the offloaded task in the function compile in taichi/codegen/dx12/codegen_dx12.cpp, instead of assuming it is an OffloadedStmt (link)
  • Remove the call to scalarize and full_simplify passes in the function offload_to_executable in taichi/transforms/compile_to_offloads.cpp, which are not needed after cloning the offloaded statements (link)

@netlify
Copy link

netlify bot commented May 31, 2023

Deploy Preview for docsite-preview canceled.

Name Link
🔨 Latest commit b9de29f
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/6477f5c7ffb11d00080b6add

Copy link
Contributor

@lin-hitonami lin-hitonami 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 98c7e45 into taichi-dev:master Jun 2, 2023
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.

[Bug] ContinueStmt failed to trigger on CUDA backend
2 participants