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

Tensor type assertion failure when switching off the matrix scalarization #7061

Closed
turbo0628 opened this issue Jan 5, 2023 · 1 comment
Closed
Assignees

Comments

@turbo0628
Copy link
Member

Script:

import taichi as ti
import taichi.math as tm

ti.init(arch=ti.cuda, print_kernel_llvm_ir=True, print_ir=True, real_matrix_scalarize=False)

f = ti.field(ti.f32, 2)

@ti.kernel
def vec_test()->ti.f32:
    a = 1.0
    v1 = ti.math.vec4([a, a, a, a * 2])
    return v1[3]

vec_test()

Log and trace

[I 01/05/23 16:01:21.445 36690] [compile_to_offloads.cpp:operator()@22] [vec_test_c76_0] Matrix ptr lowered:
kernel {
  <f32> $0 = const 1.0
  <i32> $1 = const 2
  <f32> $2 = mul $0 $1
  <[Tensor (4) f32]> $3 = [$0, $0, $0, $2]
  <[Tensor (4) f32]> $4 = cast_value<f32> $3
  <[Tensor (4) f32]> $5 = alloca
  $6 : local store [$5 <- $4]
  <i32> $7 = const 3
  <*f32> $8 = shift ptr [$5 + $7]
  <f32> $9 = local load [$8]
  <f32> $10 = cast_value<f32> $9
  $11 : return tmp10
}
[E 01/05/23 16:01:21.445 36690] [type_factory.cpp:promoted_type@222] Assertion failure: a->is<TensorType>() && b->is<TensorType>()


Traceback (most recent call last):
  File "/home/taichigraphics/dev/taichi-fork/gemm.py", line 14, in <module>
    vec_test()
  File "/home/taichigraphics/miniconda3/envs/taichi-dev/lib/python3.9/site-packages/taichi-1.4.0-py3.9-linux-x86_64.egg/taichi/lang/kernel_impl.py", line 955, in wrapped
    return primal(*args, **kwargs)
  File "/home/taichigraphics/miniconda3/envs/taichi-dev/lib/python3.9/site-packages/taichi-1.4.0-py3.9-linux-x86_64.egg/taichi/lang/kernel_impl.py", line 882, in __call__
    return self.runtime.compiled_functions[key](*args)
  File "/home/taichigraphics/miniconda3/envs/taichi-dev/lib/python3.9/site-packages/taichi-1.4.0-py3.9-linux-x86_64.egg/taichi/lang/kernel_impl.py", line 807, in func__
    raise e from None
  File "/home/taichigraphics/miniconda3/envs/taichi-dev/lib/python3.9/site-packages/taichi-1.4.0-py3.9-linux-x86_64.egg/taichi/lang/kernel_impl.py", line 804, in func__
    t_kernel(launch_ctx)
RuntimeError: [type_factory.cpp:promoted_type@222] Assertion failure: a->is<TensorType>() && b->is<TensorType>()
@github-project-automation github-project-automation bot moved this to Untriaged in Taichi Lang Jan 5, 2023
@neozhaoliang neozhaoliang moved this from Untriaged to In Progress in Taichi Lang Jan 6, 2023
@jim19930609 jim19930609 removed their assignment Jan 6, 2023
@jim19930609 jim19930609 self-assigned this Jan 18, 2023
@jim19930609
Copy link
Contributor

jim19930609 commented Jan 18, 2023

Seems to be working with latest master commit, and I believe this is the PR that fixed it: #7124. Assigning back to @turbo0628 for further verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants