Skip to content

discrepancy of results for dpctl.tensor.sin and dpt.tensor.expm1 for f4 and f8 data types on gpu #1439

Closed

Description

@vtavana

For the following cases the results are different for float32 and float64 on gpu.

  • sin
>>> dpt.sin(dpt.asarray(-0.,dtype='f4',device='gpu'))
usm_ndarray(0., dtype=float32)

>>> dpt.sin(dpt.asarray(-0.,dtype='f8',device='gpu'))
usm_ndarray(-0.)
  • expm1
>>> dpt.expm1(dpt.asarray(-0.,dtype='f4',device='gpu'))
usm_ndarray(-0., dtype=float32)

>>> dpt.expm1(dpt.asarray(-0.,dtype='f8',device='gpu'))
usm_ndarray(0.)

Activity

  1. changed the title [-]Array API and `dpctl.tensor` discrepancy for special cases of a few functions[/-] [+]discrepancy of results for `dpctl.tensor.sin` and `dpt.tensor.expm1` for `f4` and `f8` data types on `gpu`[/+] on Oct 13, 2023
  2. self-assigned this
    on Oct 13, 2023
  3. ndgrigorian commented on Oct 15, 2023

    @ndgrigorian
    Collaborator

    The cause in both cases is std::sin, which does not preserve the sign bit of -0. on GPU.

    Anywhere that std::sin is used, logic will need to be added to account for signed 0.

  4. added 2 commits that reference this issue on Nov 26, 2023
    e0349c5
    1c4b0ab
  5. added a commit that references this issue on Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions