StreamFMA.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /**\file */
  2. #ifndef SLIC_DECLARATIONS_StreamFMA_H
  3. #define SLIC_DECLARATIONS_StreamFMA_H
  4. #include "MaxSLiCInterface.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif /* __cplusplus */
  8. #define StreamFMA_DYNAMIC_CLOCKS_ENABLED (0)
  9. #define StreamFMA_PCIE_ALIGNMENT (16)
  10. /*----------------------------------------------------------------------------*/
  11. /*---------------------------- Interface default -----------------------------*/
  12. /*----------------------------------------------------------------------------*/
  13. /**
  14. * \brief Basic static function for the interface 'default'.
  15. *
  16. * \param [in] ticks_StreamFMAKernel The number of ticks for which kernel "StreamFMAKernel" will run.
  17. * \param [in] instream_a Stream "a".
  18. * \param [in] instream_size_a The size of the stream instream_a in bytes.
  19. * \param [in] instream_b Stream "b".
  20. * \param [in] instream_size_b The size of the stream instream_b in bytes.
  21. * \param [out] outstream_output Stream "output".
  22. * \param [in] outstream_size_output The size of the stream outstream_output in bytes.
  23. */
  24. void StreamFMA(
  25. uint64_t ticks_StreamFMAKernel,
  26. const void *instream_a,
  27. size_t instream_size_a,
  28. const void *instream_b,
  29. size_t instream_size_b,
  30. void *outstream_output,
  31. size_t outstream_size_output);
  32. /**
  33. * \brief Basic static non-blocking function for the interface 'default'.
  34. *
  35. * Schedule to run on an engine and return immediately.
  36. * The status of the run can be checked either by ::max_wait or ::max_nowait;
  37. * note that one of these *must* be called, so that associated memory can be released.
  38. *
  39. *
  40. * \param [in] ticks_StreamFMAKernel The number of ticks for which kernel "StreamFMAKernel" will run.
  41. * \param [in] instream_a Stream "a".
  42. * \param [in] instream_size_a The size of the stream instream_a in bytes.
  43. * \param [in] instream_b Stream "b".
  44. * \param [in] instream_size_b The size of the stream instream_b in bytes.
  45. * \param [out] outstream_output Stream "output".
  46. * \param [in] outstream_size_output The size of the stream outstream_output in bytes.
  47. * \return A handle on the execution status, or NULL in case of error.
  48. */
  49. max_run_t *StreamFMA_nonblock(
  50. uint64_t ticks_StreamFMAKernel,
  51. const void *instream_a,
  52. size_t instream_size_a,
  53. const void *instream_b,
  54. size_t instream_size_b,
  55. void *outstream_output,
  56. size_t outstream_size_output);
  57. /**
  58. * \brief Advanced static interface, structure for the engine interface 'default'
  59. *
  60. */
  61. typedef struct {
  62. uint64_t ticks_StreamFMAKernel; /**< [in] The number of ticks for which kernel "StreamFMAKernel" will run. */
  63. const void *instream_a; /**< [in] Stream "a". */
  64. size_t instream_size_a; /**< [in] The size of the stream instream_a in bytes. */
  65. const void *instream_b; /**< [in] Stream "b". */
  66. size_t instream_size_b; /**< [in] The size of the stream instream_b in bytes. */
  67. void *outstream_output; /**< [out] Stream "output". */
  68. size_t outstream_size_output; /**< [in] The size of the stream outstream_output in bytes. */
  69. } StreamFMA_actions_t;
  70. /**
  71. * \brief Advanced static function for the interface 'default'.
  72. *
  73. * \param [in] engine The engine on which the actions will be executed.
  74. * \param [in,out] interface_actions Actions to be executed.
  75. */
  76. void StreamFMA_run(
  77. max_engine_t *engine,
  78. StreamFMA_actions_t *interface_actions);
  79. /**
  80. * \brief Advanced static non-blocking function for the interface 'default'.
  81. *
  82. * Schedule the actions to run on the engine and return immediately.
  83. * The status of the run can be checked either by ::max_wait or ::max_nowait;
  84. * note that one of these *must* be called, so that associated memory can be released.
  85. *
  86. *
  87. * \param [in] engine The engine on which the actions will be executed.
  88. * \param [in] interface_actions Actions to be executed.
  89. * \return A handle on the execution status of the actions, or NULL in case of error.
  90. */
  91. max_run_t *StreamFMA_run_nonblock(
  92. max_engine_t *engine,
  93. StreamFMA_actions_t *interface_actions);
  94. /**
  95. * \brief Group run advanced static function for the interface 'default'.
  96. *
  97. * \param [in] group Group to use.
  98. * \param [in,out] interface_actions Actions to run.
  99. *
  100. * Run the actions on the first device available in the group.
  101. */
  102. void StreamFMA_run_group(max_group_t *group, StreamFMA_actions_t *interface_actions);
  103. /**
  104. * \brief Group run advanced static non-blocking function for the interface 'default'.
  105. *
  106. *
  107. * Schedule the actions to run on the first device available in the group and return immediately.
  108. * The status of the run must be checked with ::max_wait.
  109. * Note that use of ::max_nowait is prohibited with non-blocking running on groups:
  110. * see the ::max_run_group_nonblock documentation for more explanation.
  111. *
  112. * \param [in] group Group to use.
  113. * \param [in] interface_actions Actions to run.
  114. * \return A handle on the execution status of the actions, or NULL in case of error.
  115. */
  116. max_run_t *StreamFMA_run_group_nonblock(max_group_t *group, StreamFMA_actions_t *interface_actions);
  117. /**
  118. * \brief Array run advanced static function for the interface 'default'.
  119. *
  120. * \param [in] engarray The array of devices to use.
  121. * \param [in,out] interface_actions The array of actions to run.
  122. *
  123. * Run the array of actions on the array of engines. The length of interface_actions
  124. * must match the size of engarray.
  125. */
  126. void StreamFMA_run_array(max_engarray_t *engarray, StreamFMA_actions_t *interface_actions[]);
  127. /**
  128. * \brief Array run advanced static non-blocking function for the interface 'default'.
  129. *
  130. *
  131. * Schedule to run the array of actions on the array of engines, and return immediately.
  132. * The length of interface_actions must match the size of engarray.
  133. * The status of the run can be checked either by ::max_wait or ::max_nowait;
  134. * note that one of these *must* be called, so that associated memory can be released.
  135. *
  136. * \param [in] engarray The array of devices to use.
  137. * \param [in] interface_actions The array of actions to run.
  138. * \return A handle on the execution status of the actions, or NULL in case of error.
  139. */
  140. max_run_t *StreamFMA_run_array_nonblock(max_engarray_t *engarray, StreamFMA_actions_t *interface_actions[]);
  141. /**
  142. * \brief Converts a static-interface action struct into a dynamic-interface max_actions_t struct.
  143. *
  144. * Note that this is an internal utility function used by other functions in the static interface.
  145. *
  146. * \param [in] maxfile The maxfile to use.
  147. * \param [in] interface_actions The interface-specific actions to run.
  148. * \return The dynamic-interface actions to run, or NULL in case of error.
  149. */
  150. max_actions_t* StreamFMA_convert(max_file_t *maxfile, StreamFMA_actions_t *interface_actions);
  151. /**
  152. * \brief Initialise a maxfile.
  153. */
  154. max_file_t* StreamFMA_init(void);
  155. /* Error handling functions */
  156. int StreamFMA_has_errors(void);
  157. const char* StreamFMA_get_errors(void);
  158. void StreamFMA_clear_errors(void);
  159. /* Free statically allocated maxfile data */
  160. void StreamFMA_free(void);
  161. /* returns: -1 = error running command; 0 = no error reported */
  162. int StreamFMA_simulator_start(void);
  163. /* returns: -1 = error running command; 0 = no error reported */
  164. int StreamFMA_simulator_stop(void);
  165. #ifdef __cplusplus
  166. }
  167. #endif /* __cplusplus */
  168. #endif /* SLIC_DECLARATIONS_StreamFMA_H */