Skip to content

Use <cmath> instead of <math.h> in context attention FMHA headers#120

Open
whitesscott wants to merge 1 commit into
NVIDIA:mainfrom
whitesscott:fix-math-h-compile-error
Open

Use <cmath> instead of <math.h> in context attention FMHA headers#120
whitesscott wants to merge 1 commit into
NVIDIA:mainfrom
whitesscott:fix-math-h-compile-error

Conversation

@whitesscott

Copy link
Copy Markdown

Summary

  • Replace C-style <math.h> includes in the context attention FMHA code with the C++ <cmath> header (contextFMHARunner.cpp, fmhaParams_v2.h).
  • Motivated by a compile failure on Jetson/Thor where CUDA include paths cause <math.h> to resolve through CUDA wrapper headers when transitively included from fmhaParams_v2.h. <cmath> avoids that C-header leakage.
  • No runtime behavior change intended.

Test plan

  • Local build of cpp/ succeeds on Jetson/Thor (CUDA 13.2) without the prior <math.h> resolution error.
  • Existing FMHA / context attention unit tests still pass.
  • Spot-check that no other translation unit relied on macros only exposed by <math.h> (e.g. M_PI) — none observed in the two touched files.

🤖 Generated with Claude Code

This replaces C-style <math.h> includes in the context attention FMHA code
with the C++ <cmath> header.

Including <math.h> from a public header is fragile in CUDA/TensorRT builds,
especially on Jetson/Thor where CUDA include paths are active and the C math
header may resolve through CUDA wrapper headers. Using <cmath> keeps the code
consistent with C++ compilation and avoids leaking C math-header behavior into
translation units that include fmhaParams_v2.h.

No runtime behavior change intended.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant