[Portability][MSVC] Replace compound-literal-style dependent-type initialization in dense MLA decode
Background
I encountered this issue while building the vllm-project/FlashMLA fork through SystemPanic/vllm-windows for a deployment serving DeepSeek-V4-Flash-0731 on 4 x H200 NVL GPUs.
Problem
csrc/sm90/decode/dense/splitkv_mla.cuh contains 16 dependent-type initializations using the following form:
(typename T::X){}Examples include:
TiledMMA tiled_mma_sQ =
(typename T::TiledMMA_QK_sQ){};
Tensor sV = make_tensor(
sK.data(),
(typename T::SmemLayoutV){}
);
Tensor sQ = make_tensor(
make_smem_ptr(plan.smem_sQ.data()),
(typename T::SmemLayoutQ){}
);This parenthesized type followed by a braced initializer is compound-literal-style syntax accepted as an extension by GNU-compatible toolchains. It is not portable to the NVCC and MSVC build used for my Windows deployment.
I understand that native Windows may not be part of the supported FlashMLA build matrix. However, the equivalent standard C++ form works across toolchains and does not change the existing Linux behavior.
Tested fix
The working downstream build removes the parentheses around the dependent type:
- TiledMMA tiled_mma_sQ =
- (typename T::TiledMMA_QK_sQ){};
+ TiledMMA tiled_mma_sQ =
+ typename T::TiledMMA_QK_sQ{};
- Tensor sV = make_tensor(
- sK.data(),
- (typename T::SmemLayoutV){}
- );
+ Tensor sV = make_tensor(
+ sK.data(),
+ typename T::SmemLayoutV{}
+ );
- Tensor sQ = make_tensor(
- make_smem_ptr(plan.smem_sQ.data()),
- (typename T::SmemLayoutQ){}
- );
+ Tensor sQ = make_tensor(
+ make_smem_ptr(plan.smem_sQ.data()),
+ typename T::SmemLayoutQ{}
+ );The same mechanical conversion was applied to all 16 affected brace-initialization sites.
This allowed the dense MLA source to build successfully with NVCC and MSVC.
Semantics
Both forms value-initialize a temporary of the same dependent member type.
The affected expressions use empty initializers, and the tested change does not alter:
- initializer arguments;
- narrowing behavior;
- object lifetime;
- overload resolution;
- the resulting type;
- expected Linux code generation.
The replacement form:
typename T::X{}is standard C++ and does not require an MSVC-specific conditional.
Environment
- Windows Server 2022
- Visual Studio Build Tools with MSVC
- CUDA/NVCC 13.2
- Python 3.12
- PyTorch 2.11.0+cu130
- SystemPanic/vllm-windows 0.25-based deployment
- DeepSeek-V4-Flash-0731
- 4 x H200 NVL GPUs, SM90a
Suggested resolution
Convert the 16 compound-literal-style brace-initialization expressions:
(typename T::X){}to the standard C++ form:
typename T::X{}Other occurrences such as C-style casts and sizeof(typename T::...) are separate, valid constructs and should remain unchanged.
Source: deepseek-ai/FlashMLA