Skip to content

Conversation

@cpuhrsch
Copy link
Contributor

@cpuhrsch cpuhrsch commented Feb 22, 2019

Stacked on top of #17386

Brings us to 1014/1106 of writing.

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Feb 22, 2019
@cpuhrsch cpuhrsch force-pushed the ttsl branch 3 times, most recently from cc63fd9 to 325fd73 Compare February 27, 2019 02:13
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cpuhrsch
Copy link
Contributor Author

codegen diff

@cpuhrsch
Copy link
Contributor Author

Note: It's debatable whether we want to add support for long for ScalarType to the JIT and also if we might want to call it int64_t or int instead of long.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be removed.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be removed

@cpuhrsch cpuhrsch force-pushed the ttsl branch 2 times, most recently from b1680cc to 26e6924 Compare February 28, 2019 21:46
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cpuhrsch
Copy link
Contributor Author

cpuhrsch commented Mar 1, 2019

This is the changeset of the generated code.

@cpuhrsch cpuhrsch changed the title [DRAFT] Remove TensorOptions from native_functions.yaml Remove TensorOptions from native_functions.yaml Mar 1, 2019
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defaults are wrong:
dtype: the default is the default tensor type
layout: strided is correct for some of these, but wrong for others (e.g. sparse_coo_tensor below has default strided which is clearly wrong)
device: the default device is the device of the default tensor type.

Is there a reason we can't make the defaults for all of these None if they are determined at runtime? (It's fine to have a real default for layout but it should be correct).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defaults are determined based on what the JIT generates. They are indeed not logical, but that doesn't mean they're wrong in the way it's currently implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this for further edits: Shouldn't have defaults

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these types and defaults look not-pythonic. You don't have to change this now, but what's the long term plan?

i.e. ScalarType -> Dtype(?), in python this is "torch.dtype", but "dtype dtype" looks a bit strange. Maybe we should just write out the full types? e.g:

func: bartlett_window(int window_length, *, torch.dtype dtype=None, torch.layout layout=torch.strided, torch.device device=None) -> Tensor

Although then I guess you should write out torch.Tensor which seems annoying.

Thoughts? CC @zdevito.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind, this also needs be used in the JIT.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this look wrong -- doesn't this mean you have to provide values for dtype, layout, device?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even more so, how can a keyword argument "options" not require a default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do provide this a default value, it would, logically, make sense to provide one for the generated C++ code, however, you'll then get conflicts with empty_like(Tensor self) and empty_like(Tensor self, TensorOptions options={}), because it's ambiguous which symbol to use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok, the issue is this isn't combined with the above definition. Do you know why that is?

@cpuhrsch cpuhrsch changed the title Remove TensorOptions from native_functions.yaml Remove (almost all) TensorOptions from native_functions.yaml Mar 1, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cpuhrsch
Copy link
Contributor Author

cpuhrsch commented Mar 1, 2019

$ git diff torch/csrc/jit/generated/register_aten_ops_* | gist-paste
https://gist.github.com/ba972f121fda1e6ccb5318a8af2ab343

@cpuhrsch cpuhrsch force-pushed the ttsl branch 2 times, most recently from 2d6021f to 8bfda98 Compare March 2, 2019 01:21
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cpuhrsch cpuhrsch force-pushed the ttsl branch 2 times, most recently from 7c7af73 to c850bc0 Compare March 4, 2019 18:12
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs work / can be removed?

@cpuhrsch cpuhrsch requested a review from zdevito March 11, 2019 19:27
test/test_jit.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this seems like an improvement -- previously we had to mess with the dtype to get this to work right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this appears to be restricted to tracing

# device is specified as an IntArrayRef of { at::Device::Type, device_id }
{'name': 'device', 'type': ['Device', 'Device?'], 'is_nullable': False, 'annotation': None},
def copy_arguments(arguments):
new_arguments = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy.deepcopy?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Mar 12, 2019
Summary:
Stacked on top of pytorch/pytorch#17386

Brings us to 1014/1106 of writing.
Pull Request resolved: pytorch/pytorch#17385

Differential Revision: D14248008

Pulled By: cpuhrsch

fbshipit-source-id: 033e00de91e3edf7ae01ca03ebe436c0446b3b5c
petrex pushed a commit to petrex/pytorch that referenced this pull request Mar 14, 2019
* upstream/master: (87 commits)
  Make Variable::set_data non-const; cosmetic fixes.
  remove warning for upsample code (pytorch#17921)
  Optimize TileOp (pytorch#17290)
  Optimize channel_stats_op (pytorch#16243)
  enable shape inference for elementwise operators (pytorch#17885)
  Remove remaining test jit expects redux (pytorch#17924)
  Handle Scalars Better (pytorch#17875)
  Fixed a formatting issue in doc comments (pytorch#17505)
  Add nbytes, itemsize, element_size to at::Tensor. (pytorch#17810)
  Fix lint in test_distributions.py
  Fix lint in test_jit.py
  Fix lint errors in test_autograd
  Added a few extra python bindings to help with walking the IR graph from Python (pytorch#17822)
  kthvalue consistency with sort in the presence of NaN (pytorch#17824)
  Fix minor grammatical mistakes in torch/nn/modules/loss.py (pytorch#17892)
  Remove (almost all) TensorOptions from native_functions.yaml (pytorch#17385)
  Restore full Windows tests (pytorch#17102)
  Prevent VS2017 from emitting ambiguous symbol errors (second time)
  Fix windows test hang (pytorch#17778)
  torch.btrifact for tensors with greater than 3 dimensions (pytorch#14964)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants