/**\file */ #ifndef SLIC_DECLARATIONS_StreamFMA_H #define SLIC_DECLARATIONS_StreamFMA_H #include "MaxSLiCInterface.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define StreamFMA_DYNAMIC_CLOCKS_ENABLED (0) #define StreamFMA_PCIE_ALIGNMENT (16) /*----------------------------------------------------------------------------*/ /*---------------------------- Interface default -----------------------------*/ /*----------------------------------------------------------------------------*/ /** * \brief Basic static function for the interface 'default'. * * \param [in] ticks_StreamFMAKernel The number of ticks for which kernel "StreamFMAKernel" will run. * \param [in] instream_a Stream "a". * \param [in] instream_size_a The size of the stream instream_a in bytes. * \param [in] instream_b Stream "b". * \param [in] instream_size_b The size of the stream instream_b in bytes. * \param [out] outstream_output Stream "output". * \param [in] outstream_size_output The size of the stream outstream_output in bytes. */ void StreamFMA( uint64_t ticks_StreamFMAKernel, const void *instream_a, size_t instream_size_a, const void *instream_b, size_t instream_size_b, void *outstream_output, size_t outstream_size_output); /** * \brief Basic static non-blocking function for the interface 'default'. * * Schedule to run on an engine and return immediately. * The status of the run can be checked either by ::max_wait or ::max_nowait; * note that one of these *must* be called, so that associated memory can be released. * * * \param [in] ticks_StreamFMAKernel The number of ticks for which kernel "StreamFMAKernel" will run. * \param [in] instream_a Stream "a". * \param [in] instream_size_a The size of the stream instream_a in bytes. * \param [in] instream_b Stream "b". * \param [in] instream_size_b The size of the stream instream_b in bytes. * \param [out] outstream_output Stream "output". * \param [in] outstream_size_output The size of the stream outstream_output in bytes. * \return A handle on the execution status, or NULL in case of error. */ max_run_t *StreamFMA_nonblock( uint64_t ticks_StreamFMAKernel, const void *instream_a, size_t instream_size_a, const void *instream_b, size_t instream_size_b, void *outstream_output, size_t outstream_size_output); /** * \brief Advanced static interface, structure for the engine interface 'default' * */ typedef struct { uint64_t ticks_StreamFMAKernel; /**< [in] The number of ticks for which kernel "StreamFMAKernel" will run. */ const void *instream_a; /**< [in] Stream "a". */ size_t instream_size_a; /**< [in] The size of the stream instream_a in bytes. */ const void *instream_b; /**< [in] Stream "b". */ size_t instream_size_b; /**< [in] The size of the stream instream_b in bytes. */ void *outstream_output; /**< [out] Stream "output". */ size_t outstream_size_output; /**< [in] The size of the stream outstream_output in bytes. */ } StreamFMA_actions_t; /** * \brief Advanced static function for the interface 'default'. * * \param [in] engine The engine on which the actions will be executed. * \param [in,out] interface_actions Actions to be executed. */ void StreamFMA_run( max_engine_t *engine, StreamFMA_actions_t *interface_actions); /** * \brief Advanced static non-blocking function for the interface 'default'. * * Schedule the actions to run on the engine and return immediately. * The status of the run can be checked either by ::max_wait or ::max_nowait; * note that one of these *must* be called, so that associated memory can be released. * * * \param [in] engine The engine on which the actions will be executed. * \param [in] interface_actions Actions to be executed. * \return A handle on the execution status of the actions, or NULL in case of error. */ max_run_t *StreamFMA_run_nonblock( max_engine_t *engine, StreamFMA_actions_t *interface_actions); /** * \brief Group run advanced static function for the interface 'default'. * * \param [in] group Group to use. * \param [in,out] interface_actions Actions to run. * * Run the actions on the first device available in the group. */ void StreamFMA_run_group(max_group_t *group, StreamFMA_actions_t *interface_actions); /** * \brief Group run advanced static non-blocking function for the interface 'default'. * * * Schedule the actions to run on the first device available in the group and return immediately. * The status of the run must be checked with ::max_wait. * Note that use of ::max_nowait is prohibited with non-blocking running on groups: * see the ::max_run_group_nonblock documentation for more explanation. * * \param [in] group Group to use. * \param [in] interface_actions Actions to run. * \return A handle on the execution status of the actions, or NULL in case of error. */ max_run_t *StreamFMA_run_group_nonblock(max_group_t *group, StreamFMA_actions_t *interface_actions); /** * \brief Array run advanced static function for the interface 'default'. * * \param [in] engarray The array of devices to use. * \param [in,out] interface_actions The array of actions to run. * * Run the array of actions on the array of engines. The length of interface_actions * must match the size of engarray. */ void StreamFMA_run_array(max_engarray_t *engarray, StreamFMA_actions_t *interface_actions[]); /** * \brief Array run advanced static non-blocking function for the interface 'default'. * * * Schedule to run the array of actions on the array of engines, and return immediately. * The length of interface_actions must match the size of engarray. * The status of the run can be checked either by ::max_wait or ::max_nowait; * note that one of these *must* be called, so that associated memory can be released. * * \param [in] engarray The array of devices to use. * \param [in] interface_actions The array of actions to run. * \return A handle on the execution status of the actions, or NULL in case of error. */ max_run_t *StreamFMA_run_array_nonblock(max_engarray_t *engarray, StreamFMA_actions_t *interface_actions[]); /** * \brief Converts a static-interface action struct into a dynamic-interface max_actions_t struct. * * Note that this is an internal utility function used by other functions in the static interface. * * \param [in] maxfile The maxfile to use. * \param [in] interface_actions The interface-specific actions to run. * \return The dynamic-interface actions to run, or NULL in case of error. */ max_actions_t* StreamFMA_convert(max_file_t *maxfile, StreamFMA_actions_t *interface_actions); /** * \brief Initialise a maxfile. */ max_file_t* StreamFMA_init(void); /* Error handling functions */ int StreamFMA_has_errors(void); const char* StreamFMA_get_errors(void); void StreamFMA_clear_errors(void); /* Free statically allocated maxfile data */ void StreamFMA_free(void); /* returns: -1 = error running command; 0 = no error reported */ int StreamFMA_simulator_start(void); /* returns: -1 = error running command; 0 = no error reported */ int StreamFMA_simulator_stop(void); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* SLIC_DECLARATIONS_StreamFMA_H */