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

Struct with Vector field in kernel argument error #7821

Closed
oliver-batchelor opened this issue Apr 16, 2023 · 1 comment
Closed

Struct with Vector field in kernel argument error #7821

oliver-batchelor opened this issue Apr 16, 2023 · 1 comment
Assignees

Comments

@oliver-batchelor
Copy link
Contributor

Thanks for the feature by the way, it is a great improvement. However it has an issue when one of the fields is a Vector type.

import taichi as ti
ti.init()

@ti.dataclass
class Foo:
    x: ti.f32
    y: ti.f32
    z : ti.math.vec3

@ti.kernel
def foo(x:Foo):
  print(x.x)

foo(Foo(1,2,ti.math.vec3(1,2,3)))


# (conan_ros) oliver-laptop sync python test_types.py
# [Taichi] version 1.6.0, llvm 15.0.4, commit cc4cacfa, linux, python 3.8.16
# [Taichi] Starting on arch=x64
# Traceback (most recent call last):
#   File "test_types.py", line 20, in <module>
#     foo(Foo(1,2,ti.math.vec3(1,2,3)))
#   File "/home/oliver/mambaforge/envs/conan_ros/lib/python3.8/site-packages/taichi/lang/kernel_impl.py", line 1036, in wrapped
#     return primal(*args, **kwargs)
#   File "/home/oliver/mambaforge/envs/conan_ros/lib/python3.8/site-packages/taichi/lang/kernel_impl.py", line 963, in __call__
#     return self.runtime.compiled_functions[key](*args)
#   File "/home/oliver/mambaforge/envs/conan_ros/lib/python3.8/site-packages/taichi/lang/kernel_impl.py", line 848, in func__
#     needed.set_kernel_struct_args(v, launch_ctx,
#   File "/home/oliver/mambaforge/envs/conan_ros/lib/python3.8/site-packages/taichi/lang/struct.py", line 686, in set_kernel_struct_args
#     dtype.set_kernel_struct_args(struct[name], launch_ctx,
# AttributeError: 'VectorType' object has no attribute 'set_kernel_struct_args'
@lin-hitonami
Copy link
Contributor

Thanks! It only supports primitive types in the struct now. Maybe vectors will be supported in the next release.

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

Successfully merging a pull request may close this issue.

2 participants