Skip to content

Precision loss for various taichi kernels? (f64 -> f32) #4

@EricCousineau-TRI

Description

@EricCousineau-TRI

Super minor, but one such example, off of ac1a2f7:

$ python3 -m plb.algorithms.solve --algo action --env_name Rollingpin-v1 --path output
...
[Taichi] version 0.7.26, llvm 10.0.0, commit e37bdb5e, linux, python 3.6.9
[Taichi] Starting on arch=cuda
...
[W 08/01/21 19:56:59.773 25212] [type_check.cpp:visit@70] [$10142] Atomic add (f32 to f64) may lose precision, at
[W 08/01/21 19:56:59.773 25212] [type_check.cpp:visit@71]
...
[W 08/01/21 19:57:02.387 25212] [type_check.cpp:visit@100] [$17705] Local store may lose precision (target = f32, value = f64) at
[W 08/01/21 19:57:02.387 25212] [type_check.cpp:visit@101]
...
  File ".../PlasticineLab/plb/engine/mpm_simulator.py", line 198, in grid_op
    v_out = self.primitives[i].collide(f, I * self.dx, v_out, self.dt)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/kernel_impl.py", line 50, in decorated
    return fun.__call__(*args)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/kernel_impl.py", line 122, in __call__
    ret = self.compiled(*args)
  File ".../PlasticineLab/plb/engine/primitive/primive_base.py", line 93, in collide
    dist = self.sdf(f, grid_pos)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/kernel_impl.py", line 50, in decorated
    return fun.__call__(*args)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/kernel_impl.py", line 122, in __call__
    ret = self.compiled(*args)
  File ".../PlasticineLab/plb/engine/primitive/primive_base.py", line 59, in sdf
    grid_pos = inv_trans(grid_pos, self.position[f], self.rotation[f])
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/util.py", line 163, in wrapped
    return func(*args, **kwargs)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/impl.py", line 202, in maybe_transform_ti_func_call_to_stmt
    return ti_func(*args, **kwargs)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/common_ops.py", line 227, in assign
    return ti.assign(self, other)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/ops.py", line 130, in wrapped
    return a.element_wise_writeback_binary(imp_foo, b)
  File ".../PlasticineLab/venv/lib/python3.6/site-packages/taichi/lang/matrix.py", line 179, in element_wise_writeback_binary
    ret.entries[i] = foo(self.entries[i], other.entries[i])

Once again, great work!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions