Hi
I meet a weird issue in the different environments
I set the environments by
- The same docker image Ubuntu 18.04 LTS
- Mount the same NFS folder which contains the TVM source code
- Use the same user account and .bashrc for the same env variables
- One is based on VMware, one is based on a bare-metal machine with Ubuntu 22.04 LTS
- Use the same config.cmake
I got the result as below:
In docker on VMware, cmake has not found the llvm
-- Not found - LLVM_LIBS
-- Fall back to using llvm-config
-- Use llvm-config=/usr/lib/llvm-10/bin/llvm-config
-- Found LLVM_INCLUDE_DIRS=/usr/lib/llvm-10/include
-- Found LLVM_DEFINITIONS=-D_GNU_SOURCE;-D__STDC_CONSTANT_MACROS;-D__STDC_FORMAT_MACROS;-D__STDC_LIMIT_MACROS
-- Found LLVM_LIBS=/usr/lib/llvm-10/lib/libLLVM-10.so
-- Found TVM_LLVM_VERSION=100
-- Build with LLVM 10.0.0
-- Set TVM_LLVM_VERSION=100
-- Build with contrib.random
-- Build with contrib.sort
-- Build with contrib.hybriddump
-- Build with PACE2 support
-- Git found: /usr/bin/git
-- Found TVM_GIT_COMMIT_HASH=be557109007ecc7a6d822984594b87790160a201
-- Found TVM_GIT_COMMIT_TIME=2024-03-21 10:55:21 +0800
-- Performing Test SUPPORT_CXX17
-- Performing Test SUPPORT_CXX17 - Success
-- Autoset: USE_LIBBACKTRACE=ON in Linux
52680 ./tvm_src/build/libtvm.so
ldd ./tvm_src/build/libtvm.so
linux-vdso.so.1 (0x00007ffe3126c000)
libLLVM-10.so.1 => /usr/lib/llvm-10/lib/libLLVM-10.so.1 (0x00007f176abab000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f176a9a7000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f176a61e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f176a280000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f176a068000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1769e49000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1769a58000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1771e7e000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f1769850000)
libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2 (0x00007f1769619000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f17693fc000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f17691f4000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f1768fca000)
In the docker on bare-metal machine
-- Link with dynamic LLVM library
-- Found LLVM_INCLUDE_DIRS=/usr/lib/llvm-6.0/include
-- Found LLVM_DEFINITIONS=-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- Found LLVM_LIBS=LLVM
-- Found TVM_LLVM_VERSION=60
-- Build with LLVM 6.0.0
-- Set TVM_LLVM_VERSION=60
-- Build with contrib.random
-- Build with contrib.sort
-- Build with contrib.hybriddump
-- Build with PACE2 support
-- Git found: /usr/bin/git
-- Found TVM_GIT_COMMIT_HASH=be557109007ecc7a6d822984594b87790160a201
-- Found TVM_GIT_COMMIT_TIME=2024-03-21 10:55:21 +0800
-- Performing Test SUPPORT_CXX17
-- Performing Test SUPPORT_CXX17 - Success
-- Autoset: USE_LIBBACKTRACE=ON in Linux
52356 ./tvm_src/build/libtvm.so
ldd ./tvm_src/build/libtvm.so
linux-vdso.so.1 (0x00007fff98bdb000)
libLLVM-6.0.so.1 => /usr/lib/llvm-6.0/lib/libLLVM-6.0.so.1 (0x00007f7dcfebd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7dcfcb9000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7dcf930000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7dcf592000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7dcf37a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7dcf15b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7dced6a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7dd6520000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f7dceb62000)
libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2 (0x00007f7dce92b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7dce70e000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f7dce4e4000)
The initial judgment is that the difference appears in the execution results of find_package
if(${LLVM_CONFIG} MATCHES ${IS_TRUE_PATTERN})
find_package(LLVM ${llvm_version_required} REQUIRED CONFIG)
llvm_map_components_to_libnames(LLVM_LIBS "all")
if (NOT LLVM_LIBS)
message(STATUS "Not found - LLVM_LIBS")
message(STATUS "Fall back to using llvm-config")
set(LLVM_CONFIG "${LLVM_TOOLS_BINARY_DIR}/llvm-config")
endif()
endif()
I guess that the processing of find_package is related to the CPU flag, is that true and why?
The CPU flags of VMware:
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est
tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm
ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities
The CPU flags of bare-metal machine
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid avx512f avx512dq rdseed adx smap clflushopt clwb avx512c d avx512bw avx512vl xsaveopt xsavec xsaves arat pku ospke md_clear flush_l1d arch_capabilities