11 #include <xpti/xpti.hpp>
285 template <
typename... ARGS>
288 std::vector<ArgInfo_t> argInfos;
289 if (buildArgInfo(argInfos, std::forward<ARGS>(args)...) ==
false)
344 template <
typename... ARG>
347 std::vector<ArgInfo_t> argInfos;
348 if (buildArgInfo(argInfos, std::forward<ARG>(args)...) ==
false)
368 template <
typename... ARG>
371 std::vector<ArgInfo_t> argInfos;
372 if (buildArgInfo(argInfos, std::forward<ARG>(args)...) ==
false)
673 template <xpti::QueryKey Key>
677 return xpti::getSessionData<Key>(
id(), filter);
714 Map(std::unique_ptr<impl::MapImpl> impl);
716 template <
typename ARG,
typename... ARGS>
717 typename std::enable_if<std::is_trivial<typename std::remove_reference<ARG>::type>::value,
bool>::type
718 buildArgInfo(std::vector<ArgInfo_t>& argInfos, ARG&& arg, ARGS&&... args)
721 if constexpr (
sizeof...(args) > 0)
723 return buildArgInfo(argInfos, std::forward<ARGS>(args)...);
728 template <
typename ARG,
typename... ARGS>
729 typename std::enable_if<!std::is_trivial<typename std::remove_reference<ARG>::type>::value,
bool>::type
730 buildArgInfo([[maybe_unused]] std::vector<ArgInfo_t>& argInfos, [[maybe_unused]] ARG&& arg, [[maybe_unused]] ARGS&&... args)
735 template <
typename ARG,
typename... ARGS>
736 bool buildArgInfo(std::vector<ArgInfo_t>& argInfos, NDArray<ARG>& ndarrayArg, ARGS&&... args)
738 argInfos.emplace_back(ArgInfo_t{
ArgType::NDArray, &ndarrayArg,
sizeof(NDArray<ARG>)});
739 if constexpr (
sizeof...(args) > 0)
741 return buildArgInfo(argInfos, std::forward<ARGS>(args)...);
746 template <
typename ARG,
typename... ARGS>
747 bool buildArgInfo(std::vector<ArgInfo_t>& argInfos, NDArray<ARG>&& ndarrayArg, ARGS&&... args) =
delete;
749 template <
typename ARG,
typename... ARGS>
750 bool buildArgInfo(std::vector<ArgInfo_t>& argInfos, ARG* arg, ARGS&&... args)
753 if constexpr (
sizeof...(args) > 0)
755 return buildArgInfo(argInfos, std::forward<ARGS>(args)...);
760 std::unique_ptr<impl::MapImpl> impl_;
The Map class represents a map operation in the XCENA execution framework.
void setStream()
Set the default stream for the map operation.
void setErrorCallback(const ErrorCallback &callback, void *arg)
Set the error callback function and user data.
Result execute(ARGS &&... args)
Execute the map operation. This method executes the map operation with the provided input arguments.
std::function< void(void *message, void *arg)> MessageCallback
Callback function type for task message.
void setBatchSize(const uint32_t &batchSize)
Sets batchSize for the task.
friend class impl::MapFactory
uint32_t deviceId() const
Returns the device id this Map runs on.
void setMessageCallback(const MessageCallback &callback, void *arg)
Set the message callback function and user data.
Result setOutput(ARG &&... args)
Set the output for the map operation. This method sets the output for the map operation.
Result setOutput(std::vector< ArgInfo_t > &args)
Set the output for the map operation. This method sets the output for the map operation.
uint64_t id() const
Gets ID of map object.
Result exportProfilingCsv(const std::string &path="") const
Export profiling data to CSV files (convenience wrapper).
Result cancel()
Request cancellation of the map operation and wait until it stops.
std::function< void(void *arg)> ErrorCallback
Callback function type for task error.
std::function< void(void *arg)> CompletionCallback
Callback function type for task completion.
ExecuteStatus getExecuteStatus() const
Gets the execution status of the map operation.
Result enableProfiling(const xpti::ProfileConfig &config)
Enable profiling for this map with the given configuration.
Progress_t getProgress() const
Get dispatch/completion progress for the current or last run.
virtual ~Map()=default
Default virtual destructor.
Result exportProfiling(const std::string &path, xpti::ExportFormat format) const
Export profiling data in the specified format.
uint32_t getTaskCount() const
Returns the task count this map was built with.
Result setInput(std::vector< ArgInfo_t > &args)
Set the input for the map operation. This method sets the input for the map operation.
void setClusterBitmap(const uint32_t &clusterBitmap)
Set the cluster bitmap for the map operation.
void setCompletionCallback(const CompletionCallback &callback, void *arg)
Set the success callback function and user data.
Result execute(std::vector< ArgInfo_t > &args)
Execute the map operation with a vector of argument information. This method executes the map operati...
std::string getStats() const
Gets the execution statistics of the map operation.
xpti::SessionData< Key > getProfilingData(const xpti::QueryFilter &filter={}) const
Get profiling data with type-safe automatic type deduction.
uint32_t getBatchSize() const
Returns the batch size the next execution will use.
void setStream(Stream *stream)
Set the stream for the map operation.
std::vector< KernelError_t > getKernelError()
Gets the error report of the map operation.
void setLocalityMode(const LocalityMode &mode)
Set the locality mode for the map operation.
Result synchronize()
Synchronize the map operation. This method synchronizes the map operation, ensuring that all tasks ar...
uint32_t streamId() const
Returns the stream ID that the map operation is associated with.
Result setInput(ARG &&... args)
Set the input for the map operation. This method sets the input for the map operation.
An asynchronous work queue for device operations.