Add hsa_amd_signal_value_pointer.

Enables partial signal interop with non-HSA devices.

Change-Id: Ic39bca84ed1709cbd2cc24b1eb0f4fc6cccb39cf


[ROCm/ROCR-Runtime commit: 01f42dbe46]
Этот коммит содержится в:
Sean Keely
2020-11-30 21:29:04 -06:00
родитель b3dc12024b
Коммит 4047b1c3a8
8 изменённых файлов: 171 добавлений и 1 удалений
+1 -1
Просмотреть файл
@@ -97,7 +97,7 @@ if (ROCM_CCACHE_BUILD)
endif() # if (ROCM_CCACHE_BUILD)
## Get version strings
get_version ( "1.2.0" )
get_version ( "1.3.0" )
if ( ${ROCM_PATCH_VERSION} )
set ( VERSION_PATCH ${ROCM_PATCH_VERSION})
endif()
+6
Просмотреть файл
@@ -1145,6 +1145,12 @@ hsa_status_t HSA_API hsa_amd_deregister_deallocation_callback(void* ptr,
return amdExtTable->hsa_amd_deregister_deallocation_callback_fn(ptr, callback);
}
// Mirrors Amd Extension Apis
hsa_status_t HSA_API hsa_amd_signal_value_pointer(hsa_signal_t signal,
volatile hsa_signal_value_t** value_ptr) {
return amdExtTable->hsa_amd_signal_value_pointer_fn(signal, value_ptr);
}
// Tools only table interfaces.
namespace rocr {
+4
Просмотреть файл
@@ -242,6 +242,10 @@ hsa_status_t hsa_amd_register_deallocation_callback(
hsa_status_t hsa_amd_deregister_deallocation_callback(
void* ptr, hsa_amd_deallocation_callback_t callback);
// Mirrors Amd Extension Apis
hsa_status_t hsa_amd_signal_value_pointer(hsa_signal_t signal,
volatile hsa_signal_value_t** value_ptr);
} // namespace amd
} // namespace rocr
+1
Просмотреть файл
@@ -390,6 +390,7 @@ void HsaApiTable::UpdateAmdExts() {
amd_ext_api.hsa_amd_memory_lock_to_pool_fn = AMD::hsa_amd_memory_lock_to_pool;
amd_ext_api.hsa_amd_register_deallocation_callback_fn = AMD::hsa_amd_register_deallocation_callback;
amd_ext_api.hsa_amd_deregister_deallocation_callback_fn = AMD::hsa_amd_deregister_deallocation_callback;
amd_ext_api.hsa_amd_signal_value_pointer_fn = AMD::hsa_amd_signal_value_pointer;
}
void LoadInitialHsaApiTable() {
+17
Просмотреть файл
@@ -470,6 +470,23 @@ hsa_status_t hsa_amd_signal_create(hsa_signal_value_t initial_value, uint32_t nu
CATCH;
}
hsa_status_t hsa_amd_signal_value_pointer(hsa_signal_t hsa_signal,
volatile hsa_signal_value_t** value_ptr) {
TRY;
IS_OPEN();
IS_BAD_PTR(value_ptr);
core::Signal* signal = core::Signal::Convert(hsa_signal);
IS_VALID(signal);
if(!core::BusyWaitSignal::IsType(signal))
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
*value_ptr = (volatile hsa_signal_value_t*)&signal->signal_.value;
return HSA_STATUS_SUCCESS;
CATCH;
}
uint32_t hsa_amd_signal_wait_any(uint32_t signal_count, hsa_signal_t* hsa_signals,
hsa_signal_condition_t* conds, hsa_signal_value_t* values,
uint64_t timeout_hint, hsa_wait_state_t wait_hint,
+1
Просмотреть файл
@@ -220,6 +220,7 @@ global:
hsa_amd_queue_set_priority;
hsa_amd_register_deallocation_callback;
hsa_amd_deregister_deallocation_callback;
hsa_amd_signal_value_pointer;
_amdgpu_r_debug;
local:
+1
Просмотреть файл
@@ -182,6 +182,7 @@ struct AmdExtTable {
decltype(hsa_amd_memory_lock_to_pool)* hsa_amd_memory_lock_to_pool_fn;
decltype(hsa_amd_register_deallocation_callback)* hsa_amd_register_deallocation_callback_fn;
decltype(hsa_amd_deregister_deallocation_callback)* hsa_amd_deregister_deallocation_callback_fn;
decltype(hsa_amd_signal_value_pointer)* hsa_amd_signal_value_pointer_fn;
};
// Table to export HSA Core Runtime Apis
+140
Просмотреть файл
@@ -55,6 +55,115 @@
extern "C" {
#endif
/** \addtogroup aql Architected Queuing Language
* @{
*/
/**
* @brief A fixed-size type used to represent ::hsa_signal_condition_t constants.
*/
typedef uint32_t hsa_signal_condition32_t;
/**
* @brief AMD vendor specific packet type.
*/
typedef enum {
/**
* Packet used by agents to delay processing of subsequent packets until a
* configurable condition is satisfied by an HSA signal. Only kernel dispatch
* queues created from AMD GPU Agents support this packet.
*/
HSA_AMD_PACKET_TYPE_BARRIER_VALUE = 2,
} hsa_amd_packet_type_t;
/**
* @brief A fixed-size type used to represent ::hsa_amd_packet_type_t constants.
*/
typedef uint8_t hsa_amd_packet_type8_t;
/**
* @brief AMD vendor specific AQL packet header
*/
typedef struct hsa_amd_packet_header_s {
/**
* Packet header. Used to configure multiple packet parameters such as the
* packet type. The parameters are described by ::hsa_packet_header_t.
*/
uint16_t header;
/**
*Format of the vendor specific packet.
*/
hsa_amd_packet_type8_t AmdFormat;
/**
* Reserved. Must be 0.
*/
uint8_t reserved;
} hsa_amd_vendor_packet_header_t;
/**
* @brief AMD barrier value packet. Halts packet processing and waits for
* (signal_value & ::mask) ::cond ::value to be satisfied, where signal_value
* is the value of the signal ::signal.
*/
typedef struct hsa_amd_barrier_value_packet_s {
/**
* AMD vendor specific packet header.
*/
hsa_amd_vendor_packet_header_t header;
/**
* Reserved. Must be 0.
*/
uint32_t reserved0;
/**
* Dependent signal object. A signal with a handle value of 0 is
* allowed and is interpreted by the packet processor a satisfied
* dependency.
*/
hsa_signal_t signal;
/**
* Value to compare against.
*/
hsa_signal_value_t value;
/**
* Bit mask to be combined by bitwise AND with ::signal's value.
*/
hsa_signal_value_t mask;
/**
* Comparison operation. See ::hsa_signal_condition_t.
*/
hsa_signal_condition32_t cond;
/**
* Reserved. Must be 0.
*/
uint32_t reserved1;
/**
* Reserved. Must be 0.
*/
uint64_t reserved2;
/**
* Reserved. Must be 0.
*/
uint64_t reserved3;
/**
* Signal used to indicate completion of the job. The application can use the
* special signal handle 0 to indicate that no signal is used.
*/
hsa_signal_t completion_signal;
} hsa_amd_barrier_value_packet_t;
/** @} */
/**
* @brief Enumeration constants added to ::hsa_status_t.
*
@@ -485,6 +594,37 @@ hsa_status_t HSA_API hsa_amd_signal_create(hsa_signal_value_t initial_value, uin
const hsa_agent_t* consumers, uint64_t attributes,
hsa_signal_t* signal);
/**
* @brief Returns a pointer to the value of a signal.
*
* Use of this API does not modify the lifetime of ::signal and any
* hsa_signal_value_t retrieved by this API has lifetime equal to that of
* ::signal.
*
* This API is intended for partial interoperability with non-HSA compatible
* devices and should not be used where HSA interfaces are available.
*
* Use of the signal value must comply with use restritions of ::signal.
* Use may result in data races if the operations performed are not platform
* atomic. Use with HSA_AMD_SIGNAL_AMD_GPU_ONLY or HSA_AMD_SIGNAL_IPC
* attributed signals is required.
*
* @param[in] Signal handle to extract the signal value pointer from.
*
* @param[out] Location where the extracted signal value pointer will be placed.
*
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
*
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
* initialized.
*
* @retval ::HSA_STATUS_ERROR_INVALID_SIGNAL signal is not a valid hsa_signal_t
*
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT value_ptr is NULL.
*/
hsa_status_t hsa_amd_signal_value_pointer(hsa_signal_t signal,
volatile hsa_signal_value_t** value_ptr);
/**
* @brief Asyncronous signal handler function type.
*