Skip to content

Commit

Permalink
Refactor2023: Remove Program::current_callable (fixed bugs)
Browse files Browse the repository at this point in the history
  • Loading branch information
PGZXB committed Dec 7, 2022
1 parent a4852af commit fdd230f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions python/taichi/lang/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,7 @@ def global_thread_idx():
>>>
test()
"""
return impl.get_runtime().prog.current_ast_builder(
).insert_thread_idx_expr()
return impl.get_runtime().compiling_callable.ast_builder().insert_thread_idx_expr()


def mesh_patch_idx():
Expand Down
2 changes: 1 addition & 1 deletion python/taichi/lang/simt/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def thread_idx():
def global_thread_idx():
arch = impl.get_runtime().prog.config().arch
if arch == _ti_core.cuda:
return impl.get_runtime().prog.current_ast_builder(
return impl.get_runtime().compiling_callable.ast_builder(
).insert_thread_idx_expr()
if impl.get_runtime().prog.config().arch == _ti_core.vulkan:
return impl.call_internal("vkGlobalThreadIdx",
Expand Down
4 changes: 2 additions & 2 deletions python/taichi/lang/source_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def from_source(cls, source_code, compile_fn=None):

def __getattr__(self, item):
def bitcode_func_call_wrapper(*args):
impl.get_runtime().prog.current_ast_builder(
impl.get_runtime().compiling_callable.ast_builder(
).insert_external_func_call(0, '', self.bc, item,
make_expr_group(args),
make_expr_group([]))
Expand All @@ -134,7 +134,7 @@ def bitcode_func_call_wrapper(*args):
def external_func_call_wrapper(args=[], outputs=[]):
func_addr = ctypes.cast(self.so.__getattr__(item),
ctypes.c_void_p).value
impl.get_runtime().prog.current_ast_builder(
impl.get_runtime().compiling_callable.ast_builder(
).insert_external_func_call(func_addr, '', '', '',
make_expr_group(args),
make_expr_group(outputs))
Expand Down

0 comments on commit fdd230f

Please sign in to comment.