Skip to content

CUDA: Silence unused-variable warnings in the CUDA backend#23975

Merged
am17an merged 1 commit into
ggml-org:masterfrom
anavp-nvidia:clean_warnings
Jun 2, 2026
Merged

CUDA: Silence unused-variable warnings in the CUDA backend#23975
am17an merged 1 commit into
ggml-org:masterfrom
anavp-nvidia:clean_warnings

Conversation

@anavp-nvidia

Copy link
Copy Markdown
Contributor

Overview

Building the CUDA backend currently produces an enormous build log that is largely repeated "unused variable" warnings (nvcc #177-D (declared but never referenced) and nvcc #550-D (set but never used)). This PR silences the warnings by either:

  • Narrowing the declarations' scope by moving them inside the if constexpr block (or similar) if the variable is only used there.
  • Using [[maybe_unused]] attribute if the variable is used in more than one conditionally-compiled block.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, AI tools were only used for code review.

@anavp-nvidia anavp-nvidia requested a review from a team as a code owner June 1, 2026 14:04
@github-actions github-actions Bot added Nvidia GPU Issues specific to Nvidia GPUs ggml changes relating to the ggml tensor library for machine learning labels Jun 1, 2026

@ggerganov ggerganov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anavp-nvidia

@am17an am17an merged commit 1fd5f48 into ggml-org:master Jun 2, 2026
21 of 22 checks passed
@ggerganov

Copy link
Copy Markdown
Member

It seems the warnings disappeared in the CUDA 13.3 builds, but they remained in the CUDA 12.4 builds. Any idea why that would be?

@JohannesGaessler

JohannesGaessler commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Inconsistent handling of INFINITY, for practical purposes we can just replace it with the negative max. values representable with FP32/FP16 for a block-wide maximum reduction.

zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Jul 3, 2026
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning Nvidia GPU Issues specific to Nvidia GPUs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants