Add interface to set CU mask
Signed-off-by: Flora Cui <flora.cui@amd.com> Acked-by: Ben Goz <ben.goz@amd.com>
This commit is contained in:
@@ -318,6 +318,18 @@ hsaKmtDestroyQueue(
|
||||
HSA_QUEUEID QueueId //IN
|
||||
);
|
||||
|
||||
/**
|
||||
Set cu mask for a queue
|
||||
*/
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtSetQueueCUMask(
|
||||
HSA_QUEUEID QueueId, //IN
|
||||
HSAuint32 CUMaskCount, //IN
|
||||
HSAuint32* QueueCUMask //IN
|
||||
);
|
||||
|
||||
/**
|
||||
Allows an HSA process to set/change the default and alternate memory coherency, before starting to dispatch.
|
||||
*/
|
||||
|
||||
@@ -75,6 +75,12 @@ struct kfd_ioctl_update_queue_args {
|
||||
uint32_t queue_priority; /* to KFD */
|
||||
};
|
||||
|
||||
struct kfd_ioctl_set_cu_mask_args {
|
||||
uint32_t queue_id; /* to KFD */
|
||||
uint32_t num_cu_mask; /* to KFD */
|
||||
uint64_t cu_mask_ptr; /* to KFD */
|
||||
};
|
||||
|
||||
/* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */
|
||||
#define KFD_IOC_CACHE_POLICY_COHERENT 0
|
||||
#define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
|
||||
@@ -339,8 +345,10 @@ struct kfd_ioctl_open_graphic_handle_args {
|
||||
#define AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH \
|
||||
AMDKFD_IOWR(0x16, struct kfd_ioctl_alloc_memory_of_gpu_args)
|
||||
|
||||
#define AMDKFD_IOC_SET_CU_MASK \
|
||||
AMDKFD_IOW(0x17, struct kfd_ioctl_set_cu_mask_args)
|
||||
|
||||
#define AMDKFD_COMMAND_START 0x01
|
||||
#define AMDKFD_COMMAND_END 0x17
|
||||
#define AMDKFD_COMMAND_END 0x18
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@ hsaKmtWaitOnMultipleEvents;
|
||||
hsaKmtCreateQueue;
|
||||
hsaKmtUpdateQueue;
|
||||
hsaKmtDestroyQueue;
|
||||
hsaKmtSetQueueCUMask;
|
||||
hsaKmtSetMemoryPolicy;
|
||||
hsaKmtAllocMemory;
|
||||
hsaKmtFreeMemory;
|
||||
|
||||
@@ -339,3 +339,33 @@ hsaKmtDestroyQueue(
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtSetQueueCUMask(
|
||||
HSA_QUEUEID QueueId, //IN
|
||||
HSAuint32 CUMaskCount, //IN
|
||||
HSAuint32* QueueCUMask //IN
|
||||
)
|
||||
{
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(QueueId);
|
||||
struct kfd_ioctl_set_cu_mask_args args;
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
if (CUMaskCount == 0 || QueueCUMask == NULL)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.queue_id = q->queue_id;
|
||||
args.num_cu_mask = CUMaskCount;
|
||||
args.cu_mask_ptr = (uintptr_t)QueueCUMask;
|
||||
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_SET_CU_MASK, &args);
|
||||
if (err == -1)
|
||||
{
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
}
|
||||
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user