pytorch_compiler_tutorial icon indicating copy to clipboard operation
pytorch_compiler_tutorial copied to clipboard

torch 1.4 build error

Open Andrechang opened this issue 5 years ago • 3 comments

I get this error when using with torch 1.4.0a0+7f73f1d

pytorch_compiler_tutorial/src/register.cpp:44:14: error: invalid user-defined conversion from ‘pybind11_init_pointwise_compiler(pybind11::module&)::<lambda(const torch::jit::Node*)>’ to ‘torch::jit::OperationCreator {aka std::function<int(std::vector<c10::IValue, std::allocator<c10::IValue> >&)> (*)(const torch::jit::Node*)}’ [-fpermissive]
       options)});
pytorch_compiler_tutorial/src/register.cpp:44:16: error: no matching function for call to ‘c10::RegisterOperators::RegisterOperators(<brace-enclosed initializer list>)’
       options)});

Andrechang avatar Mar 31 '20 23:03 Andrechang

I had run into same issue - seems like there were some changes to API with recent pytorch code. Looking into examples elsewhere in pytorch code, tried rewriting it as foll. and it seems to compile better (although I moved to a different issue now - when executing import pointwise_compiler : It encounters undefined symbol: _ZTIN5torch3jit9GraphAttrE (typeinfo for torch::jit::GraphAttr)

RegisterOperators op({Operator( pointwise_compiler_symbol, [](const Node* node) -> Operation { auto compiler = std::make_shared<PointwiseCompiler>(node); return [compiler](Stack& stack) { compiler->run(stack); return 0; }; }, c10::AliasAnalysisKind::PURE_FUNCTION)});

ananthdurbha avatar Jul 18 '20 16:07 ananthdurbha

@ananthdurbha I met the same issue with yours. I'm wondering if you have resolved it?

feihugis avatar Oct 29 '21 07:10 feihugis

Solve this issue by using clang++ and build pytorch from source. There may be other better solutions.

feihugis avatar Oct 29 '21 22:10 feihugis