Make possible to use static libraries generated by tfcompile in MSVC. (#9908)
Currently it is possible to generate MSVC-compatible static libraries from a Linux build of tfcompile using the target triple "x86_64-pc-windows-msvc". However, just linking such library does not work out-of-the-box because of a trivial class -> struct issue that becomes a compiler error in MSVC and because multiple other symbols are missing. The files defining these symbols must be manually built into the MSVC project, but many have minor incompatibilities that prevent them to be built. This patch makes a few minor modifications to these files, making it possible to link and run Tensorflow graphs generated with tfcompile in MSVC in Windows. The files that might need to be built into the MSVC project are as follows: 1. For symbols required by the generated headers. - tensorflow/compiler/aot/runtime.cc - tensorflow/compiler/xla/executable_run_options.cc 2. For symbols that provide custom XLA operations. - tensorflow/compiler/tf2xla/kernels/gather_op_kernel_float_int32.cc - tensorflow/compiler/tf2xla/kernels/gather_op_kernel_float_int64.cc - tensorflow/compiler/tf2xla/kernels/index_ops_kernel_argmax_float_1d.cc - tensorflow/compiler/tf2xla/kernels/index_ops_kernel_argmax_float_2d.cc 3. For symbols required by SimpleResolver in xla/service/cpu/simple_orc_jit.cc. - tensorflow/compiler/xla/service/cpu/runtime_matmul.cc - tensorflow/compiler/xla/service/cpu/runtime_single_threaded_matmul.cc - tensorflow/compiler/xla/service/cpu/runtime_conv2d.cc - tensorflow/compiler/xla/service/cpu/runtime_single_threaded_conv2d.cc - tensorflow/compiler/xla/service/cpu/cpu_runtime.cc Additionally, the following files might also required by SimpleResolver, but are not included in this patch because there is no simple alternative to __attribute__((vector_size(x))) and __attribute__((weak)) in MSVC. - tensorflow/compiler/xla/service/cpu/cpu_runtime_sse4_1.cc - tensorflow/compiler/xla/service/cpu/cpu_runtime_avx.cc See https://github.com/tensorflow/tensorflow/issues/8310 for more information.
Loading
Please sign in to comment