Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

fix(bounds): mark index_stays_inbounds CUHOSTDEV - #72

Merged
balbasty merged 1 commit into
teenyfrom
claude/71-index-stays-inbounds-cuhostdev
Aug 2, 2026
Merged

fix(bounds): mark index_stays_inbounds CUHOSTDEV#72
balbasty merged 1 commit into
teenyfrom
claude/71-index-stays-inbounds-cuhostdev

Conversation

@balbasty

Copy link
Copy Markdown
Collaborator

Agent:claude-fastfields-to-teeny

Closesfastfields/fastfields-lib#101.

Why

bound::index_stays_inbounds was a plain constexpr function — implicitly __host__ under nvcc — called from stap.h's make_stap, a CUDEV (__device__-only) function. nvcc hard-errors on this ("calling a constexpr host function from a device function is not allowed"); the CPU-only build never sees it, since CUDEV expands to nothing there. Every stencil path (stencil::fill_tapsmake_stap) reaches this, so it took out the entire CUDA regulariser build — found while doing fastfields-cuda-impl#29 (phase 5 of kernels#50), and confirmed pre-existing on teeny at HEAD, unrelated to that work.

Fix

One line: CUHOSTDEV constexpr inline bool index_stays_inbounds(type b). transpose (the other predicate reached near this code, via stencil.h's axis_bound_adjoint static member) does not need the same treatment — it's evaluated as a class-template static-member initializer at instantiation time, not called from within a device function body, so nvcc's execution-space check doesn't apply to it; confirmed by this fix alone (no other change) being sufficient.

Verification


Generated by Claude Code

It was a plain host constexpr function called from make_stap (stap.h),
a CUDEV (__device__-only) function -- a hard nvcc error ("calling a
constexpr __host__ function from a __device__ function"), invisible to
the CPU-only build where CUDEV expands to nothing. This took out the
entire CUDA regulariser build (every stencil path reaches make_stap via
stencil::fill_taps).
Closes #71.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@balbasty@claude