deepseek-ai / deepseek-ai/FlashMLA

Char datatype assumption

Open
#93 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
12.9k
Forks
1.2k
Avg merge
4h 20m
Merged PRs (30d)
2

Description

Just building vllm on aarch64 and see the following warning during the build process:

```
/vllm/.deps/flashmla-src/csrc/flash_api.cpp: In function ‘std::vector get_mla_metadata(at::Tensor&, int, int)’:
/vllm/.deps/flashmla-src/csrc/flash_api.cpp:46:38: warning: narrowing conversion of ‘(char)(& seqlens_k)->at::Tensor::.at::TensorBase::get_device()’ from ‘char’ to ‘c10::DeviceIndex’ {aka ‘signed char’} [-Wnarrowing] 46 | at::cuda::CUDAGuard device_guard{(char)seqlens_k.get_device()}; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/vllm/.deps/flashmla-src/csrc/flash_api.cpp: In function ‘std::vector mha_fwd_kvcache_mla(at::Tensor&, const at::Tensor&, int, const at::Tensor&, const at::Tensor&, float, bool, const at::Tensor&, const at::Tensor&)’:
/vllm/.deps/flashmla-src/csrc/flash_api.cpp:133:38: warning: narrowing conversion of ‘(char)(& q)->at::Tensor::.at::TensorBase::get_device()’ from ‘char’ to ‘c10::DeviceIndex’ {aka ‘signed char’} [-Wnarrowing]
133 | at::cuda::CUDAGuard device_guard{(char)q.get_device()};
| ^~~~~~~~~~~~~~~~~~~~
```

Since on aarch64 `char` is by default `unsigned` compared to x86 where it is `signed` I think we need to be a bit more precise in which char is being used to remove the warning. Would using `(signed char)` be enough?

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect .deps/flashmla-src/csrc/flash_api.cpp, especially get_mla_metadata and mha_fwd_kvcache_mla, where the build warnings point to CUDAGuard construction. Reproduce the warning on aarch64, verify the device-index type expected by the surrounding API, and confirm the build completes without narrowing warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.