You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/05/25 04:53:48 UTC

[GitHub] [tvm] lunar-walker opened a new issue, #11447: 'Expression have a constant value error' when compiling latest tvm 0.9 on Windows 10

lunar-walker opened a new issue, #11447:
URL: https://github.com/apache/tvm/issues/11447

   Hello,
   I'm trying to compile latest tvm on Windows 10 / Visual Studio Community 2019 with USE_CUDA, USE_LLVM "llvm-config --link-static", USE MKL, USE_MKLDNN, USE_CUDNN, USE_DNNL_CODEGEN, USE_TENSORRT_CODEGEN, USE_TENSORRT_RUNTIME options (cmake generate solution files successfully without any error) but it failed with following:-
   
   2>D:\code\tvm\src\runtime\contrib\dnnl\dnnl_json_runtime.cc(609,18): error C2131: expression did not evaluate to a constant
   2>D:\code\tvm\src\runtime\contrib\dnnl\dnnl_json_runtime.cc(609,18): message : failure was caused by a read of a variable outside its lifetime
   2>D:\code\tvm\src\runtime\contrib\dnnl\dnnl_json_runtime.cc(609,18): message : see usage of 'OC'
   
   Then later a lot of link errors.... i.e.
   4>LINK : fatal error LNK1181: cannot open input file 'D:\code\tvm\build\tvm_runtime_objs.dir\Release\src\runtime\vm\vm.cc.obj'
   8>LINK : warning LNK4044: unrecognized option '/Wl,--exclude-libs,ALL'; ignored
   7>LINK : warning LNK4044: unrecognized option '/Wl,--exclude-libs,ALL'; ignored
   8>LINK : fatal error LNK1181: cannot open input file 'D:\code\tvm\build\tvm_objs.dir\Release\src\relay\backend\contrib\tensorrt\codegen.cc.obj'
   7>LINK : fatal error LNK1181: cannot open input file 'D:\code\tvm\build\tvm_objs.dir\Release\src\relay\backend\contrib\tensorrt\codegen.cc.obj'
   
   I don't know much of C++ but apparently error 'expression did not evaluate to a constant' in \src\runtime\contrib\dnnl\dnnl_json_runtime.cc line 609 is justified as on same line  float bias[OC] = {0}; OC is not constant which compiler expects at compile time.
   
   If respective developer of the dnnl codegen module can look into it?
   
   Thanks for all the great work.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] masahi commented on issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #11447:
URL: https://github.com/apache/tvm/issues/11447#issuecomment-1137007165

   Are you enabling TensorRT with TVM? It looks like `no-deprecated-declarations` is only used by TensorRT backend. Probably our TensorRT support doesn't work on Windows. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] lunar-walker commented on issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10

Posted by GitBox <gi...@apache.org>.
lunar-walker commented on issue #11447:
URL: https://github.com/apache/tvm/issues/11447#issuecomment-1137037358

   That's correct. I'm trying to compile it with TensorRT. By looking at tvm_runtime_objs.vcxproj in VSCode, i found following lines:-
   
   <ClCompile Include="\tvm\src\runtime\contrib\tensorrt\tensorrt_builder.cc">
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
       </ClCompile>
       <ClCompile Include="\tvm\src\runtime\contrib\tensorrt\tensorrt_ops.cc">
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
       </ClCompile>
       <ClCompile Include="\tvm\src\runtime\contrib\tensorrt\tensorrt_runtime.cc">
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
         <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">%(AdditionalOptions) -Wno-deprecated-declarations</AdditionalOptions>
       </ClCompile>
   
   As i understand, VS cl.exe doesn't understand these flags so i simply removed these. So far compilation is going smooth after that. I will update once it completes.
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] lunar-walker closed issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10

Posted by GitBox <gi...@apache.org>.
lunar-walker closed issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10
URL: https://github.com/apache/tvm/issues/11447


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] lunar-walker commented on issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10

Posted by GitBox <gi...@apache.org>.
lunar-walker commented on issue #11447:
URL: https://github.com/apache/tvm/issues/11447#issuecomment-1138155746

   I can confirm that compilation went smooth with std::vector suggestion by @masahi . For -Wno-deprecated-declaration related errors, i modified tvm\cmake\modules\contrib\TensorRT.cmake file and commented out lines similar to 
   `set_source_files_properties(${COMPILER_TENSORRT_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations")`
   
   Compilation went OK, able to install tvm python package and tvmc seems to work. Now trying to setup python unittests to verify if everything is OK. You may close this issue now.
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] masahi commented on issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #11447:
URL: https://github.com/apache/tvm/issues/11447#issuecomment-1136969321

   That warning is a legit one, https://github.com/apache/tvm/blob/45f3d4a521ec476cd9960e3d2de4f66bde61bf23/src/runtime/contrib/dnnl/dnnl_json_runtime.cc#L609-L610
   
   `OC` is indeed not a constant.
   
   Instead it should be
   ```
         std::vector<float> bias(OC, 0);
         write_to_dnnl_memory(bias.data(), bias_memory, OC * sizeof(float));
   ```
   Can you try this on windows, and send a PR if it solves the issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] lunar-walker commented on issue #11447: 'Expression did not evaluate to a constant' error when compiling latest tvm 0.9 on Windows 10

Posted by GitBox <gi...@apache.org>.
lunar-walker commented on issue #11447:
URL: https://github.com/apache/tvm/issues/11447#issuecomment-1137004182

   Thanks dear,
   it worked like a charm...no compilation error now. However, i guess there is another **compiler / linking error** (seems small one)
   Error	D8021	invalid numeric argument '/Wno-deprecated-declarations'	tvm_runtime_objs	\tvm\build\cl
   
   I guess it is just extra commandline option (which is not recognized by VS2019 cl.exe) being passed to compiler however, i don't seem to find out the way how to disable / remove it. Tried looking in solution & project properties\commandline options but to no avail. 
   
   Can you please look into as well...
   
   Thanks
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org