Skip to content

Commit bb49352

Browse files
luciangfacebook-github-bot
authored andcommitted
caffe2/torch/csrc/jit/frontend/tree_views: workaround nvcc compiler error
Test Plan: Move it outside the header so it's not seen by nvcc ``` $ buck2 build -c fbcode.platform=platform010 fbcode//accelerators/pytorch/lib/cuda:ngram_repeat_block_cuda Downloading buck2... [======================================================================] watchman fresh instance event, clearing cache Using disallowed linker flag 'arvr/third-party/toolchains/platform009/build/mesa/lib/libGL.so' in library rule 'fbsource//third-party/toolchains:opengl' Using disallowed linker flag 'arvr/third-party/freeglut/3.0.0/libs/x64-linux/libglut.a' in library rule 'fbsource//third-party/toolchains:GLUT' Action Failed for fbcode//accelerators/pytorch/lib/cuda:ngram_repeat_block_cuda (ovr_config//platform/linux:x86_64-fbcode-platform010-clang-6dbc4bb1b9a32829)#5: cxx_compile ngram_repeat_block_cuda_kernel.cu (pic) failed with non-zero exit code 1 debug information: action_digest=b2bda91d24dad53e960c740ef9a412cee1902d86:94 stdout: stderr: fbcode/caffe2/torch/csrc/jit/frontend/tree_views.h: In instantiation of 'static torch::jit::Maybe<T> torch::jit::Maybe<T>::create(const torch::jit::SourceRange&, const T&) [with T = torch::jit::List<torch::jit::Property>]': fbcode/caffe2/torch/csrc/jit/frontend/tree_views.h:505:117: required from here fbcode/caffe2/torch/csrc/jit/frontend/tree_views.h:220:33: error: cannot convert 'const torch::jit::List<torch::jit::Property>' to 'torch::jit::TreeList&&' {aka 'c10::SmallVector<c10::intrusive_ptr<torch::jit::Tree>, 4>&&'} 220 | return Maybe<T>(Compound::create(TK_OPTION, range, {value})); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ fbcode/caffe2/torch/csrc/jit/frontend/tree.h:144:1: note: initializing argument 3 of 'static torch::jit::TreeRef torch::jit::Compound::create(int, const torch::jit::SourceRange&, torch::jit::TreeList&&)' 143 | const SourceRange& range_, | ~~~~~~~~~~~~~~~~~~~~~~~~ 144 | TreeList&& trees_) { | ^ fbcode/caffe2/torch/csrc/jit/frontend/tree_views.h: In instantiation of 'static torch::jit::Maybe<T> torch::jit::Maybe<T>::create(const torch::jit::SourceRange&, const T&) [with T = torch::jit::List<torch::jit::Assign>]': fbcode/caffe2/torch/csrc/jit/frontend/tree_views.h:505:171: required from here fbcode/caffe2/torch/csrc/jit/frontend/tree_views.h:220:33: error: cannot convert 'const torch::jit::List<torch::jit::Assign>' to 'torch::jit::TreeList&&' {aka 'c10::SmallVector<c10::intrusive_ptr<torch::jit::Tree>, 4>&&'} 220 | return Maybe<T>(Compound::create(TK_OPTION, range, {value})); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ fbcode/caffe2/torch/csrc/jit/frontend/tree.h:144:1: note: initializing argument 3 of 'static torch::jit::TreeRef torch::jit::Compound::create(int, const torch::jit::SourceRange&, torch::jit::TreeList&&)' 143 | const SourceRange& range_, | ~~~~~~~~~~~~~~~~~~~~~~~~ 144 | TreeList&& trees_) { | ^ cc1plus: note: unrecognized command-line option '-Wno-ignored-optimization-argument' may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option '-Wno-ambiguous-reversed-operator' may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option '-Wno-ignored-optimization-argument' may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option '-Wno-ambiguous-reversed-operator' may have been intended to silence earlier diagnostics command: buck-out/v2/gen/fbcode/999b02f9444004c1/tools/build/__wrap_nvcc.py__/wrap_nvcc.py -_NVCC_BIN_ fbcode ...<omitted>... ors/pytorch/lib/cuda/__ngram_repeat_block_cuda__/__objects__/ngram_repeat_block_cuda_kernel.cu.pic.o (rerun with -v to view the untruncated command) ``` Reviewed By: zhxchen17 Differential Revision: D33592885 fbshipit-source-id: a36dcb3c8265d009b2287f0a479695d1ddbf85aa
1 parent 4bf1be8 commit bb49352

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

torch/csrc/jit/frontend/tree_views.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,22 @@ std::vector<std::string> getUnresolvedClassAttributes(const ClassDef& def) {
3636
return ret;
3737
}
3838

39+
/* static */ ClassDef ClassDef::create(
40+
const SourceRange& range,
41+
const Ident& name,
42+
const Maybe<Expr>& superclass,
43+
const List<Stmt>& body,
44+
const List<Property>& properties,
45+
const List<Assign>& assigns) {
46+
return ClassDef(Compound::create(
47+
TK_CLASS_DEF,
48+
range,
49+
{name,
50+
superclass,
51+
body,
52+
Maybe<List<Property>>::create(range, properties),
53+
Maybe<List<Assign>>::create(range, assigns)}));
54+
}
55+
3956
} // namespace jit
4057
} // namespace torch

torch/csrc/jit/frontend/tree_views.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,7 @@ struct ClassDef : public TreeView {
501501
const Maybe<Expr>& superclass,
502502
const List<Stmt>& body,
503503
const List<Property>& properties,
504-
const List<Assign>& assigns) {
505-
return ClassDef(Compound::create(
506-
TK_CLASS_DEF,
507-
range,
508-
{name,
509-
superclass,
510-
body,
511-
Maybe<List<Property>>::create(range, properties),
512-
Maybe<List<Assign>>::create(range, assigns)}));
513-
}
504+
const List<Assign>& assigns);
514505
};
515506

516507
TORCH_API std::vector<std::string> getUnresolvedClassAttributes(

0 commit comments

Comments
 (0)