flashinfer-ai / flashinfer

FlashInfer: Kernel Library for LLM Serving
https://flashinfer.ai
Apache License 2.0
822 stars 77 forks source link

Compilation fails due to "-Wno-switch-bool" nvcc flag #243

Closed mgerstgrasser closed 2 months ago

mgerstgrasser commented 2 months ago

When trying to install from source from the current main branch, I get failures due to "-Wno-switch-bool" not being recognised by nvcc - see error message snippet below.

It seems this is caused by this commit: https://github.com/flashinfer-ai/flashinfer/commit/84a433a6d5f6cebcd535276b76531fdd49781e64 which adds this flag to the nvcc extra compile arguments in setup.py. If I comment out the "-Wno-switch-bool" line in setup.py I can compile and install just fine.

Is it possible that the flag was supposed to be added to the cxx extra compile args, rather than the nvcc args? If I add it there (line 395, like this: "cxx": ["-O3", "-Wno-switch-bool"],), compilation also seems to work fine.

I've opened a PR that moves the flag to cxx: #244

Error message snippet:

...
    nvcc fatal   : Unknown option '-Wno-switch-bool'
    ninja: build stopped: subcommand failed.
    Traceback (most recent call last):
      File "...miniconda3/envs/sglang/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
        subprocess.run(
      File ".../miniconda3/envs/sglang/lib/python3.11/subprocess.py", line 571, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '127']' returned non-zero exit status 1.