Skip to content

Add an OpenACC variant of default_precondition_violation_handler() - #463

Merged
mhoemmen merged 2 commits into
kokkos:stablefrom
seyonglee:mdspan-violation-handler-openacc
Jul 24, 2026
Merged

Add an OpenACC variant of default_precondition_violation_handler()#463
mhoemmen merged 2 commits into
kokkos:stablefrom
seyonglee:mdspan-violation-handler-openacc

Conversation

@seyonglee

Copy link
Copy Markdown
Contributor

This PR adds an OpenACC variant of mdspan default_precondition_violation_handler() function, which fixes the unsupported fprintf error in Kokkos PR #9345 (kokkos/kokkos#9345 (comment)).
This PR contains the same changes as Kokkos PR #9369 (kokkos/kokkos#9369).

…ion_handler() function, which fixes the unsupported fprintf error in Kokkos PR #9345.

Signed-off-by: Seyong Lee <lees2@ornl.gov>

@mhoemmen mhoemmen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would you consider a small change, just to remove the possibility of unused parameter warnings completely? Thanks! : - )

Comment thread include/experimental/__p0009_bits/macros.hpp
MDSPAN_FUNCTION inline void default_precondition_violation_handler(const char* cond, const char* file, unsigned line)
{
std::fprintf(stderr, "%s:%u: precondition failure: `%s`\n", file, line, cond);
std::abort();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a separate issue, but should we consider putting assert(false); here instead of std::abort();? It doesn't seem right to make this back end abort unconditionally, but have all the other back-ends use the assert macro.

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.

Why would we want the default precondition handler to silently do nothing when NDEBUG is defined?

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.

Hmmm I see now that is what we do for CUDA/HIP/SYCL so we are inconsistent in the fallback implementation that you pointed out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dalg24 That's right! Whatever we do, we should be consistent about it.

applied the suggested change.

Co-authored-by: Mark Hoemmen <mhoemmen@users.noreply.github.com>
@seyonglee

Copy link
Copy Markdown
Contributor Author

Would you consider a small change, just to remove the possibility of unused parameter warnings completely? Thanks! : - )

Applied; thanks.

@mhoemmen mhoemmen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix!

@mhoemmen
mhoemmen merged commit aefd6ca into kokkos:stable Jul 24, 2026
15 checks passed
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.

4 participants