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

id(dtype) of builtin vectors not in real_type_ids #5767

Closed
neozhaoliang opened this issue Aug 15, 2022 · 1 comment
Closed

id(dtype) of builtin vectors not in real_type_ids #5767

neozhaoliang opened this issue Aug 15, 2022 · 1 comment
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@neozhaoliang
Copy link
Contributor

neozhaoliang commented Aug 15, 2022

To reproduce:

import taichi as ti

vec3 = ti.math.vec3
print(id(vec3.dtype))
print(ti.types.primitive_types.real_type_ids)

The result gives

140376791869680
[140376797782384, 140376797803760, 140376797803888, 9489216]

The id of the f32 type of vec3 is not in ti.types.real_type_ids.

This mismatch has the effect that the built-invec2/vec3/vec4 cannot be used as type hints since this line of code checks the id of the needed type.

Shall we change that line referenced above in kernel_impl.py to the following?

if needed.dtype in primitive_types.real_types:
@neozhaoliang neozhaoliang added the potential bug Something that looks like a bug but not yet confirmed label Aug 15, 2022
@taichi-gardener taichi-gardener moved this to Untriaged in Taichi Lang Aug 15, 2022
Repository owner moved this from Untriaged to Done in Taichi Lang Aug 17, 2022
@strongoier
Copy link
Contributor

Some notes for people interested in the cause of this issue -

The type of default_fp is actually DataType in C++, and a DataType stores a pointer to its actual Type. The actual Type is unique, but the DataType wrapper can be different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug Something that looks like a bug but not yet confirmed
Projects
Status: Done
Development

No branches or pull requests

2 participants