Add types argument to __torch_function__#34303
Add types argument to __torch_function__#34303hameerabbasi wants to merge 4 commits intopytorch:masterfrom
Conversation
650c830 to
9af0fc6
Compare
|
The docs for Ping @cpuhrsch, who may have some insight on how annoying the break in the API for I'm not sure if this would introduce runtime cost but it may be worth either having effectively a try/except in C++ as well as in the Python |
d4a5809 to
da71850
Compare
Done. |
|
@hameerabbasi adding benchmark results for this similar to how @ngoldbaum did this before would be good to do next, seems critical. There's docs on using py-spy for this |
|
Yes, benchmarks please! |
da71850 to
80810eb
Compare
💊 CircleCI build failures summary and remediationsAs of commit a3a403f (more details on the Dr. CI page): ✅ None of the build failures appear to be your fault 💚
🚧 1 upstream failure:These were probably caused by upstream breakages:
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 38 times. |
BenchmarksThis branch: The commit before it diverges from Although from running the benchmark a couple of times, everything seems to be well within noise. |
|
@hameerabbasi we went through this a bunch of times before, |
|
@rgommers those are the benchmarks I used in those PRs. |
|
@rgommers This is PyTorch's built-in test suite, not ASV. Also, I highly doubt adding an extra argument is going to affect performance in a measurable way. 😉 |
|
Hmm, I found the py-spy story much more convincing. The report here is a gain of 140 ns. Given that that's close to 10% of the total call overhead, I think it's important to not wave away? |
|
Here are the two Like I said, this is due to noise. I could re-run tests, but I ran each test a couple of times but reported the first run of each. The subsequent runs show a large variation, larger than is reported here (+-200 ns IIRC). So, it's possible due to pure noise that my addition had a reported performance better than |
|
Also, we're looking at the case of a one-element add, where the computation is basically nothing, and the whole cost is the machinery. |
|
The diff looks basically fine |
|
@hameerabbasi Some questions about benchmark hygiene:
|
80810eb to
0999ba7
Compare
You're right, I updated it. |
That sounds reasonable to me. It will be difficult to get people to find out about the script but if we at least know about it ourselves that will be good enough for now. |
We can just point to it from the critical parts of the |
|
Should I leave that to this PR or a follow-up? |
|
Separate PR seems better; that PR could be merged straight away, while I think this one we may want to consider together with the |
|
can you please merge with master |
|
Just FYI #34240 is still in progress of landing. |
|
Thanks Christian. We'll hold this PR for that one, and then remerge. |
|
Benchmark PR at #34645. |
|
#34240 was merged |
|
Re-merged. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Looks like internal tests are failing. |
|
@hameerabbasi I can't seem to push to your branch (did you fail to allow maintainers to update the branch). Could you please merge with master? |
That might've been unchecked by default, and I can't find the checkbox where it usually is on the side of the PR. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@cpuhrsch heads up this will break you |
This PR adds the
typesargument to__torch_function__as per RFC 0001: pytorch/rfcs#3