Skip to content

Commit

Permalink
[refactor] Remove unused has_external_arrays flag (taichi-dev#6497)
Browse files Browse the repository at this point in the history
Issue: taichi-dev#5662 

### Brief Summary
Some cleanup/refactor before implementation.
  • Loading branch information
ailzhang authored Nov 2, 2022
1 parent 1254657 commit 4ab9f1b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions python/taichi/lang/kernel_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ def func__(*args):

tmps = []
callbacks = []
has_external_arrays = False
has_torch = has_pytorch()
has_pp = has_paddle()

Expand Down Expand Up @@ -677,25 +676,18 @@ def func__(*args):
elif isinstance(needed,
ndarray_type.NdarrayType) and isinstance(
v, taichi.lang._ndarray.Ndarray):
has_external_arrays = True
v = v.arr
launch_ctx.set_arg_ndarray(actual_argument_slot, v)
launch_ctx.set_arg_ndarray(actual_argument_slot, v.arr)
elif isinstance(needed,
texture_type.TextureType) and isinstance(
v, taichi.lang._texture.Texture):
has_external_arrays = True
v = v.tex
launch_ctx.set_arg_texture(actual_argument_slot, v)
launch_ctx.set_arg_texture(actual_argument_slot, v.tex)
elif isinstance(needed,
texture_type.RWTextureType) and isinstance(
v, taichi.lang._texture.Texture):
has_external_arrays = True
v = v.tex
launch_ctx.set_arg_rw_texture(actual_argument_slot, v)
launch_ctx.set_arg_rw_texture(actual_argument_slot, v.tex)
elif isinstance(
needed,
ndarray_type.NdarrayType) and (self.match_ext_arr(v)):
has_external_arrays = True
is_numpy = isinstance(v, np.ndarray)
is_torch = isinstance(v,
torch.Tensor) if has_torch else False
Expand Down

0 comments on commit 4ab9f1b

Please sign in to comment.