KEMBAR78
Fix `triangular_solve` meta function out parameter names. by ysiraichi · Pull Request #140186 · pytorch/pytorch · GitHub
Skip to content

Conversation

@ysiraichi
Copy link
Collaborator

@ysiraichi ysiraichi commented Nov 8, 2024

Stack from ghstack (oldest at bottom):

This PR replaces the parameter names specified in the triangular_solve_meta
function (specifically in its @out_wrapper(...) decorator) by those written in the
native_functions.yaml file.

This name mismatch caused the operation to fail when using the meta device (see error
below):

Traceback (most recent call last):
  File "examples/test.py", line 23, in <module>
    torch.triangular_solve(b.to("meta"), A.to("meta"), out=meta_out)
  File "torch/_decomp/__init__.py", line 100, in _fn
    return f(*args, **kwargs, out=None if is_none else out_kwargs)
  File "torch/_prims_common/wrappers.py", line 289, in _fn
    result = fn(*args, **kwargs)
TypeError: triangular_solve_meta() got an unexpected keyword argument 'X'

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 8, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/140186

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit bded981 with merge base ffb9790 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

ysiraichi added a commit that referenced this pull request Nov 8, 2024
This PR replaces the parameter names specified in the `triangular_solve_meta`
function (specifically in its `out_wrapper(...)` decorator) by those written in the
_native_functions.yaml_ file.

This name mismatch caused the operation to fail when using the meta device (see error
below):

```python
Traceback (most recent call last):
  File "examples/test.py", line 23, in <module>
    torch.triangular_solve(b.to("meta"), A.to("meta"), out=meta_out)
  File "torch/_decomp/__init__.py", line 100, in _fn
    return f(*args, **kwargs, out=None if is_none else out_kwargs)
  File "torch/_prims_common/wrappers.py", line 289, in _fn
    result = fn(*args, **kwargs)
TypeError: triangular_solve_meta() got an unexpected keyword argument 'X'
```

ghstack-source-id: 1fa2de5
Pull Request resolved: #140186
@ysiraichi ysiraichi added the topic: not user facing topic category label Nov 8, 2024
[ghstack-poisoned]
@ysiraichi ysiraichi requested a review from mruberry as a code owner November 9, 2024 17:31
ysiraichi added a commit that referenced this pull request Nov 9, 2024
This PR replaces the parameter names specified in the `triangular_solve_meta`
function (specifically in its `out_wrapper(...)` decorator) by those written in the
_native_functions.yaml_ file.

This name mismatch caused the operation to fail when using the meta device (see error
below):

```python
Traceback (most recent call last):
  File "examples/test.py", line 23, in <module>
    torch.triangular_solve(b.to("meta"), A.to("meta"), out=meta_out)
  File "torch/_decomp/__init__.py", line 100, in _fn
    return f(*args, **kwargs, out=None if is_none else out_kwargs)
  File "torch/_prims_common/wrappers.py", line 289, in _fn
    result = fn(*args, **kwargs)
TypeError: triangular_solve_meta() got an unexpected keyword argument 'X'
```

ghstack-source-id: 67cdf96
Pull Request resolved: #140186
@ysiraichi ysiraichi requested a review from ezyang November 11, 2024 17:43
[ghstack-poisoned]
@ezyang
Copy link
Contributor

ezyang commented Nov 12, 2024

what's with the new xfail?

@ezyang
Copy link
Contributor

ezyang commented Nov 12, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 12, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@ysiraichi
Copy link
Collaborator Author

what's with the new xfail?

So, before this PR, the meta consistency test wasn't failing because both meta and CPU devices were raising error. Different errors, though:

  • CPU: dtype mismatch
  • Meta: the one in the description of this PR

After fixing the meta error, meta stopped raising an error. Which means that it's not consistent with its CPU version anymore.

The next PR in this stack fixes the consistency error, deleting the XFAIL.

pytorchmergebot pushed a commit that referenced this pull request Nov 14, 2024
pytorchmergebot pushed a commit that referenced this pull request Nov 18, 2024
Tracking issue: #138399

This PR fixes a number of reference implementations (which are also used as meta
functions), making them more consistent with CPU device. More specifically, it fixes those
operations that use `_make_elementwise_unary_reference` decorator, and don't error on
mismatching out argument dtype while they error when using concrete devices (e.g. CPU).

The fixed operations are:

- `abs`
- `ceil`
- `floor`
- `frac`
- `isneginf`
- `isposinf`
- `sgn`
- `sign`
- `signbit`
- `trunc`
Pull Request resolved: #140288
Approved by: https://github.com/ezyang
ghstack dependencies: #140186, #140286
pytorchmergebot pushed a commit that referenced this pull request Nov 18, 2024
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
…0186)

This PR replaces the parameter names specified in the `triangular_solve_meta`
function (specifically in its `@out_wrapper(...)` decorator) by those written in the
_native_functions.yaml_ file.

This name mismatch caused the operation to fail when using the meta device (see error
below):

```python
Traceback (most recent call last):
  File "examples/test.py", line 23, in <module>
    torch.triangular_solve(b.to("meta"), A.to("meta"), out=meta_out)
  File "torch/_decomp/__init__.py", line 100, in _fn
    return f(*args, **kwargs, out=None if is_none else out_kwargs)
  File "torch/_prims_common/wrappers.py", line 289, in _fn
    result = fn(*args, **kwargs)
TypeError: triangular_solve_meta() got an unexpected keyword argument 'X'
```
Pull Request resolved: pytorch#140186
Approved by: https://github.com/ezyang
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
Tracking issue: pytorch#138399

This PR fixes a number of reference implementations (which are also used as meta
functions), making them more consistent with CPU device. More specifically, it fixes those
operations that use `_make_elementwise_unary_reference` decorator, and don't error on
mismatching out argument dtype while they error when using concrete devices (e.g. CPU).

The fixed operations are:

- `abs`
- `ceil`
- `floor`
- `frac`
- `isneginf`
- `isposinf`
- `sgn`
- `sign`
- `signbit`
- `trunc`
Pull Request resolved: pytorch#140288
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#140186, pytorch#140286
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
@github-actions github-actions bot deleted the gh/ysiraichi/69/head branch December 14, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants