Windows Compilation Fails: CMake errors in setup_env and missing `const` in ggml-bitnet-mad

オープン 初心者向け
#513 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
cmake, cpp

調査の方向性

setup_env.py と src/ggml-bitnet-mad.cpp から始め、Issue に記載されている Windows ClangCL 構成と AVX2 コンパイルを再現します。Windows ビルドを実行し、正常に完了することを確認して、報告された両方のコンパイラーエラーが解決されていることを検証します。

索引モデルが issue の本文から書いたものです。

説明

Bug Description:
When attempting to compile BitNet from source on a standard Windows environment, the build fails in two separate places:

###Bug 1: CMake Generator Failure in setup_env .py
The compiler script passes the -T ClangCL argument to CMake on Windows. However, it does not explicitly specify a Generator (like -G "Visual Studio 17 2022"). On many Windows systems, CMake will default to the NMake Makefiles generator, which immediately crashes because NMake does not support the -T toolset flag.

Error log:
Generator NMake Makefiles does not support toolset specification, but toolset ClangCL was specified.

The Fix for Bug 1:
In setup_env .py (Line 72), explicitly define the Visual Studio Generator so CMake can actually use the ClangCL toolset.
Change from:
OS_EXTRA_ARGS = {
"Windows":["-T", "ClangCL"],
}

Change to:
OS_EXTRA_ARGS = {
"Windows":["-G", "Visual Studio 17 2022", "-T", "ClangCL"],
}


Bug 2: Missing const type-cast in ggml-bitnet-mad .cpp

Once CMake successfully generates the build files using ClangCL, the actual C++ compilation crashes. The strict Windows Clang compiler rejects an assignment on line 811 inside the AVX2 block of src/ggml-bitnet-mad .cpp because a const modifier was forgotten.

Error log:
error : cannot initialize a variable of type 'int8_t *' with an rvalue of type 'const int8_t *'

The Fix for Bug 2:
In src/ggml-bitnet-mad .cpp (Line 811), the pointer y is explicitly declared as a constant on line 794, so y_col must also be a constant.

Change from:
int8_t * y_col = y + col * by;

Change to:
const int8_t * y_col = y + col * by;

With these two tiny fixes applied, the system compiles flawlessly out-of-the-box on Windows using AVX2 and Clang!

主要言語
C++
スター
40.3k
フォーク
3.7k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/BitNet のほかの issue

microsoft/BitNet の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。