Files
ViewDesignEngine/docs/feedback/VDE-054.md
T
茂之钳 2a5a84670c
Build & Test / build-and-test (push) Waiting to run
Build & Test / python-bindings (push) Blocked by required conditions
CI / Build & Test (push) Failing after 37s
CI / Release Build (push) Failing after 31s
fix(feedback): properly close **Status** bold markdown in VDE-021/023/024/053/054
Commit 92f13b6 added trailing ** but left the opening ** unclosed after the
Status label, producing **Status**: Fixed** instead of **Status**: Fixed.
2026-07-29 11:36:47 +08:00

1.3 KiB

VDE-054: GCC builtins 在 MSVC 不可用 (__builtin_prefetch / __builtin_ia32_pause)

  • ID: VDE-054
  • Date: 2026-07-29
  • Status: Fixed
  • Severity: Critical
  • Category: BUILD
  • Source: ViewDesign 架构纠正计划 (Task 11) — VDE=ON MSVC 构建

现象

MSVC 编译 VDE 核心库时出现以下错误:

error C3861: "__builtin_prefetch": 找不到标识符  (performance_tuning.h:310,319,581,587,601)
error C3861: "__builtin_ia32_pause": 找不到标识符 (concurrent_data.h:491,516)

根因

以下文件使用了 GCC/Clang 特有的 builtin 函数,缺少 MSVC 等价实现:

  1. include/vde/core/performance_tuning.h — 使用 __builtin_prefetch (6处)

    • MSVC 等价: _mm_prefetch(addr, hint) (需 #include <intrin.h>)
  2. include/vde/core/concurrent_data.h — 使用 __builtin_ia32_pause (2处)

    • MSVC 等价: _mm_pause() (需 #include <intrin.h>)

修复建议

添加跨平台宏,统一抽象为:

  • VDE_PREFETCH(addr)__builtin_prefetch / _mm_prefetch
  • VDE_PREFETCH_WRITE(addr) → 写入预取
  • VDE_PREFETCH_DIST(addr, dist) → 带距离参数的预取
  • VDE_CPU_PAUSE()__builtin_ia32_pause / _mm_pause / yield

相关

  • 文件: include/vde/core/performance_tuning.h, include/vde/core/concurrent_data.h
  • 编译器: MSVC 2022 (v143)