microsoft / microsoft/BitNet

Request: Add Debug build mode

Open
#162 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
40.3k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

Thre are some declarations of build mode in the setup_env.py scritpt.
Hence, I suggest adding the following code in it.

Additional argument

Target: https://github.com/microsoft/BitNet/blob/caf17ec438808bcf9b3da012216c8624a29b8cdc/setup_env.py#L205

parser.add_argument("--build-mode", type=str, choices=["Release", "Debug"], default="Debug", help="Build mode of source")

Compiler extra debug args

COMPILER_EXTRA_DEBUG_ARGS = {
    "arm64": ["-DBITNET_ARM_TL1=ON", "-DCMAKE_BUILD_TYPE=Debug"],
    "x86_64": ["-DBITNET_X86_TL2=ON", "-DCMAKE_BUILD_TYPE=Debug"]
}

Additional build process

Target

https://github.com/microsoft/BitNet/blob/caf17ec438808bcf9b3da012216c8624a29b8cdc/setup_env.py#L184

if args.build-mode == "Release":
    run_command(["cmake", "-B", "build", *COMPILER_EXTRA_ARGS[arch], *OS_EXTRA_ARGS.get(platform.system(), [])], log_step="generate_build_files")
    run_command(["cmake", "--build", "build", "--config", "Release"], log_step="compile")
else:
    run_command(["cmake", "-B", "build", *COMPILER_EXTRA_DEBUG_ARGS[arch], *OS_EXTRA_ARGS.get(platform.system(), [])], log_step="generate_build_files")
    run_command(["cmake", "--build", "build", "--config", "Debug"], log_step="compile")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect setup_env.py around the build process near line 184 and argument parsing near line 205. Review the existing compiler arguments and CMake invocations, then verify that selecting Release or Debug generates and builds the corresponding configuration for the supported architectures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.