Skip to content

Conversation

@saifxyzyz
Copy link

Summary

This PR introduces necessary changes to the build system, CMake files, and source code to enable successful compilation and running of BitNet using MinGW (Minimalist GNU for Windows) and GCC compiler.
This change significantly improves cross-platform compatibility and allows developers who prefer or require open-source toolchains (like those on Linux or using MinGW on Windows) to contribute and utilize the project without relying on Microsoft Visual C++ (MSVC).

Key Changes

The modifications span build logic and low-level kernel definitions to ensure seamless compatibility with the GNU toolchain:

  • Build System Adaptation: Modified setup_env.py to correctly detect and select the MinGW/GCC toolchain and invoke CMake with the appropriate compiler flags.
  • Source Code Refactoring: Applied necessary changes to critical header files (including bitnet-lut-kernels.h, ggml-bitnet.h, and kernel_config.h) to:
    - Resolve MSVC-specific syntax or intrinsic function calls.
    - Implement conditional compilation logic (via preprocessor checks) to ensure the core kernel behavior is correct when compiled under GCC.
  • Compiler Configuration: Added/updated configuration files to manage toolchain-specific dependencies.

Testing

successfully compiled and run essential tests/examples using MinGW toolchain to verify functionality.

Testing Environment:

Operating System: Windows 11
Compiler: MinGW (GCC 15.1.0, built by MSYS2)
Build System: CMake 4.1.1

@ArrivedAditya
Copy link

Hey I want instead adding a compiler to it. Can we write a flake.nix that has all dependency listed in it. So, by run this flake on nix wouldn't it install dependency of it.

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