@@ -41,6 +41,12 @@ option(TRITON_ENABLE_GPU "Enable GPU support in backend" ON)
4141option (TRITON_ENABLE_STATS "Include statistics collections in backend" ON )
4242option (TRITON_ENABLE_NVTX "Include nvtx markers collection in backend." OFF )
4343
44+ # FIXME: CI needs to enable the GPU flag. Python for window currently does not
45+ # support GPU tensors. For simplicity, we will override this option here.
46+ if (WIN32 )
47+ set (TRITON_ENABLE_GPU OFF CACHE BOOL "GPU disabled" FORCE)
48+ endif ()
49+
4450set (TRITON_BACKEND_REPO_TAG "main" CACHE STRING "Tag for triton-inference-server/backend repo" )
4551set (TRITON_COMMON_REPO_TAG "main" CACHE STRING "Tag for triton-inference-server/common repo" )
4652set (TRITON_CORE_REPO_TAG "main" CACHE STRING "Tag for triton-inference-server/core repo" )
@@ -96,6 +102,9 @@ FetchContent_Declare(
96102 GIT_TAG "v0.8"
97103 GIT_SHALLOW ON
98104)
105+ # Option must be set off so WIN32 build does not break
106+ set (CMAKE_POLICY_DEFAULT_CMP0077 NEW)
107+ set (BUILD_MOCK OFF )
99108FetchContent_MakeAvailable(dlpack)
100109
101110#
@@ -129,7 +138,10 @@ if(${TRITON_ENABLE_NVTX})
129138endif () # TRITON_ENABLE_NVTX
130139
131140find_package (ZLIB REQUIRED)
132- find_package (Threads REQUIRED)
141+
142+ if (NOT WIN32 )
143+ find_package (Threads REQUIRED)
144+ endif ()
133145
134146include_directories (${CMAKE_BINARY_DIR} )
135147configure_file (src/libtriton_python.ldscript libtriton_python.ldscript COPYONLY )
@@ -174,21 +186,21 @@ set(
174186)
175187
176188set (
177- PYTHON_BACKEND_SRCS
178- src/python_be.cc
179- src/python_be.h
180- src/pb_env.cc
181- src/pb_env.h
182- src/pb_metric_reporter.cc
183- src/pb_metric_reporter.h
184- src/memory_manager.cc
185- src/memory_manager.h
186- src/request_executor.cc
187- src/request_executor.h
188- src/stub_launcher.h
189- src/stub_launcher.cc
190- src/infer_payload.h
191- src/infer_payload.cc
189+ PYTHON_BACKEND_SRCS
190+ src/python_be.cc
191+ src/python_be.h
192+ src/pb_env.cc
193+ src/pb_env.h
194+ src/pb_metric_reporter.cc
195+ src/pb_metric_reporter.h
196+ src/memory_manager.cc
197+ src/memory_manager.h
198+ src/request_executor.cc
199+ src/request_executor.h
200+ src/stub_launcher.h
201+ src/stub_launcher.cc
202+ src/infer_payload.h
203+ src/infer_payload.cc
192204)
193205
194206list (APPEND
@@ -239,48 +251,82 @@ target_compile_options(
239251 triton-python-backend PRIVATE
240252 $<$<OR :$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
241253 -Wall -Wextra -Wno-unused-parameter -Wno-type -limits -Werror>
254+ $<$<CXX_COMPILER_ID:MSVC >:/Wall /D_WIN32_WINNT=0x0A00 /EHsc /Zc:preprocessor>
242255)
243256
244257target_compile_features (triton-python-backend-stub PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD} )
245258target_compile_options (
246259 triton-python-backend-stub PRIVATE
247260 $<$<OR :$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
248- -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-type -limits -Werror>
261+ -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-type -limits -Werror>
262+ $<$<CXX_COMPILER_ID:MSVC >:/Wall /D_WIN32_WINNT=0x0A00 /EHsc /Zc:preprocessor>
249263)
250264target_compile_definitions (triton-python-backend-stub PRIVATE TRITON_PB_STUB)
251265
252- target_link_libraries (
253- triton-python-backend
254- PRIVATE
266+ # For WIN32 do not link Threads and DL_LIBS
267+ if (WIN32 )
268+ target_link_libraries (
269+ triton-python-backend
270+ PRIVATE
271+ dlpack
272+ triton-backend-utils # from repo-backend
273+ -lrt # shared memory
274+ triton-core-serverstub # from repo-core
275+ ZLIB::ZLIB
276+ -larchive
277+ )
278+
279+ target_link_libraries (
280+ triton-python-backend-stub
281+ PRIVATE
282+ dlpack
283+ triton-backend-utils # from repo-backend
284+ pybind11::embed
285+ -lrt # shared memory
286+ -larchive # libarchive
287+ )
288+ else ()
289+ target_link_libraries (
290+ triton-python-backend
291+ PRIVATE
292+ dlpack
293+ Threads::Threads
294+ triton-backend-utils # from repo-backend
295+ ${CMAKE_DL_LIBS} # dlopen and dlclose
296+ -lrt # shared memory
297+ triton-core-serverstub # from repo-core
298+ ZLIB::ZLIB
299+ -larchive
300+ )
301+
302+ target_link_libraries (
303+ triton-python-backend-stub
304+ PRIVATE
255305 dlpack
256306 Threads::Threads
257- triton-backend-utils # from repo-backend
258- ${CMAKE_DL_LIBS} # dlopen and dlclose
259- -lrt # shared memory
260- triton-core-serverstub # from repo-core
261- ZLIB::ZLIB
262- -larchive
263- )
264-
265- target_link_libraries (
266- triton-python-backend-stub
267- PRIVATE
268- dlpack
269- Threads::Threads
270- triton-backend-utils # from repo-backend
271- ${CMAKE_DL_LIBS} # dlopen and dlclose
272- pybind11::embed
273- -lrt # shared memory
274- -larchive # libarchive
275- )
307+ triton-backend-utils # from repo-backend
308+ ${CMAKE_DL_LIBS} # dlopen and dlclose
309+ pybind11::embed
310+ -lrt # shared memory
311+ -larchive # libarchive
312+ )
313+ endif ()
276314
277- set_target_properties (
278- triton-python-backend PROPERTIES
279- POSITION_INDEPENDENT_CODE ON
280- OUTPUT_NAME triton_python
281- LINK_DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /libtriton_python.ldscript
282- LINK_FLAGS "-Wl,--version-script libtriton_python.ldscript"
283- )
315+ if (WIN32 )
316+ set_target_properties (
317+ triton-python-backend PROPERTIES
318+ POSITION_INDEPENDENT_CODE ON
319+ OUTPUT_NAME triton_python
320+ )
321+ else ()
322+ set_target_properties (
323+ triton-python-backend PROPERTIES
324+ POSITION_INDEPENDENT_CODE ON
325+ OUTPUT_NAME triton_python
326+ LINK_DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /libtriton_python.ldscript
327+ LINK_FLAGS "-Wl,--version-script libtriton_python.ldscript"
328+ )
329+ endif ()
284330
285331add_subdirectory (./src/shm_monitor)
286332
0 commit comments