libkmt: Misc fixes in thunk
1. Translate thunk queue priority to kfd priority
2. Initialize event SyncVar
3. Added HSAint32 data type
Change-Id: I7decc1be7cbe9c84cb670d9a7c99050b62ba98f3
[ROCm/ROCR-Runtime commit: cb0f851560]
This commit is contained in:
@@ -48,6 +48,7 @@ extern "C" {
|
||||
typedef unsigned short HSAuint16;
|
||||
typedef signed short HSAint16;
|
||||
typedef unsigned __int32 HSAuint32;
|
||||
typedef signed __int32 HSAint32;
|
||||
typedef signed __int64 HSAint64;
|
||||
typedef unsigned __int64 HSAuint64;
|
||||
|
||||
@@ -63,6 +64,7 @@ extern "C" {
|
||||
typedef uint16_t HSAuint16;
|
||||
typedef int16_t HSAint16;
|
||||
typedef uint32_t HSAuint32;
|
||||
typedef int32_t HSAint32;
|
||||
typedef int64_t HSAint64;
|
||||
typedef uint64_t HSAuint64;
|
||||
|
||||
|
||||
Regular → Executable
+4
@@ -120,6 +120,10 @@ hsaKmtCreateEvent(
|
||||
e->EventData.HWData1 = args.event_id;
|
||||
|
||||
e->EventData.HWData3 = args.event_trigger_data;
|
||||
e->EventData.EventData.SyncVar.SyncVar.UserData =
|
||||
EventDesc->SyncVar.SyncVar.UserData;
|
||||
e->EventData.EventData.SyncVar.SyncVarSize =
|
||||
EventDesc->SyncVar.SyncVarSize;
|
||||
|
||||
if (IsSignaled && !IsSystemEventType(e->EventData.EventType)) {
|
||||
struct kfd_ioctl_set_event_args set_args;
|
||||
|
||||
Regular → Executable
+16
-2
@@ -513,6 +513,12 @@ static int handle_concrete_asic(struct queue *q,
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* A map to translate thunk queue priority (-3 to +3)
|
||||
* to KFD queue priority (0 to 15)
|
||||
* Indexed by thunk_queue_priority+3
|
||||
*/
|
||||
static uint32_t priority_map[] = {0,3,5,7,9,11,15};
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtCreateQueue(
|
||||
@@ -533,6 +539,10 @@ hsaKmtCreateQueue(
|
||||
int err;
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
if (Priority < HSA_QUEUE_PRIORITY_MINIMUM ||
|
||||
Priority > HSA_QUEUE_PRIORITY_MAXIMUM)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
result = validate_nodeid(NodeId, &gpu_id);
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
@@ -581,7 +591,7 @@ hsaKmtCreateQueue(
|
||||
args.ring_base_address = (uintptr_t)QueueAddress;
|
||||
args.ring_size = QueueSizeInBytes;
|
||||
args.queue_percentage = QueuePercentage;
|
||||
args.queue_priority = Priority;
|
||||
args.queue_priority = priority_map[Priority+3];
|
||||
|
||||
err = kmtIoctl(kfd_fd, AMDKFD_IOC_CREATE_QUEUE, &args);
|
||||
|
||||
@@ -623,13 +633,17 @@ hsaKmtUpdateQueue(
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
if (Priority < HSA_QUEUE_PRIORITY_MINIMUM ||
|
||||
Priority > HSA_QUEUE_PRIORITY_MAXIMUM)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (q == NULL)
|
||||
return (HSAKMT_STATUS_INVALID_PARAMETER);
|
||||
arg.queue_id = (HSAuint32)q->queue_id;
|
||||
arg.ring_base_address = (uintptr_t)QueueAddress;
|
||||
arg.ring_size = QueueSize;
|
||||
arg.queue_percentage = QueuePercentage;
|
||||
arg.queue_priority = Priority;
|
||||
arg.queue_priority = priority_map[Priority+3];
|
||||
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_UPDATE_QUEUE, &arg);
|
||||
if (err == -1)
|
||||
|
||||
Reference in New Issue
Block a user