Skip to content

fix(windows): use platform env helper in DeepSeek4 HIP path - #710

Merged
davide221 merged 1 commit into
Luce-Org:mainfrom
poruru-code:fix/windows-hip-platform-env
Sep 6, 2026
Merged

davide221 merged 1 commit into
Luce-Org:mainfrom
poruru-code:fix/windows-hip-platform-env

Conversation

@poruru-code

@poruru-code poruru-code commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes native Windows/MSVC HIP build failure caused by direct POSIX ::setenv() calls in the DeepSeek4 backend.

Root Cause

server/src/deepseek4/deepseek4_backend.cpp contained 6 direct ::setenv() calls under #if defined(DFLASH27B_BACKEND_HIP) || defined(GGML_USE_HIP) with no Windows exclusion. On Windows/MSVC, ::setenv does not exist in the global namespace, causing compile failure.

Pre-fix Error

deepseek4_backend.cpp:169:15: error: no member named 'setenv' in the global namespace; did you mean 'getenv'? deepseek4_backend.cpp:169:45: error: too many arguments to function call, expected single argument '_VarName', have 3 arguments

(6 identical errors at lines 169, 181, 201, 219, 246, 1494)

Fix

Replaced all 6 ::setenv(name, value, overwrite) calls with the existing set_environment_variable(name, value, overwrite) helper from common/platform_env.h, which delegates to _putenv_s() on Windows and ::setenv() on POSIX.

No new wrappers, no new includes, no changes to platform_env.h.

Changed Calls

Line Variable Overwrite
169 LUCE_MMVQ_MAX_NCOLS=5 false
181 DFLASH_CUDA_MMVQ_FP4_X4=1 false
201 DFLASH_CUDA_MMVQ_FP4_Q5_X4_PLUS1=1 false
219 LUCE_MMVQ_MAX_NCOLS=4 false
246 DFLASH_MMQ_SUB_BATCH=4 false
1494 DFLASH_DS4_MIX_MMQ_PREFILL=1 true

All getenv guards, overwrite semantics, return-value checks, logging, HIP guards, and control flow are preserved unchanged.

Post-fix Build

Same native Windows environment:

  • Windows 11 / MSVC 19.44.35228.0 / HIP 7.14.60850 / ROCm 7.14.1
  • R9700 gfx1201
  • Generator: Ninja
  • dflash_server.exe build: PASS
  • SHA256: 29C0C160099A8235006F87BF194A27CD4CE339E35122F859F5356ABD87E8E317
  • Smoke test dflash_server.exe --help: PASS

POSIX Behavior

Unchanged. platform_env.h POSIX path still delegates to ::setenv(name, value, overwrite ? 1 : 0).

No Changes To

  • Parser / toolchain / runtime config
  • platform_env.h
  • qwen35_backend.cpp
  • DFlash2
  • Any unrelated files

Related

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@davide221
davide221 merged commit 53f0721 into Luce-Org:main Sep 6, 2026
8 of 9 checks passed
@poruru-code
poruru-code deleted the fix/windows-hip-platform-env branch September 7, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants