diff --git a/backend/cpp/ds4/CMakeLists.txt b/backend/cpp/ds4/CMakeLists.txt index 0535a8a44708..f8f9d0d3f5d3 100644 --- a/backend/cpp/ds4/CMakeLists.txt +++ b/backend/cpp/ds4/CMakeLists.txt @@ -85,8 +85,12 @@ elseif(DS4_GPU STREQUAL "cpu") endif() # Upstream splits distributed inference, tensor-parallel transport, the SSD -# expert cache, and layer placement into GPU-agnostic translation units. Link -# them regardless of DS4_GPU. +# expert cache, layer placement, and image preprocessing into GPU-agnostic +# translation units. Link them regardless of DS4_GPU. ds4_image.o holds the +# vision preprocessing and DeepSeek4/GLM5.3 image layout helpers that ds4.c +# calls unconditionally, so leaving it out breaks the link even for text-only +# use. Keep this list in sync with DS4_OBJ_TARGET in the Makefile. +list(APPEND DS4_OBJS "${DS4_DIR}/ds4_image.o") list(APPEND DS4_OBJS "${DS4_DIR}/ds4_distributed.o") list(APPEND DS4_OBJS "${DS4_DIR}/ds4_tp.o") list(APPEND DS4_OBJS "${DS4_DIR}/ds4_ssd.o") diff --git a/backend/cpp/ds4/Makefile b/backend/cpp/ds4/Makefile index 807a01a09ec0..232c9bfcac42 100644 --- a/backend/cpp/ds4/Makefile +++ b/backend/cpp/ds4/Makefile @@ -1,10 +1,10 @@ # ds4 backend Makefile. # -# Upstream pin lives below as DS4_VERSION?=8db89fe083ae4d17c9a2428ccd29803d3ae8f577 +# Upstream pin lives below as DS4_VERSION?=110afdd8886586f18fc9b28bc5533152dd10e728 # (.github/bump_deps.sh) can find and update it - matches the # llama-cpp / ik-llama-cpp / turboquant convention. -DS4_VERSION?=8db89fe083ae4d17c9a2428ccd29803d3ae8f577 +DS4_VERSION?=110afdd8886586f18fc9b28bc5533152dd10e728 DS4_REPO?=https://github.com/antirez/ds4 CURRENT_MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) @@ -80,20 +80,23 @@ endif endif # Upstream splits distributed inference, tensor-parallel transport, the SSD -# expert cache, and layer placement into GPU-agnostic translation units. They -# are shared by every GPU mode, so append them unconditionally below. +# expert cache, layer placement, and image preprocessing into GPU-agnostic +# translation units. They are shared by every GPU mode, so append them +# unconditionally below. ds4_image.o carries the vision preprocessing and the +# DeepSeek4/GLM5.3 image layout helpers that ds4.c calls, so it must be linked +# even when no image is ever passed to the engine. ifeq ($(BUILD_TYPE),cublas) CMAKE_ARGS += -DDS4_GPU=cuda - DS4_OBJ_TARGET := ds4.o ds4_cuda.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o \ + DS4_OBJ_TARGET := ds4.o ds4_image.o ds4_cuda.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o \ cuda/mmq/ds4_ggml_stubs.o cuda/mmq/ds4_mmq.o cuda/mmq/ds4_mmq_d2r.o \ cuda/mmq/quantize.o cuda/mmq/mmid.o cuda/mmq/mmvq.o cuda/mmq/ds4_repack.o else ifeq ($(UNAME_S),Darwin) CMAKE_ARGS += -DDS4_GPU=metal - DS4_OBJ_TARGET := ds4.o ds4_metal.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o + DS4_OBJ_TARGET := ds4.o ds4_image.o ds4_metal.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o else # CPU reference path (Linux only - macOS CPU path is broken by VM bug per ds4 README). CMAKE_ARGS += -DDS4_GPU=cpu - DS4_OBJ_TARGET := ds4_cpu.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o + DS4_OBJ_TARGET := ds4_cpu.o ds4_image.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o endif ifneq ($(NATIVE),true) @@ -116,14 +119,12 @@ ds4: # Build ds4's engine object files via its own Makefile, which already encodes # the right per-platform compile flags (Objective-C/Metal on Darwin, nvcc on Linux+CUDA). +# DS4_OBJ_TARGET is the single source of truth for the per-variant object list; +# a second hand-kept copy here is what silently went stale on an upstream bump. +# DS4_ARCH_MAKEVARS is only ever assigned inside the cublas branch above, so it +# expands empty on the Darwin and CPU paths and needs no branch of its own here. ds4/ds4.o: ds4 -ifeq ($(BUILD_TYPE),cublas) +$(MAKE) -C ds4 $(DS4_ARCH_MAKEVARS) $(DS4_OBJ_TARGET) -else ifeq ($(UNAME_S),Darwin) - +$(MAKE) -C ds4 ds4.o ds4_metal.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o -else - +$(MAKE) -C ds4 ds4_cpu.o ds4_distributed.o ds4_tp.o ds4_ssd.o ds4_layer_pack.o -endif grpc-server: ds4/ds4.o mkdir -p $(BUILD_DIR)