mudler / mudler/vllm.cpp

[32-bit] nvfp4_plan_cache.h fails with size_t narrowing on i586

Open Beginner friendly
#3,181 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
423
Forks
53
Avg merge
20h 26m
Merged PRs (30d)
310

Description

Problem

The v0.0.2 source does not compile for i586/32-bit x86 with GCC and -Werror=narrowing. The failure is in src/vt/cuda/nvfp4_plan_cache.h:

constexpr size_t kGolden = sizeof(size_t) == 8 ? size_t{0x9e3779b97f4a7c15ULL}
                                              : size_t{0x9e3779b9UL};

GCC reports:

error: narrowing conversion of ‘11400714819323198485’ from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} [-Wnarrowing]

The conditional expression is valid conceptually, but the 64-bit braced initializer is still diagnosed as narrowing when size_t is 32-bit.

Reproducer

Build v0.0.2 on i586 with the normal openSUSE optimization flags and C++20 enabled.

Proposed direction

Use explicit casts or architecture-conditional definitions so both constants are well-formed for 32-bit and 64-bit size_t, for example:

constexpr size_t kGolden = sizeof(size_t) == 8
    ? static_cast<size_t>(0x9e3779b97f4a7c15ULL)
    : static_cast<size_t>(0x9e3779b9UL);

The openSUSE package currently carries this as a downstream patch.

Contributor guide

Open the contributing guide

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

Start with src/vt/cuda/nvfp4_plan_cache.h and inspect the kGolden definition. Build v0.0.2 for i586 with the normal openSUSE optimization flags, C++20, and -Werror=narrowing to reproduce the failure. Done means the header compiles on both 32-bit and 64-bit size_t targets without narrowing diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.