Skip to content

Commit

Permalink
Refactor2023: Remove IRNode::get_config and IRNode::get_kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
PGZXB committed Dec 7, 2022
1 parent 19d6e11 commit 592f798
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 29 deletions.
5 changes: 2 additions & 3 deletions taichi/codegen/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ LLVMCompiledKernel KernelCodeGen::compile_kernel_to_module() {
using TaskFunc = int32 (*)(void *);
std::vector<TaskFunc> task_funcs(offloads.size());
for (int i = 0; i < offloads.size(); i++) {
auto compile_func = [&, i] {
auto compile_func = [&, kernel = this->kernel, i] {
tlctx->fetch_this_thread_struct_module();
auto offload =
irpass::analysis::clone(offloads[i].get(), offloads[i]->get_kernel());
auto offload = irpass::analysis::clone(offloads[i].get(), kernel);
irpass::re_id(offload.get());
auto new_data =
this->compile_task(&config, nullptr, offload->as<OffloadedStmt>());
Expand Down
3 changes: 1 addition & 2 deletions taichi/codegen/dx12/codegen_dx12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ KernelCodeGenDX12::CompileResult KernelCodeGenDX12::compile() {

CompileResult Result;
for (int i = 0; i < offloads.size(); i++) {
auto offload =
irpass::analysis::clone(offloads[i].get(), offloads[i]->get_kernel());
auto offload = irpass::analysis::clone(offloads[i].get(), kernel);
irpass::re_id(offload.get());
auto *offload_stmt = offload->as<OffloadedStmt>();
auto new_data = compile_task(&config, nullptr, offload_stmt);
Expand Down
3 changes: 0 additions & 3 deletions taichi/ir/ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,9 @@ class IRNode {
virtual IRNode *get_parent() const = 0;

IRNode *get_ir_root();
Kernel *get_kernel() const;

virtual ~IRNode() = default;

CompileConfig &get_config() const;

template <typename T>
bool is() const {
return dynamic_cast<const T *>(this) != nullptr;
Expand Down
20 changes: 0 additions & 20 deletions taichi/program/ir_node_extended_impl.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion taichi/transforms/compile_to_offloads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void offload_to_executable(IRNode *ir,
irpass::analysis::verify(ir);

if (is_extension_supported(config.arch, Extension::quant) &&
ir->get_config().quant_opt_atomic_demotion) {
config.quant_opt_atomic_demotion) {
irpass::analysis::gather_uniquely_accessed_bit_structs(ir, amgr.get());
}

Expand Down

0 comments on commit 592f798

Please sign in to comment.