Torch does not build with Lazy TS disabled
Labels: module: build, triaged

### 🐛 Describe the bug

If I compile with `BUILD_LAZY_TS_BACKEND=0`, the linker fails with:

>    Creating library lib\torch_cpu.lib and object lib\torch_cpu.exp
> shape_inference.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl torch::lazy::TSLoweringContext::Lower(class torch::lazy::Node const *)" (?Lower@TSLoweringContext@lazy@torch@@QEAAXPEBVNode@23@@Z) referenced in function "public: struct torch::jit::Value * __cdecl torch::lazy::TSLoweringContext::GetOutputOp(struct torch::lazy::Output const &)" (?GetOutputOp@TSLoweringContext@lazy@torch@@QEAAPEAUValue@jit@3@AEBUOutput@23@@Z)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class torch::lazy::hash_t __cdecl torch::lazy::TsNode::hash(void)const " (?hash@TsNode@lazy@torch@@UEBA?AVhash_t@23@XZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class torch::lazy::hash_t __cdecl torch::lazy::TsNode::shapeHash(void)const " (?shapeHash@TsNode@lazy@torch@@UEBA?AVhash_t@23@XZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::vector<struct torch::jit::Value *,class std::allocator<struct torch::jit::Value *> > __cdecl torch::lazy::TsNode::Lower(class std::shared_ptr<struct torch::jit::GraphFunction>,class torch::lazy::TSLoweringContext *)const " (?Lower@TsNode@lazy@torch@@UEBA?AV?$vector@PEAUValue@jit@torch@@V?$allocator@PEAUValue@jit@torch@@@std@@@std@@V?$shared_ptr@UGraphFunction@jit@torch@@@5@PEAVTSLoweringContext@23@@Z)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::vector<struct torch::jit::Value *,class std::allocator<struct torch::jit::Value *> > __cdecl torch::lazy::TensorList::Lower(class std::shared_ptr<struct torch::jit::GraphFunction>,class torch::lazy::TSLoweringContext *)const " (?Lower@TensorList@lazy@torch@@UEBA?AV?$vector@PEAUValue@jit@torch@@V?$allocator@PEAUValue@jit@torch@@@std@@@std@@V?$shared_ptr@UGraphFunction@jit@torch@@@5@PEAVTSLoweringContext@23@@Z)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual __int64 __cdecl torch::lazy::SizeNode::getStaticValue(void)const " (?getStaticValue@SizeNode@lazy@torch@@UEBA_JXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl torch::lazy::SizeNode::isDynamic(void)const " (?isDynamic@SizeNode@lazy@torch@@UEBA_NXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl torch::lazy::SizeNode::ToString(void)const " (?ToString@SizeNode@lazy@torch@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::vector<struct torch::jit::Value *,class std::allocator<struct torch::jit::Value *> > __cdecl torch::lazy::SizeNode::Lower(class std::shared_ptr<struct torch::jit::GraphFunction>,class torch::lazy::TSLoweringContext *)const " (?Lower@SizeNode@lazy@torch@@UEBA?AV?$vector@PEAUValue@jit@torch@@V?$allocator@PEAUValue@jit@torch@@@std@@@std@@V?$shared_ptr@UGraphFunction@jit@torch@@@5@PEAVTSLoweringContext@23@@Z)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual __int64 __cdecl torch::lazy::SizeAdd::getStaticValue(void)const " (?getStaticValue@SizeAdd@lazy@torch@@UEBA_JXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl torch::lazy::SizeAdd::isDynamic(void)const " (?isDynamic@SizeAdd@lazy@torch@@UEBA_NXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl torch::lazy::SizeAdd::ToString(void)const " (?ToString@SizeAdd@lazy@torch@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual __int64 __cdecl torch::lazy::SizeMul::getStaticValue(void)const " (?getStaticValue@SizeMul@lazy@torch@@UEBA_JXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl torch::lazy::SizeMul::isDynamic(void)const " (?isDynamic@SizeMul@lazy@torch@@UEBA_NXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl torch::lazy::SizeMul::ToString(void)const " (?ToString@SizeMul@lazy@torch@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual __int64 __cdecl torch::lazy::SizeDiv::getStaticValue(void)const " (?getStaticValue@SizeDiv@lazy@torch@@UEBA_JXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl torch::lazy::SizeDiv::isDynamic(void)const " (?isDynamic@SizeDiv@lazy@torch@@UEBA_NXZ)
> shape_inference.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl torch::lazy::SizeDiv::ToString(void)const " (?ToString@SizeDiv@lazy@torch@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
> bin\torch_cpu.dll : fatal error LNK1120: 18 unresolved externals


I believe this has worked in the past versions of 1.12.0-dev. It now requires enabling Lazy TS backend to compile.

### Versions

Latest master

cc @malfet @seemethere