Commit Graph

4 Commits

Author SHA1 Message Date
Sebastian Messmer
b01520ac9c Make schema part of RegisterOperators::Options (#26114)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26114

With this diff, the operator schema or name can be specified as part of the options objects:

```
static auto registry = torch::RegisterOperators()
  .op(torch::RegisterOperators::options().schema("my_op").kernel(&kernel))
  .op(...);
```

This does not break backwards compatibility, all old APIs are kept as shorthands.

This (a) makes the API more consistent, accumulating all options into the options objects and not treating schema special anymore, and (b) this is required for allowing the c10 dispatcher to forward registration calls to ATenDispatch for ops that are still on that dispatcher, see plan in https://github.com/pytorch/pytorch/issues/24132
ghstack-source-id: 90049402

Test Plan: unit tests

Differential Revision: D17350383

fbshipit-source-id: cbb8f33a52dccb2a4522753e7b5ac8ba35b908fd
2019-09-13 13:52:32 -07:00
Michael Suo
194acd023a Some alias analysis fixes (#25425)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25425

1. Properly invalidate memory locations when we change the points-to
set.
2. Don't build a new indexToElementMap in toString(), just use
`MemoryDag::fromIndex`
3. Fix transitive wildcard assignment

Test Plan: Imported from OSS

Differential Revision: D17126402

Pulled By: suo

fbshipit-source-id: cbd99027d2e78fd333dbf030172d3b7ac4df8349
2019-08-29 23:32:07 -07:00
Sebastian Messmer
cb022d7bec Fix AliasAnalysisKind::PURE on MSVC (#25375)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25375

Either MSVC or the Windows headers have a PURE macro defined and will replace
any occurrences of the PURE token in code with an empty string. Replace
AliasAnalysisKind::PURE with AliasAnalysisKind::PURE_FUNCTION.

Note: this is bc breaking.
ghstack-source-id: 89202222

Test Plan: unit tests

Differential Revision: D17107743

fbshipit-source-id: 899a20651ba32d50691956b5424b351586c21cec
2019-08-29 09:42:41 -07:00
Michael Suo
dfdb86a595 big cpp test reorg (#24801)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/24801

This is to fix the ODR-violations in fbcode static builds, which have been broken for several months.

This PR is unfortunately quite large, but the changes are only mechanical:
1. Tests defined in header files -> tests defined in cpp files
2. Remove the `torch::jit::testing` namespace -> `torch::jit`.
3. Single `test.h` file that aggregates all tests.
4. Separate out files for gtest and python versions of the tests instead of using a build flag
5. Add a readme for how to add a new test, and explaining a bit about why the cpp tests are the way they are.

Test Plan: Imported from OSS

Differential Revision: D16878605

Pulled By: suo

fbshipit-source-id: 27b5c077dadd990a5f74e25d01731f9c1f491603
2019-08-18 16:49:56 -07:00