Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: microsoft/BitNet
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: Iron-Ham/BitNet
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 1,511 files changed
  • 1 contributor

Commits on Apr 23, 2025

  1. Add CMake rules to build and install BitNet as a static library

    This commit updates the CMake configuration to support building BitNet as a static library (`libbitnet.a`) and installs the library and its public headers. These changes are foundational for enabling language bindings, such as Swift, by providing a clear and reusable C API and library artifact.
    
    Key changes:
    - Added a `bitnet` static library target in `src/CMakeLists.txt` using BitNet source files.
    - Configured public header installation for BitNet, ensuring consumers can access the API.
    - Added install rules for both the static library and the public headers.
    - Ensured the top-level `CMakeLists.txt` includes the `src` directory so the static library is built as part of the project.
    
    These changes are the first step toward enabling Swift (and other language) bindings for BitNet, making it possible to link BitNet into iOS/macOS projects and call its C API from Swift.
    Iron-Ham committed Apr 23, 2025
    Configuration menu
    Copy the full SHA
    5139d1b View commit details
    Browse the repository at this point in the history
  2. Add static library build, install rules, and Swift interop module map

    This commit prepares BitNet for use as a static library and for integration with Swift projects. The following changes were made:
    
    - Added and installed `include/bitnet-lut-kernels.h` to provide the correct kernel header for the chosen model and platform.
    - Updated `src/CMakeLists.txt` to ensure all necessary include directories are present, and to install the static library (`libbitnet.a`) and public headers.
    - Added `swift-interop/module.modulemap` to define a C module for BitNet, enabling Swift to import and use the C API directly.
    
    These changes are foundational for building Swift bindings for BitNet, allowing the library to be linked and called from iOS/macOS projects using Swift.
    Iron-Ham committed Apr 23, 2025
    Configuration menu
    Copy the full SHA
    898780a View commit details
    Browse the repository at this point in the history
  3. Refactor BitNet for Swift Package Manager & idiomatic Swift API

    - Move C sources and headers into Sources/BitNet for SPM compatibility.
    - Expose C headers via publicHeadersPath for module import in Swift.
    - Add Swift wrapper module (Sources/BitNetSwift) with:
        - GGMLContext: Swift class to manage ggml_context lifecycle, with a safe default memory size and deinit cleanup.
        - GGMLTensor: Swift struct for ggml_tensor, with initializers from [Float] and [UInt8] arrays, using GGMLContext.
        - BitNet: Swift class wrapping all BitNet C functions, using Swift types ([Float], [UInt8], GGMLTensor) for a safe, idiomatic API.
    - Refactor all Swift-facing APIs to use Swift arrays instead of Unsafe* pointers or Data, making the library approachable for iOS/macOS developers.
    - Use Swift conditional compilation (`arch(arm64)`, `arch(x86_64)`, etc.) for platform-specific functions.
    - Set a reasonable default context memory size (64MB), but allow customization.
    - Ensure all C code is portable and headers are properly exposed for SPM.
    - Remove any reliance on custom macros or unsafe pointers in public APIs.
    - Add test target for BitNetSwift.
    
    **Why:**
    This refactor makes BitNet portable, safe, and idiomatic for Swift developers, enabling easy integration into iOS/macOS projects via Swift Package Manager. The new API design hides C interop details, encourages safe usage, and improves developer experience.
    Iron-Ham committed Apr 23, 2025
    Configuration menu
    Copy the full SHA
    c173b96 View commit details
    Browse the repository at this point in the history
Loading