Skip to content

Conversation

@xta0
Copy link
Contributor

@xta0 xta0 commented Nov 21, 2019

Stack from ghstack:

Summary

When building PyTorch for iOS in BUCK, the compiler complains about the ivar shadowing

/Users/taox/fbsource/xplat/caffe2/aten/src/ATen/core/dispatch/Dispatcher.h:184:144: error: declaration shadows a field of 'c10::Dispatcher' [-Werror,-Wshadow]
inline Return Dispatcher::doCallUnboxed(const DispatchTable& dispatchTable, const LeftRight<ska::flat_hash_map<TensorTypeId, KernelFunction>>& backendFallbackKernels_, Args... args) const {
                                                                                                                                               ^
/Users/taox/fbsource/xplat/caffe2/aten/src/ATen/core/dispatch/Dispatcher.h:134:63: note: previous declaration is here
  LeftRight<ska::flat_hash_map<TensorTypeId, KernelFunction>> backendFallbackKernels_;

This happens because the internal iOS compiler enforces the [-Werror, -Wshadow] on every source file when compiling. Say in benchmark.mm we import <torch/script.h>, then it'll leads all the way to Dispatcher.h

 In file included from Apps/Internal/PyTorchPlayground/PyTorchPlayground/Application/Benchmark/Benchmark.mm:6:
In file included from /Users/taox/fbsource/xplat/caffe2/aten/src/ATen/ATen.h:5:
In file included from /Users/taox/fbsource/xplat/caffe2/aten/src/ATen/Context.h:4:
In file included from /Users/taox/fbsource/xplat/caffe2/aten/src/ATen/Tensor.h:12:
In file included from buck-out/cells/fbsource/gen/xplat/caffe2/TensorMethods.h/TensorMethods.h:10:
/Users/taox/fbsource/xplat/caffe2/aten/src/ATen/core/dispatch/Dispatcher.h

It'd be better to have a separate name for function parameters.

cc @shoumikhin

Differential Revision: D18649116

xta0 added a commit that referenced this pull request Nov 21, 2019
@xta0 xta0 requested a review from smessmer November 21, 2019 23:30
Copy link
Contributor

@smessmer smessmer left a comment

Choose a reason for hiding this comment

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

looks good, thanks

@facebook-github-bot facebook-github-bot deleted the gh/xta0/45/head branch December 10, 2019 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants