Skip to content

Eval bug: Metal BF16 shader fails to compile on macOS 15.5: invalid constexpr #31337

Closed as duplicate

Description

@DARK-art108

Name and Version

macOS 15.5 (24F74) and your Mac’s chip.
llama.cpp commit 5220213.
Model: LiquidAI LFM3-1.7B-BF16.gguf.
error: constexpr function never produces a constant expression
[-Winvalid-constexpr]

inline constexpr bfloat4
ggml_metal_unary_cast<bfloat4, float4>(float4 x)

ggml_metal_init: error: failed to initialize the Metal library

Workaround tested: Removed constexpr from the two bfloat4 conversion specializations, keeping inline and both function bodies unchanged. Rebuilt llama-server.
Result: The model loaded with Metal and successfully generated READY in a short inference test.

Operating systems

Mac

GGML backends

Metal

Hardware

Model | MacBook Pro (Mac14,9)
Chip | Apple M2 Pro
CPU | 10 cores: 6 performance + 4 efficiency
GPU | 16 cores, Metal supported
Memory | 16 GB unified memory
Architecture | ARM64 / Apple Silicon
macOS | 15.5 (24F74)

Models

LiquidAI/LFM3-1.7B-GGUF

Problem description & steps to reproduce

Failure: Loading the model failed while compiling the Metal shader:
error: constexpr function never produces a constant expression
[-Winvalid-constexpr]

inline constexpr bfloat4
ggml_metal_unary_cast<bfloat4, float4>(float4 x)

ggml_metal_init: error: failed to initialize the Metal library

First Bad Commit

No response

Relevant log output

Logs
constexpr function never produces a constant expression
[-Winvalid-constexpr]

inline constexpr bfloat4
ggml_metal_unary_cast<bfloat4, float4>(float4 x)

ggml_metal_init: error: failed to initialize the Metal library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions