|
PXL
|
The Map class represents a map operation in the XCENA execution framework. More...
#include <map.hpp>
Public Types | |
| using | CompletionCallback = std::function< void(void *arg)> |
| Callback function type for task completion. More... | |
| using | MessageCallback = std::function< void(void *message, void *arg)> |
| Callback function type for task message. More... | |
| using | ErrorCallback = std::function< void(void *arg)> |
| Callback function type for task error. More... | |
Public Member Functions | |
| void | setCompletionCallback (const CompletionCallback &callback, void *arg) |
| Set the success callback function and user data. More... | |
| void | setMessageCallback (const MessageCallback &callback, void *arg) |
| Set the message callback function and user data. More... | |
| void | setErrorCallback (const ErrorCallback &callback, void *arg) |
| Set the error callback function and user data. More... | |
| void | setBatchSize (const uint32_t &batchSize) |
| Sets batchSize for the task. More... | |
| uint32_t | getBatchSize () const |
| Returns the batch size the next execution will use. More... | |
| uint32_t | getTaskCount () const |
| Returns the task count this map was built with. More... | |
| void | setClusterBitmap (const uint32_t &clusterBitmap) |
| Set the cluster bitmap for the map operation. More... | |
| void | setLocalityMode (const LocalityMode &mode) |
| Set the locality mode for the map operation. More... | |
| void | setStream () |
| Set the default stream for the map operation. More... | |
| void | setStream (Stream *stream) |
| Set the stream for the map operation. More... | |
| uint32_t | streamId () const |
| Returns the stream ID that the map operation is associated with. More... | |
| Result | execute () |
| template<typename... ARGS> | |
| Result | execute (ARGS &&... args) |
| Execute the map operation. This method executes the map operation with the provided input arguments. More... | |
| Result | execute (std::vector< ArgInfo_t > &args) |
| Execute the map operation with a vector of argument information. This method executes the map operation with the provided argument information. More... | |
| template<typename... ARG> | |
| Result | setInput (ARG &&... args) |
| Set the input for the map operation. This method sets the input for the map operation. More... | |
| template<typename... ARG> | |
| Result | setOutput (ARG &&... args) |
| Set the output for the map operation. This method sets the output for the map operation. More... | |
| Result | setInput (std::vector< ArgInfo_t > &args) |
| Set the input for the map operation. This method sets the input for the map operation. More... | |
| Result | setOutput (std::vector< ArgInfo_t > &args) |
| Set the output for the map operation. This method sets the output for the map operation. More... | |
| Result | cancel () |
| Request cancellation of the map operation and wait until it stops. More... | |
| Result | synchronize () |
| Synchronize the map operation. This method synchronizes the map operation, ensuring that all tasks are completed. More... | |
| ExecuteStatus | getExecuteStatus () const |
| Gets the execution status of the map operation. More... | |
| Progress_t | getProgress () const |
| Get dispatch/completion progress for the current or last run. More... | |
| std::vector< KernelError_t > | getKernelError () |
| Gets the error report of the map operation. More... | |
| std::string | getStats () const |
| Gets the execution statistics of the map operation. More... | |
| uint64_t | id () const |
| Gets ID of map object. More... | |
| uint32_t | deviceId () const |
| Returns the device id this Map runs on. More... | |
| Result | enableProfiling (const xpti::ProfileConfig &config) |
| Enable profiling for this map with the given configuration. More... | |
| template<xpti::QueryKey Key> | |
| xpti::SessionData< Key > | getProfilingData (const xpti::QueryFilter &filter={}) const |
| Get profiling data with type-safe automatic type deduction. More... | |
| Result | exportProfiling (const std::string &path, xpti::ExportFormat format) const |
| Export profiling data in the specified format. More... | |
| Result | exportProfilingCsv (const std::string &path="") const |
| Export profiling data to CSV files (convenience wrapper). More... | |
Protected Member Functions | |
| virtual | ~Map ()=default |
| Default virtual destructor. More... | |
Friends | |
| class | impl::MapFactory |
The Map class represents a map operation in the XCENA execution framework.
The Map class is responsible for executing a map operation on a given job. It provides methods to set input and output arguments, set the batch size and synchronize the execution. The map operation can be executed by calling the execute method.
If a completion, message, or error callback throws, the exception is caught and logged on the invoking thread. It does not propagate through execute() or synchronize(), or escape the thread invoking the callback. Report callback failures through application-managed state instead of throwing.
| using pxl::Map::CompletionCallback = std::function<void(void* arg)> |
| using pxl::Map::ErrorCallback = std::function<void(void* arg)> |
| using pxl::Map::MessageCallback = std::function<void(void* message, void* arg)> |
|
protectedvirtualdefault |
Default virtual destructor.
| Result pxl::Map::cancel | ( | ) |
Request cancellation of the map operation and wait until it stops.
Cancellation is a soft stop: tasks already dispatched to the device cannot be interrupted. This call sets a cancel flag, then waits for any in-flight tasks to complete naturally. Once all outstanding work is drained, the map transitions to ExecuteStatus::Cancelled and this call returns.
Side effects:
After a successful cancellation, the map may be re-executed via execute(). The internal argument caches (pinned device memory for constants and NDArrays) are preserved across cancel so re-execute with the same argument types avoids re-allocation.
When called during an active execution, cancel() waits for its completion record to be published and returns the recorded result. If the record has already been published, cancel() returns Success without making any changes, even when the execution failed. Consequently, two cancellation requests for the same failed run return DeviceError and then Success.
Completion and error callbacks run after the record is published, so a cancel() call from either callback also returns Success without making any changes. Success does not imply that the Map can be executed again; check getExecuteStatus() before re-executing it.
This function leaves the Map unchanged and returns Success if the Map has not started yet (Idle) or its most recent execution has already been recorded.
Example usage:
| uint32_t pxl::Map::deviceId | ( | ) | const |
Returns the device id this Map runs on.
| Result pxl::Map::enableProfiling | ( | const xpti::ProfileConfig & | config | ) |
Enable profiling for this map with the given configuration.
| config | Profile configuration to use for profiling. |
xtop run), profiling is automatically enabled in the constructor with a default configuration. In this case, subsequent calls to enableProfiling() are ignored and return Success. xtop run controls profiling entirely through its own configuration (YAML/env vars), so user-specified config is intentionally not applied.Example usage:
|
inline |
|
inline |
Execute the map operation. This method executes the map operation with the provided input arguments.
| ARGS | Types of the input arguments. |
| args | Input arguments. |
Example usage:
Definition at line 286 of file map.hpp.
Execute the map operation with a vector of argument information. This method executes the map operation with the provided argument information.
| args | A vector of ArgInfo_t structures containing the argument information. |
Example usage:
| Result pxl::Map::exportProfiling | ( | const std::string & | path, |
| xpti::ExportFormat | format | ||
| ) | const |
Export profiling data in the specified format.
| path | Output directory path (empty string uses default: "session_data"). |
| format | Export format: Csv, Xpti, or Both. |
Example usage:
| Result pxl::Map::exportProfilingCsv | ( | const std::string & | path = "" | ) | const |
Export profiling data to CSV files (convenience wrapper).
| path | Output path for CSV files (empty string uses default: "session_data"). |
| uint32_t pxl::Map::getBatchSize | ( | ) | const |
Returns the batch size the next execution will use.
Example usage:
| ExecuteStatus pxl::Map::getExecuteStatus | ( | ) | const |
Gets the execution status of the map operation.
Whether a request was accepted is the return value of execute(), and whether a finished run ended in error is the return value of synchronize(). This call answers the remaining question: once synchronize() has returned, whether the run completed normally or was cancelled.
Example usage:
ExecuteStatus::Completed. Code that previously treated ExecuteStatus::Idle as successful completion must migrate to Completed or use the result of synchronize(). | std::vector<KernelError_t> pxl::Map::getKernelError | ( | ) |
Gets the error report of the map operation.
Example usage:
|
inline |
Get profiling data with type-safe automatic type deduction.
| Key | Query key type (e.g., xpti::QueryKey::EventsDevice, xpti::QueryKey::MetricsRawL1) |
| filter | Optional filter to apply to the data (default: no filter). |
Example usage:
| Progress_t pxl::Map::getProgress | ( | ) | const |
Get dispatch/completion progress for the current or last run.
Counts are updated live while the map is executing and remain at the run's final values after it reaches a terminal state (Completed / Fail / Cancelled). On cancel, targetCount is clamped to whatever was already dispatched, so doneCount == targetCount means all in-flight work has drained.
Example usage:
| std::string pxl::Map::getStats | ( | ) | const |
Gets the execution statistics of the map operation.
Example usage:
| uint32_t pxl::Map::getTaskCount | ( | ) | const |
Returns the task count this map was built with.
| uint64_t pxl::Map::id | ( | ) | const |
Gets ID of map object.
| void pxl::Map::setBatchSize | ( | const uint32_t & | batchSize | ) |
Sets batchSize for the task.
| batchSize | Number of tasks to be executed sequentially as a batch on a single MU Core. |
| void pxl::Map::setClusterBitmap | ( | const uint32_t & | clusterBitmap | ) |
Set the cluster bitmap for the map operation.
| clusterBitmap | Number of cluster bitmap to be used for the map operation. Set to 0 to use all clusters. |
| void pxl::Map::setCompletionCallback | ( | const CompletionCallback & | callback, |
| void * | arg | ||
| ) |
Set the success callback function and user data.
| callback | Completion callback function to be called when the map operation is successful. |
| arg | User data to be passed to the success callback function. |
Example usage:
| void pxl::Map::setErrorCallback | ( | const ErrorCallback & | callback, |
| void * | arg | ||
| ) |
Set the error callback function and user data.
| callback | Error callback function to be called when the map operation encounters an error. |
| arg | User data to be passed to the error callback function. |
Example usage:
|
inline |
Set the input for the map operation. This method sets the input for the map operation.
| ARG | Type of the input argument. |
| arg | Input argument. |
Example usage:
Definition at line 345 of file map.hpp.
Set the input for the map operation. This method sets the input for the map operation.
| args | Input arguments. |
Example usage:
| void pxl::Map::setLocalityMode | ( | const LocalityMode & | mode | ) |
Set the locality mode for the map operation.
| mode | LocalityMode to be used for the map operation. |
| void pxl::Map::setMessageCallback | ( | const MessageCallback & | callback, |
| void * | arg | ||
| ) |
Set the message callback function and user data.
| callback | Message callback function to be called when the map operation encounters an message event. |
| arg | User data to be passed to the message callback function. |
Example usage:
|
inline |
Set the output for the map operation. This method sets the output for the map operation.
| ARG | Type of the output argument. |
| arg | Output argument. |
Example usage:
Definition at line 369 of file map.hpp.
Set the output for the map operation. This method sets the output for the map operation.
| args | Output arguments. |
Example usage:
| void pxl::Map::setStream | ( | ) |
Set the default stream for the map operation.
This function sets the stream to the default stream. Use this when no specific stream is required.
Example usage:
| void pxl::Map::setStream | ( | Stream * | stream | ) |
Set the stream for the map operation.
| stream | Pointer to the Stream object to be used for the map operation. |
Example usage:
| uint32_t pxl::Map::streamId | ( | ) | const |
Returns the stream ID that the map operation is associated with.
| Result pxl::Map::synchronize | ( | ) |
Synchronize the map operation. This method synchronizes the map operation, ensuring that all tasks are completed.
Example usage: