PXL
pxl::StageGroupBuilder Class Reference

Collects parallel kernels within a single stage group. More...

#include <stage_builder.hpp>

Public Member Functions

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
StageGroupBuilder & add (uint32_t taskCount, Args &&... args)
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired< StageGroupBuilder > add (Args &&... args) &&
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired< StageGroupBuilder > add (Args &&... args) &=delete
 
StageGroupBuilder & tasks (uint32_t taskCount)
 Sets the task count of the most recently added kernel in this group. More...
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
StageBuilder & stage (uint32_t taskCount, Args &&... args)
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired< StageBuilder > stage (Args &&... args) &&
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired< StageBuilder > stage (Args &&... args) &=delete
 
StageGroupBuilder stage ()
 
LaunchResult run ()
 
std::future< LaunchResult > runAsync ()
 
StageGroupBuilder & reserve (uint32_t n)
 
StageGroupBuilder & batchSize (uint32_t n)
 Sets per-task batch size for the most-recently-added kernel within the active parallel group. No-op when the group is empty. More...
 
StageGroupBuilder & clusterBitmap (uint32_t bitmap)
 Sets cluster bitmap for the most-recently-added kernel in the active group. More...
 
StageGroupBuilder & locality (LocalityMode mode)
 Sets locality mode for the most-recently-added kernel in the active group. More...
 
StageGroupBuilder & onComplete (Map::CompletionCallback cb, void *arg=nullptr)
 Registers a completion callback on the most-recently-added kernel. More...
 
StageGroupBuilder & onMessage (Map::MessageCallback cb, void *arg=nullptr)
 Registers a message callback on the most-recently-added kernel. More...
 
StageGroupBuilder & onError (Map::ErrorCallback cb, void *arg=nullptr)
 Registers an error callback on the most-recently-added kernel. More...
 
StageGroupBuilder & stream (Stream *s)
 Routes the most-recently-added kernel through a user-managed stream. More...
 
StageGroupBuilder & enableProfile (const xpti::ProfileConfig &config)
 Enables profiling for the most-recently-added kernel. enableProfiling failures are logged but not propagated. More...
 
 ~StageGroupBuilder ()
 
 StageGroupBuilder (StageGroupBuilder &&) noexcept
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > >
detail::TaskCountRequired< StageGroupBuilder > add (Args &&... args) &&
 
template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > >
detail::TaskCountRequired< StageBuilder > stage (Args &&... args) &&
 

Friends

class StageBuilder
 
class Launcher
 
template<typename >
class detail::TaskCountConfigured
 

Detailed Description

Collects parallel kernels within a single stage group.

Kernels added via add<K>() inside a group all run in parallel; the group itself runs as one sequential stage in the surrounding chain.

Optional knob methods (batchSize/clusterBitmap/locality/onComplete/onMessage/ onError/stream/enableProfile) target the most-recently-added kernel in the group, mirroring StageBuilder's per-stage semantics. Calling a knob before any add<K>() is a silent no-op.

Marked [[nodiscard]] so that building a parallel group and forgetting to call .run()/.runAsync() (or chaining back via .stage<...>()/.stage()) triggers a compile-time warning instead of a silent no-op.

Definition at line 324 of file stage_builder.hpp.

Constructor & Destructor Documentation

◆ ~StageGroupBuilder()

pxl::StageGroupBuilder::~StageGroupBuilder ( )

◆ StageGroupBuilder()

pxl::StageGroupBuilder::StageGroupBuilder ( StageGroupBuilder &&  )
noexcept

Member Function Documentation

◆ add() [1/4]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired<StageGroupBuilder> pxl::StageGroupBuilder::add ( Args &&...  args) &&

Adds a parallel kernel with only its own arguments; set its task count with .tasks(taskCount). Kernel arity distinguishes this from the positional compatibility form. This transition consumes an rvalue group and returns a pending type that exposes tasks() and the current entry's optional settings, but no next kernel or execution method.

◆ add() [2/4]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > >
detail::TaskCountRequired<StageGroupBuilder> pxl::StageGroupBuilder::add ( Args &&...  args) &&

Definition at line 493 of file stage_builder.hpp.

494 {
495  add<Func>(uint32_t{0}, std::forward<Args>(args)...);
496  return detail::TaskCountRequired<StageGroupBuilder>(std::move(*this));
497 }

◆ add() [3/4]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired<StageGroupBuilder> pxl::StageGroupBuilder::add ( Args &&...  args) &
delete

◆ add() [4/4]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
StageGroupBuilder& pxl::StageGroupBuilder::add ( uint32_t  taskCount,
Args &&...  args 
)
inline

Definition at line 329 of file stage_builder.hpp.

330  {
331  const char* kernelName = nullptr;
332 #if defined(__PXCC_ANALYSIS__)
333  kernelName = "__pxcc_placeholder__";
334 #else
335  static_assert(sizeof(pxl::KernelTraits<Func>) > 0,
336  "Kernel function not found in KernelTraits — was it compiled with pxcc?");
337  kernelName = pxl::KernelTraits<Func>::name;
338 #endif
339 
340  impl::StageEntry entry;
341  entry.kernelName = kernelName;
342  entry.taskCount = taskCount;
343  entry.argList.reserve(sizeof...(Args));
344  if constexpr (sizeof...(Args) > 0)
345  {
346  parent_.buildArgList(entry.argList, entry.constStorage, entry.syncTargets,
347  std::forward<Args>(args)...);
348  }
349  impl::attachStageDirections(entry, detail::MakeKernelDirections<Func>());
350  currentGroup_.entries.push_back(std::move(entry));
351  return *this;
352  }
Traits class that maps a kernel function pointer to its name string.
Definition: module.hpp:30

◆ batchSize()

StageGroupBuilder& pxl::StageGroupBuilder::batchSize ( uint32_t  n)

Sets per-task batch size for the most-recently-added kernel within the active parallel group. No-op when the group is empty.

◆ clusterBitmap()

StageGroupBuilder& pxl::StageGroupBuilder::clusterBitmap ( uint32_t  bitmap)

Sets cluster bitmap for the most-recently-added kernel in the active group.

◆ enableProfile()

StageGroupBuilder& pxl::StageGroupBuilder::enableProfile ( const xpti::ProfileConfig &  config)

Enables profiling for the most-recently-added kernel. enableProfiling failures are logged but not propagated.

◆ locality()

StageGroupBuilder& pxl::StageGroupBuilder::locality ( LocalityMode  mode)

Sets locality mode for the most-recently-added kernel in the active group.

◆ onComplete()

StageGroupBuilder& pxl::StageGroupBuilder::onComplete ( Map::CompletionCallback  cb,
void *  arg = nullptr 
)

Registers a completion callback on the most-recently-added kernel.

◆ onError()

StageGroupBuilder& pxl::StageGroupBuilder::onError ( Map::ErrorCallback  cb,
void *  arg = nullptr 
)

Registers an error callback on the most-recently-added kernel.

◆ onMessage()

StageGroupBuilder& pxl::StageGroupBuilder::onMessage ( Map::MessageCallback  cb,
void *  arg = nullptr 
)

Registers a message callback on the most-recently-added kernel.

◆ reserve()

StageGroupBuilder& pxl::StageGroupBuilder::reserve ( uint32_t  n)
inline

Definition at line 406 of file stage_builder.hpp.

407  {
408  parent_.reserve(n);
409  return *this;
410  }
StageBuilder & reserve(uint32_t n)

◆ run()

LaunchResult pxl::StageGroupBuilder::run ( )
inline

Definition at line 394 of file stage_builder.hpp.

395  {
396  flush();
397  return parent_.run();
398  }
LaunchResult run()

◆ runAsync()

std::future<LaunchResult> pxl::StageGroupBuilder::runAsync ( )
inline

Definition at line 400 of file stage_builder.hpp.

401  {
402  flush();
403  return parent_.runAsync();
404  }
std::future< LaunchResult > runAsync()

◆ stage() [1/5]

StageGroupBuilder pxl::StageGroupBuilder::stage ( )
inline

Definition at line 388 of file stage_builder.hpp.

389  {
390  flush();
391  return parent_.stage();
392  }
StageBuilder & stage(uint32_t taskCount, Args &&... args)

◆ stage() [2/5]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired<StageBuilder> pxl::StageGroupBuilder::stage ( Args &&...  args) &&

Chains a sequential stage with only the kernel's own arguments. The returned pending type must receive tasks() before the chain continues.

◆ stage() [3/5]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > >
detail::TaskCountRequired<StageBuilder> pxl::StageGroupBuilder::stage ( Args &&...  args) &&

Definition at line 501 of file stage_builder.hpp.

502 {
503  auto& parent = stage<Func>(uint32_t{0}, std::forward<Args>(args)...);
504  return detail::TaskCountRequired<StageBuilder>(std::move(parent));
505 }

◆ stage() [4/5]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
detail::TaskCountRequired<StageBuilder> pxl::StageGroupBuilder::stage ( Args &&...  args) &
delete

◆ stage() [5/5]

template<auto Func, typename... Args, detail::EnableCompatibleKernelArguments< Func, Args... > = 0>
StageBuilder& pxl::StageGroupBuilder::stage ( uint32_t  taskCount,
Args &&...  args 
)
inline

Definition at line 372 of file stage_builder.hpp.

373  {
374  flush();
375  return parent_.stage<Func>(taskCount, std::forward<Args>(args)...);
376  }

◆ stream()

StageGroupBuilder& pxl::StageGroupBuilder::stream ( Stream *  s)

Routes the most-recently-added kernel through a user-managed stream.

◆ tasks()

StageGroupBuilder& pxl::StageGroupBuilder::tasks ( uint32_t  taskCount)

Sets the task count of the most recently added kernel in this group.

Friends And Related Function Documentation

◆ detail::TaskCountConfigured

template<typename >
friend class detail::TaskCountConfigured
friend

Definition at line 465 of file stage_builder.hpp.

◆ Launcher

friend class Launcher
friend

Definition at line 463 of file stage_builder.hpp.

◆ StageBuilder

friend class StageBuilder
friend

Definition at line 462 of file stage_builder.hpp.


The documentation for this class was generated from the following file: