1 /*===-------------------------------------------------------------------------- 2 * ATMI (Asynchronous Task and Memory Interface) 3 * 4 * This file is distributed under the MIT License. See LICENSE.txt for details. 5 *===------------------------------------------------------------------------*/ 6 #ifndef INCLUDE_ATMI_INTEROP_HSA_H_ 7 #define INCLUDE_ATMI_INTEROP_HSA_H_ 8 9 #include "atmi_runtime.h" 10 #include "hsa.h" 11 #include "hsa_ext_amd.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 /** \defgroup interop_hsa_functions ATMI-HSA Interop 17 * @{ 18 */ 19 20 /** 21 * @brief Get the device address and size of an HSA global symbol 22 * 23 * @detail Use this function to query the device address and size of an HSA 24 * global symbol. 25 * The symbol can be set at by the compiler or by the application writer in a 26 * language-specific manner. This function is meaningful only after calling one 27 * of the @p atmi_module_register functions. 28 * 29 * @param[in] place The ATMI memory place 30 * 31 * @param[in] symbol Pointer to a non-NULL global symbol name 32 * 33 * @param[in] var_addr Pointer to a non-NULL @p void* variable that will 34 * hold the device address of the global symbol object. 35 * 36 * @param[in] var_size Pointer to a non-NULL @p uint variable that will 37 * hold the size of the global symbol object. 38 * 39 * @retval ::ATMI_STATUS_SUCCESS The function has executed successfully. 40 * 41 * @retval ::ATMI_STATUS_ERROR If @p symbol, @p var_addr or @p var_size are 42 * invalid 43 * location in the current node, or if ATMI is not initialized. 44 * 45 * @retval ::ATMI_STATUS_UNKNOWN The function encountered errors. 46 */ 47 atmi_status_t atmi_interop_hsa_get_symbol_info(atmi_mem_place_t place, 48 const char *symbol, 49 void **var_addr, 50 unsigned int *var_size); 51 52 /** 53 * @brief Get the HSA-specific kernel info from a kernel name 54 * 55 * @detail Use this function to query the HSA-specific kernel info from the 56 * kernel name. 57 * This function is meaningful only after calling one 58 * of the @p atmi_module_register functions. 59 * 60 * @param[in] place The ATMI memory place 61 * 62 * @param[in] kernel_name Pointer to a char array with the kernel name 63 * 64 * @param[in] info The different possible kernel properties 65 * 66 * @param[in] value Pointer to a non-NULL @p uint variable that will 67 * hold the return value of the kernel property. 68 * 69 * @retval ::ATMI_STATUS_SUCCESS The function has executed successfully. 70 * 71 * @retval ::ATMI_STATUS_ERROR If @p symbol, @p var_addr or @p var_size are 72 * invalid 73 * location in the current node, or if ATMI is not initialized. 74 * 75 * @retval ::ATMI_STATUS_UNKNOWN The function encountered errors. 76 */ 77 atmi_status_t atmi_interop_hsa_get_kernel_info( 78 atmi_mem_place_t place, const char *kernel_name, 79 hsa_executable_symbol_info_t info, uint32_t *value); 80 /** @} */ 81 82 #ifdef __cplusplus 83 } 84 #endif 85 86 #endif // INCLUDE_ATMI_INTEROP_HSA_H_ 87