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

xb.Op.scalar maps unsigned int to torch signed int #8798

Open
tengyifei opened this issue Mar 5, 2025 · 2 comments
Open

xb.Op.scalar maps unsigned int to torch signed int #8798

tengyifei opened this issue Mar 5, 2025 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers needs reproduction

Comments

@tengyifei
Copy link
Collaborator

torch supports unsigned int types so this is probably a bug.

@rpsilva-aws rpsilva-aws added the good first issue Good for newcomers label Mar 5, 2025
@ysiraichi ysiraichi added bug Something isn't working needs reproduction labels Mar 6, 2025
@iwknow
Copy link

iwknow commented Mar 13, 2025

is there an instruction to reproduce the issue? if it is easy to reproduce, i can take a look.

@rpsilva-aws
Copy link
Collaborator

rpsilva-aws commented Mar 14, 2025

I don't have an exact repro at the moment, but I can write down on how we could go about it.
The issue refers to _XLA_PT_TYPE_MAP.

The only place where this exists today is (via to_torch_type):

  @classmethod
  def scalar(cls, builder, value, dtype=None):
    return mkleaf(
        'Constant',
        builder,
        value=torch.tensor(value, dtype=cls.to_torch_type(dtype)))

Hence, if you can use the XLA builder to generate a computation that derives the type of a torch.uint32, but generates an XLA S32 type - we could use that to trigger either a lowering error or an accuracy issue (e.g. overflow).

You can start by looking at test_operations.py to mimic/repro the behavior. If I have time, I can generate one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers needs reproduction
Projects
None yet
Development

No branches or pull requests

4 participants