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

[lang] Vector size not checked before scalarize #7453

Closed
bobcao3 opened this issue Feb 27, 2023 · 0 comments · Fixed by #7480
Closed

[lang] Vector size not checked before scalarize #7453

bobcao3 opened this issue Feb 27, 2023 · 0 comments · Fixed by #7480
Assignees
Labels
bug We've confirmed that this is an BUG
Milestone

Comments

@bobcao3
Copy link
Collaborator

bobcao3 commented Feb 27, 2023

This following code:

import taichi as ti

ti.init()

f = ti.Vector.field(4, dtype = ti.f32, shape = ())

@ti.kernel
def update_f():
    f[None] = ti.Vector([1, 2, 3])

update_f()
print(f)

produces this error:

[Taichi] version 1.5.0, llvm 15.0.1, commit ae61418d, win, python 3.9.12
[I 02/27/23 14:08:59.905 27420] [shell.py:_shell_pop_print@23] Graphical python shell detected, using wrapped sys.stdout
c:\users\cheng cao\source\repos\taichi\python\taichi\types\ndarray_type.py:91: DeprecationWarning: The element_dim and element_shape arguments for ndarray will be deprecated in v1.5.0, use matrix dtype instead.
  warnings.warn(
[Taichi] Starting on arch=x64
[E 02/27/23 14:09:00.348 27420] [scalarize.cpp:taichi::lang::Scalarize::scalarize_store_stmt@51] Assertion failure: dest_tensor_type->get_shape() == val_tensor_type->get_shape()


Traceback (most recent call last):
  File "C:\Users\Cheng Cao\test_vec.py", line 11, in <module>
    update_f()
  File "c:\users\cheng cao\source\repos\taichi\python\taichi\lang\kernel_impl.py", line 1004, in wrapped
    return primal(*args, **kwargs)
  File "c:\users\cheng cao\source\repos\taichi\python\taichi\lang\shell.py", line 27, in new_call
    ret = old_call(*args, **kwargs)
  File "c:\users\cheng cao\source\repos\taichi\python\taichi\lang\kernel_impl.py", line 931, in __call__
    return self.runtime.compiled_functions[key](*args)
  File "c:\users\cheng cao\source\repos\taichi\python\taichi\lang\kernel_impl.py", line 835, in func__
    raise e from None
  File "c:\users\cheng cao\source\repos\taichi\python\taichi\lang\kernel_impl.py", line 832, in func__
    t_kernel(launch_ctx)
RuntimeError: [scalarize.cpp:taichi::lang::Scalarize::scalarize_store_stmt@51] Assertion failure: dest_tensor_type->get_shape() == val_tensor_type->get_shape()
  1. This should be a compile error
  2. This error should be caught in type check
@bobcao3 bobcao3 added the bug We've confirmed that this is an BUG label Feb 27, 2023
@github-project-automation github-project-automation bot moved this to Untriaged in Taichi Lang Feb 27, 2023
@turbo0628 turbo0628 added this to the v1.5.0 milestone Feb 28, 2023
@erizmr erizmr moved this from Untriaged to Todo in Taichi Lang Mar 3, 2023
strongoier added a commit that referenced this issue Mar 3, 2023
Issue: fix #7453

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from Todo to Done in Taichi Lang Mar 3, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: fix taichi-dev#7453

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug We've confirmed that this is an BUG
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants