Skip to content

Add template-based operation dispatch - #998

Draft
davidbeckingsale wants to merge 35 commits into
developfrom
feature/operation-v2
Draft

Add template-based operation dispatch #998
davidbeckingsale wants to merge 35 commits into
developfrom
feature/operation-v2

Conversation

@davidbeckingsale

Copy link
Copy Markdown
Member

No description provided.

davidbeckingsale and others added 27 commits July 29, 2026 14:23
…r safety

- Update reallocate dispatch to avoid platform-specific std::realloc
- Fix memory safety issues in ResourceManager's reallocate implementations
- Clean up asynchronous operation handling
- Add safety checks to prevent reallocation of offset pointers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Rename generic_reallocate to reallocate and use this implementation for all platforms
- Fix missing return statements and pointer update issue in reallocate implementation
- Remove platform-specific reallocate implementations to prevent unsafe std::realloc usage
- Add safety mechanism to update pointers in the caller context
- Fix argument consistency in async and typed versions
- Improve documentation and error handling

This ensures that all memory pools and allocators can safely reallocate memory
using the allocate-copy-free pattern rather than platform-specific implementations
which could fail with pooled memory.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…MP Target

- Replace SYCL and OpenMP Target platform-specific reallocate implementations with comments
- Ensure consistent use of the generic allocate-copy-free pattern for all platforms
- Fix argument signature to match the updated reallocate implementation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
davidbeckingsale and others added 2 commits July 29, 2026 14:48
The UMPIRE_ENABLE_DEVELOPER_BENCHMARKS path builds benchmarks/ without
BLT's gbenchmark support enabled, so targets that include
benchmark/benchmark.h fail to compile (seen on mac and Windows CI).
Wrap those targets in an UMPIRE_ENABLE_BENCHMARKS block, matching
develop's structure; stress tests remain unconditional.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- cuda.hpp: the forward declaration of umpire_device_memset_kernel had
  its 'template <typename T>' outside the __CUDACC__ guard, so non-CUDA
  compilation of the header produced two consecutive template headers
  (shadowed parameter / too many template-parameter-lists) and left
  detail::device_memset undeclared.
- cuda.hpp/hip.hpp/sycl.hpp: wrap typed-pointer arguments to
  fmt::format in fmt::ptr(); fmt disallows formatting non-void
  pointers, which broke the HIP build (amdclang, fmt static_assert).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
davidbeckingsale and others added 6 commits July 29, 2026 16:37
fmt v12 refuses to format unscoped enums without a formatter
specialization; the raw get_dev_err argument in the prefetch error
messages broke the CUDA CI build when instantiated from
ResourceManager.cpp.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Declaring `using sycl = resource::sycl_platform` inside namespace umpire
made every unqualified `sycl::queue`/`sycl::event`/`sycl::usm` lookup in
umpire's SYCL code (op/sycl.hpp, ResourceManager.cpp, traits) resolve to
the platform tag struct instead of the global ::sycl namespace, breaking
the SYCL CI build. The alias was unused; the cuda/hip/omp_target aliases
have no such collision and are kept.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r shadow

- src/tpl/CMakeLists.txt: define CAMP_ENABLE_SYCL on the camp target when
  UMPIRE_ENABLE_SYCL is on (mirrors the existing CAMP_HAVE_CUDA/HIP wiring);
  without it camp::resources::Sycl does not exist and op/sycl.hpp's
  get_queue() cannot compile.
- sycl.hpp: camp's EventProxy has no (Resource, sycl::event) constructor --
  construct it from the resource alone like the CUDA/HIP async impls; the
  resource's in-order queue provides ordering.
- sycl.hpp: rename sycl_error_check's catch variable from `e` to `ex`;
  UMPIRE_ERROR declares a local `e`, so the message expression
  self-referenced the uninitialized local instead of the caught exception.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The SYCL and OpenMP-target backends specialize the primary op templates
(copy, memset, prefetch, device_memset) but never included the header
that declares them, so compiling with those backends enabled failed with
"explicit specialization of undeclared template struct". cuda.hpp,
hip.hpp, and host.hpp already include operations.hpp; the gap was only
masked because op.hpp happens to include host.hpp (which pulls in
operations.hpp) before the platform headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These tests call the public umpire::copy/memset/prefetch free functions
but only included op/operations.hpp (the op tag declarations), not the
umbrella umpire/op.hpp that brings in the dispatch layer defining those
functions. The other op tests already include op.hpp.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The SYCL sync device_memset and prefetch intentionally throw and direct
callers to resource-taking overloads, but no public async
umpire::device_memset(ptr, val, len, ctx) free function existed, so the
SYCL tests (the documented usage) could not compile. Add the async
overload to the dispatch layer plus the corresponding platform exec
overloads (CUDA/HIP: wrap the synchronizing kernel and return a
completed-event proxy; host: throw, mirroring the sync overload; SYCL
and OpenMP-target already had async exec).

Also fix the SYCL PrefetchSync test, which called prefetch with a
missing device argument; it now verifies the documented throw and uses
the async overload.

Co-Authored-By: Claude Fable 5 <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.

2 participants