libhsakmt: add PC sampling support
Add pc sampling support. Change-Id: I08199024ba5a8eb2845c048d499fc8fcd260d2e8 Signed-off-by: David Yat Sin <David.YatSin@amd.com> Signed-off-by: James Zhu <James.Zhu@amd.com>
Этот коммит содержится в:
коммит произвёл
David Yat Sin
родитель
4f554988b6
Коммит
f94e2530fb
@@ -1044,6 +1044,122 @@ hsaKmtReturnAsanHeaderPage(
|
||||
void *addr // IN: Start of othe virtual address page
|
||||
);
|
||||
|
||||
/**
|
||||
Check whether kernel support pc sampling
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtPcSamplingSupport(
|
||||
void
|
||||
);
|
||||
|
||||
/**
|
||||
* Query device PC Sampling capabilities
|
||||
*
|
||||
* Arguments:
|
||||
* @NodeId (IN) - GPU node_id
|
||||
* @sample_info (IN) - Pointer to array of HSAPcSamplingInfo
|
||||
* @sample_info_sz(IN) - Size of sampling_info in units of HSAPcSamplingInfo
|
||||
* @sz_needed (OUT)- If sampling_info_sz is too small, sample_info_sz needed
|
||||
*
|
||||
* Return:
|
||||
* HSAKMT_STATUS_ERROR - failed
|
||||
* HSAKMT_STATUS_SUCCESS - successfully complete
|
||||
* HSAKMT_STATUS_INVALID_PARAMETER - invalid input
|
||||
* HSAKMT_STATUS_BUFFER_TOO_SMALL - sample buffer size is too small. Retry with sample_info_sz
|
||||
* >= sz_needed
|
||||
* HSAKMT_STATUS_NOT_SUPPORTED - this asic doesn't support pc sampling
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtPcSamplingQueryCapabilities(
|
||||
HSAuint32 NodeId,
|
||||
void *sample_info,
|
||||
HSAuint32 sample_info_sz,
|
||||
HSAuint32 *sz_needed
|
||||
);
|
||||
|
||||
/**
|
||||
* Create PC Sampling Session
|
||||
*
|
||||
* Arguments:
|
||||
* @NodeId (IN) - GPU node_id
|
||||
* @sample_info(IN) - PC Sampling configuration requested
|
||||
* @traceId (OUT) - Unique PC Sampling trace Id
|
||||
*
|
||||
* Return:
|
||||
* HSAKMT_STATUS_ERROR - failed
|
||||
* HSAKMT_STATUS_SUCCESS - successfully complete
|
||||
* HSAKMT_STATUS_INVALID_PARAMETER - invalid input
|
||||
* HSAKMT_STATUS_NO_MEMORY - not enough memory to create new pc sampling session
|
||||
* HSAKMT_STATUS_UNAVAILABLE - a different pc sampling session started on this node
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtPcSamplingCreate(
|
||||
HSAuint32 node_id,
|
||||
HsaPcSamplingInfo *sample_info,
|
||||
HsaPcSamplingTraceId *traceId
|
||||
);
|
||||
|
||||
/**
|
||||
* Destroy PC Sampling Session
|
||||
*
|
||||
* Arguments:
|
||||
* @NodeId (IN) - GPU node_id
|
||||
* @traceId(IN) - PC Sampling trace Id
|
||||
*
|
||||
* Return:
|
||||
* HSAKMT_STATUS_ERROR - failed
|
||||
* HSAKMT_STATUS_SUCCESS - successfully complete
|
||||
* HSAKMT_STATUS_INVALID_PARAMETER - invalid input
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtPcSamplingDestroy(
|
||||
HSAuint32 NodeId,
|
||||
HsaPcSamplingTraceId traceId
|
||||
);
|
||||
|
||||
/**
|
||||
* Start PC Sampling Session
|
||||
*
|
||||
* Arguments:
|
||||
* @NodeId (IN) - GPU node_id
|
||||
* @traceId(IN) - PC Sampling trace Id
|
||||
*
|
||||
* Return:
|
||||
* HSAKMT_STATUS_ERROR - failed
|
||||
* HSAKMT_STATUS_SUCCESS - successfully complete
|
||||
* HSAKMT_STATUS_INVALID_PARAMETER - invalid input
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtPcSamplingStart(
|
||||
HSAuint32 NodeId,
|
||||
HsaPcSamplingTraceId traceId
|
||||
);
|
||||
|
||||
/**
|
||||
* Stop PC Sampling Session
|
||||
*
|
||||
* Arguments:
|
||||
* @NodeId (IN) - GPU node_id
|
||||
* @traceId(IN) - PC Sampling trace Id
|
||||
*
|
||||
* Return:
|
||||
* HSAKMT_STATUS_ERROR - failed
|
||||
* HSAKMT_STATUS_SUCCESS - successfully complete
|
||||
* HSAKMT_STATUS_INVALID_PARAMETER - invalid input
|
||||
* HSAKMT_STATUS_KERNEL_ALREADY_OPENED - stop already
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtPcSamplingStop(
|
||||
HSAuint32 NodeId,
|
||||
HsaPcSamplingTraceId traceId
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //extern "C"
|
||||
#endif
|
||||
|
||||
@@ -1467,6 +1467,32 @@ typedef enum _HSA_SVM_UNMAP_TRIGGERS {
|
||||
|
||||
typedef void *HsaAMDGPUDeviceHandle;
|
||||
|
||||
typedef HSAuint32 HsaPcSamplingTraceId;
|
||||
|
||||
typedef enum _HSA_PC_SAMPLING_METHOD_KIND
|
||||
{
|
||||
HSA_PC_SAMPLING_METHOD_KIND_HOSTTRAP_V1 = 1,
|
||||
HSA_PC_SAMPLING_METHOD_KIND_STOCHASTIC_V1,
|
||||
} HSA_PC_SAMPLING_METHOD_KIND;
|
||||
|
||||
typedef enum _HSA_PC_SAMPLING_UNITS
|
||||
{
|
||||
HSA_PC_SAMPLING_UNIT_INTERVAL_MICROSECONDS,
|
||||
HSA_PC_SAMPLING_UNIT_INTERVAL_CYCLES,
|
||||
HSA_PC_SAMPLING_UNIT_INTERVAL_INSTRUCTIONS,
|
||||
} HSA_PC_SAMPLING_UNIT_INTERVAL;
|
||||
|
||||
typedef struct _HsaPcSamplingInfo
|
||||
{
|
||||
HSAuint64 value;
|
||||
HSAuint64 value_min;
|
||||
HSAuint64 value_max;
|
||||
HSAuint64 flags;
|
||||
HSA_PC_SAMPLING_METHOD_KIND method;
|
||||
HSA_PC_SAMPLING_UNIT_INTERVAL units;
|
||||
}
|
||||
HsaPcSamplingInfo;
|
||||
|
||||
#pragma pack(pop, hsakmttypes_h)
|
||||
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user