drm/amdkfd: Add gws number to kfd topology node properties
Subsystems (3)
PATCH 1/7 drm/amdkfd: Add gws number to kfd topology node properties
Add amdgpu_amdkfd interface to get num_gws and add num_gws to /sys/class/kfd/kfd/topology/nodes/x/properties. Only report num_gws if MEC FW support GWS barriers. Currently it is determined by a environment variable which will be replaced with MEC FW version check when firmware is ready.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +++++ drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 5 +++++ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 1 + 6 files changed, 29 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +7 -0
@@ -544,6 +544,13 @@ uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct kgd_dev *kgd)return adev->rmmio_remap.bus_addr; } +uint32_t amdgpu_amdkfd_get_num_gws (struct kgd_dev *kgd) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)kgd; + +return adev->gds.gws_size; +} +int amdgpu_amdkfd_submit_ib (struct kgd_dev *kgd,enum kgd_engine_type engine,uint32_t vmid,uint64_t gpu_addr,uint32_t *ib_cmd,uint32_t ib_len)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
@@ -169,6 +169,7 @@ int amdgpu_amdkfd_get_dmabuf_info(struct kgd_dev *kgd, int dma_buf_fd,uint64_t amdgpu_amdkfd_get_vram_usage (struct kgd_dev *kgd);uint64_t amdgpu_amdkfd_get_hive_id (struct kgd_dev *kgd);uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr (struct kgd_dev *kgd); +uint32_t amdgpu_amdkfd_get_num_gws (struct kgd_dev *kgd);uint8_t amdgpu_amdkfd_get_xgmi_hops_count (struct kgd_dev *dst,struct kgd_dev *src);#define read_user_wptr (mmptr, wptr, dst) \
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10 -0
@@ -666,6 +666,16 @@ MODULE_PARM_DESC(noretry,int halt_if_hws_hang;module_param (halt_if_hws_hang, int,0644 );MODULE_PARM_DESC (halt_if_hws_hang,"Halt if HWS hang is detected (0 = off (default), 1 = on)" ); + +/** +* DOC: hws_gws_support(bool) +* Whether HWS support gws barriers. Default value: false (not supported) +* This will be replaced with a MEC firmware version check once firmware +* is ready +*/ +bool hws_gws_support; +module_param (hws_gws_support, bool,0444 ); +MODULE_PARM_DESC (hws_gws_support,"MEC FW support gws barriers (false = not supported (Default), true = supported)" );#endif /**
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +5 -0
@@ -160,6 +160,11 @@ extern int noretry;*/ extern int halt_if_hws_hang; +/* +* Whether MEC FW support GWS barriers +*/ +extern bool hws_gws_support; +enum cache_policy { cache_policy_coherent, cache_policy_noncoherent
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +5 -0
@@ -454,6 +454,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, dev->node_props.lds_size_in_kb);sysfs_show_32bit_prop (buffer,"gds_size_in_kb" , dev->node_props.gds_size_in_kb); +sysfs_show_32bit_prop (buffer,"num_gws" , + dev->node_props.num_gws);sysfs_show_32bit_prop (buffer,"wave_front_size" , dev->node_props.wave_front_size); sysfs_show_32bit_prop(buffer, "array_count",
@@ -1290,6 +1292,9 @@ int kfd_topology_add_device(struct kfd_dev *gpu) dev->node_props.num_sdma_engines = gpu->device_info->num_sdma_engines; dev->node_props.num_sdma_xgmi_engines = gpu->device_info->num_xgmi_sdma_engines; + dev->node_props.num_gws = (hws_gws_support && + dev->gpu->dqm->sched_policy !=KFD_SCHED_POLICY_NO_HWS ) ? +amdgpu_amdkfd_get_num_gws (dev->gpu->kgd) :0 ;kfd_fill_mem_clk_max_info (dev);kfd_fill_iolink_non_crat_info (dev);
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 -0
@@ -65,6 +65,7 @@ struct kfd_node_properties {uint32_t max_waves_per_simd;uint32_t lds_size_in_kb;uint32_t gds_size_in_kb; +uint32_t num_gws;uint32_t wave_front_size;uint32_t array_count;uint32_t simd_arrays_per_engine;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1557952664-12218-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org
PATCH 2/7 drm/amdgpu: Add interface to alloc gws from amdgpu
Add amdgpu_amdkfd interface to alloc and free gws
from amdgpu
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 34 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 ++ 2 files changed, 36 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +34 -0
@@ -339,6 +339,40 @@ void amdgpu_amdkfd_free_gtt_mem(struct kgd_dev *kgd, void *mem_obj)amdgpu_bo_unref (&(bo)); } +int amdgpu_amdkfd_alloc_gws (struct kgd_dev *kgd,size_t size, +void **mem_obj) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)kgd; +struct amdgpu_bo *bo =NULL ; +struct amdgpu_bo_param bp; +int r; + +memset (&bp,0 ,sizeof (bp)); + bp.size = size; + bp.byte_align =1 ; + bp.domain =AMDGPU_GEM_DOMAIN_GWS ; + bp.flags =AMDGPU_GEM_CREATE_NO_CPU_ACCESS ; + bp.type = ttm_bo_type_device; + bp.resv =NULL ; + + r =amdgpu_bo_create (adev, &bp, &bo); +if (r) { +dev_err (adev->dev, +"failed to allocate gws BO for amdkfd (%d)\n" , r); +return r; + } + + *mem_obj = bo; +return 0 ; +} + +void amdgpu_amdkfd_free_gws (struct kgd_dev *kgd,void *mem_obj) +{ +struct amdgpu_bo *bo = (struct amdgpu_bo *)mem_obj; + +amdgpu_bo_unref (&bo); +} +uint32_t amdgpu_amdkfd_get_fw_version (struct kgd_dev *kgd,enum kgd_engine_type type) {
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +2 -0
@@ -153,6 +153,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size, void **mem_obj, uint64_t *gpu_addr, void **cpu_ptr, bool mqd_gfx9);void amdgpu_amdkfd_free_gtt_mem (struct kgd_dev *kgd,void *mem_obj); +int amdgpu_amdkfd_alloc_gws (struct kgd_dev *kgd,size_t size,void **mem_obj); +void amdgpu_amdkfd_free_gws (struct kgd_dev *kgd,void *mem_obj);uint32_t amdgpu_amdkfd_get_fw_version (struct kgd_dev *kgd,enum kgd_engine_type type); void amdgpu_amdkfd_get_local_mem_info(struct kgd_dev *kgd,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/7 drm/amdkfd: Allocate gws on device initialization
In reply to a message not in the archiveOn device initialization, KFD allocates all (64) gws which is shared by all KFD processes.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 14 +++++++++++++- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +13 -1
@@ -553,6 +553,13 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, }else kfd->max_proc_per_quantum = hws_max_conc_proc; +/* Allocate global GWS that is shared by all KFD processes */ +if (hws_gws_support &&amdgpu_amdkfd_alloc_gws (kfd->kgd, +amdgpu_amdkfd_get_num_gws (kfd->kgd), &kfd->gws)) { +dev_err (kfd_device,"Could not allocate %d gws\n" , +amdgpu_amdkfd_get_num_gws (kfd->kgd)); + goto out; + }/* calculate max size of mqds needed for queues */ size = max_num_of_queues_per_device * kfd->device_info->mqd_size_aligned;
@@ -576,7 +583,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, false)) {dev_err (kfd_device,"Could not allocate %d bytes\n" , size); - goto out; + goto alloc_gtt_mem_failure; }dev_info (kfd_device,"Allocated %d bytes on gart\n" , size);
@@ -646,6 +653,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,kfd_gtt_sa_fini (kfd); kfd_gtt_sa_init_error:amdgpu_amdkfd_free_gtt_mem (kfd->kgd, kfd->gtt_mem); +alloc_gtt_mem_failure: +if (hws_gws_support) +amdgpu_amdkfd_free_gws (kfd->kgd, kfd->gws);dev_err (kfd_device,"device %x:%x NOT added due to errors\n" , kfd->pdev->vendor, kfd->pdev->device);
@@ -663,6 +673,8 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)kfd_doorbell_fini (kfd);kfd_gtt_sa_fini (kfd);amdgpu_amdkfd_free_gtt_mem (kfd->kgd, kfd->gtt_mem); +if (hws_gws_support) +amdgpu_amdkfd_free_gws (kfd->kgd, kfd->gws); }kfree (kfd);
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +3 -0
@@ -288,6 +288,9 @@ struct kfd_dev {/* Compute Profile ref. count */ atomic_t compute_profile; + +/* Global GWS resource shared b/t processes*/ +void *gws; };enum kfd_mempool {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/7 drm/amdkfd: Add function to set queue gws
In reply to a message not in the archiveAdd functions in process queue manager to set/get queue gws. Also set process's number of gws used. Currently only one queue in process can use and use all gws.
--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 +++ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 50 ++++++++++++++++++++++ 2 files changed, 56 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +6 -0
@@ -454,6 +454,9 @@ struct queue_properties {* * @device: The kfd device that created this queue. * +* @gws: Pointing to gws kgd_mem if this is a gws control queue; NULL +* otherwise. +* * This structure represents user mode compute queues. * It contains all the necessary data to handle such queues. *
@@ -475,6 +478,7 @@ struct queue {struct kfd_process *process;struct kfd_dev *device; +void *gws; };/*
@@ -868,6 +872,8 @@ int pqm_update_queue(struct process_queue_manager *pqm, unsigned int qid, struct queue_properties *p);int pqm_set_cu_mask (struct process_queue_manager *pqm,unsigned int qid,struct queue_properties *p); +int pqm_set_gws (struct process_queue_manager *pqm,unsigned int qid, +void *gws);struct kernel_queue *pqm_get_kernel_queue (struct process_queue_manager *pqm,unsigned int qid); int pqm_get_wave_state(struct process_queue_manager *pqm,
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +50 -0
62 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1557952664-12218-4-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 4/7] drm/amdkfd: Add function to set queue gws
Quoted 97 lines · Oak
Add functions in process queue manager to set/get queue gws. Also set process's number of gws used. Currently only one queue in process can use and use all gws.
Change-Id I03e480c8692db3eabfc3a188cce8904d5d962ab7Signed-off-by Oak Zeng <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 +++ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 50 ++++++++++++++++++++++ 2 files changed, 56 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_priv.h +6
-0@@ -454,6 +454,9 @@ struct queue_properties {* * @device: The kfd device that created this queue. * +* @gws: Pointing to gws kgd_mem if this is a gws control queue; NULL +* otherwise. +* * This structure represents user mode compute queues. * It contains all the necessary data to handle such queues. * @@ -475,6 +478,7 @@ struct queue {struct kfd_process *process;struct kfd_dev *device; +void *gws; };/* @@ -868,6 +872,8 @@ int pqm_update_queue(struct process_queue_manager *pqm, unsigned int qid, struct queue_properties *p);int pqm_set_cu_mask (struct process_queue_manager *pqm,unsigned int qid,struct queue_properties *p); +int pqm_set_gws (struct process_queue_manager *pqm,unsigned int qid, +void *gws);struct kernel_queue *pqm_get_kernel_queue (struct process_queue_manager *pqm,unsigned int qid); int pqm_get_wave_state(struct process_queue_manager *pqm,drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +39
-0@@ -26,6 +26,7 @@#include "kfd_device_queue_manager.h" #include "kfd_priv.h" #include "kfd_kernel_queue.h" +#include "amdgpu_amdkfd.h" static inline struct process_queue_node *get_queue_by_qid (struct process_queue_manager *pqm,unsigned int qid)@@ -74,6 +75,55 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) pdd->already_dequeued = true; } +int pqm_set_gws (struct process_queue_manager *pqm,unsigned int qid, +void *gws) +{ +struct kfd_dev *dev =NULL ; +struct process_queue_node *pqn; +struct kfd_process_device *pdd; + + pqn =get_queue_by_qid (pqm, qid); +if (!pqn) { +pr_err ("Queue id does not match any known queue\n" ); +return -EINVAL ; + } + +if (pqn->q) + dev = pqn->q->device; +if (WARN_ON (!dev)) +return -ENODEV ; + + pdd =kfd_get_process_device_data (dev, pqm->process); +if (!pdd) { +pr_err ("Process device data doesn't exist\n" ); +return -EINVAL ; + } + +/* Only allow one queue per process can have GWS assigned */ +list_for_each_entry (pqn, &pqm->queues, process_queue_list) { +if (pqn->q && pqn->q->gws) +return -EINVAL ; + } + + pqn->q->gws = gws; + pdd->qpd.num_gws = gws ?amdgpu_amdkfd_get_num_gws (dev->kgd) :0 ; +return 0 ; +} + +static void *pqm_get_gws (struct process_queue_manager *pqm,unsigned int qid) +{ +struct process_queue_node *pqn;
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) · line 125
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +10
-0+ + pqn =get_queue_by_qid (pqm, qid); +if (!pqn) { +pr_debug ("No queue %d exists for get gws operation\n" , qid); +return NULL ; + } + +return pqn->q->gws; +} +
This is an unused static function. That will probably generate a compiler warning. Maybe this hunk from patch #6 should be moved to this patch. Then you'll also need to reorder patch 5 before this one, or leave out the call for amdgpu_amdkfd_remove_gws_from_process until patch #6:
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +6 -0
@@ -363,6 +363,12 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)return -1 ; } +if (pqm_get_gws (pqm, qid)) { +amdgpu_amdkfd_remove_gws_from_process (pqm->process->kgd_process_info, +pqm_get_gws (pqm, qid)); +pqm_set_gws (pqm, qid,NULL ); + } +if (pqn->kq) {/* destroy kernel queue (DIQ) */ dqm = pqn->kq->dev->dqm;
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) · line 129
Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1
-0+void kfd_process_dequeue_from_all_devices (struct kfd_process *p) {struct kfd_process_device *pdd;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 4/7] drm/amdkfd: Add function to set queue gws
In reply to a message not in the archiveQuoted 81 lines · Oak
Add functions in process queue manager to set/get queue gws. Also set process's number of gws used. Currently only one queue in process can use and use all gws.
Change-Id I03e480c8692db3eabfc3a188cce8904d5d962ab7Signed-off-by Oak Zeng <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 +++ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 50 ++++++++++++++++++++++ 2 files changed, 56 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_priv.h +6
-0@@ -454,6 +454,9 @@ struct queue_properties {* * @device: The kfd device that created this queue. * +* @gws: Pointing to gws kgd_mem if this is a gws control queue; NULL +* otherwise. +* * This structure represents user mode compute queues. * It contains all the necessary data to handle such queues. * @@ -475,6 +478,7 @@ struct queue {struct kfd_process *process;struct kfd_dev *device; +void *gws; };/* @@ -868,6 +872,8 @@ int pqm_update_queue(struct process_queue_manager *pqm, unsigned int qid, struct queue_properties *p);int pqm_set_cu_mask (struct process_queue_manager *pqm,unsigned int qid,struct queue_properties *p); +int pqm_set_gws (struct process_queue_manager *pqm,unsigned int qid, +void *gws);struct kernel_queue *pqm_get_kernel_queue (struct process_queue_manager *pqm,unsigned int qid); int pqm_get_wave_state(struct process_queue_manager *pqm,drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +23
-0@@ -26,6 +26,7 @@#include "kfd_device_queue_manager.h" #include "kfd_priv.h" #include "kfd_kernel_queue.h" +#include "amdgpu_amdkfd.h" static inline struct process_queue_node *get_queue_by_qid (struct process_queue_manager *pqm,unsigned int qid)@@ -74,6 +75,55 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) pdd->already_dequeued = true; } +int pqm_set_gws (struct process_queue_manager *pqm,unsigned int qid, +void *gws) +{ +struct kfd_dev *dev =NULL ; +struct process_queue_node *pqn; +struct kfd_process_device *pdd; + + pqn =get_queue_by_qid (pqm, qid); +if (!pqn) { +pr_err ("Queue id does not match any known queue\n" ); +return -EINVAL ; + } + +if (pqn->q) + dev = pqn->q->device; +if (WARN_ON (!dev)) +return -ENODEV ; + + pdd =kfd_get_process_device_data (dev, pqm->process); +if (!pdd) { +pr_err ("Process device data doesn't exist\n" ); +return -EINVAL ;
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) · line 109
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +10
-0+ } + +/* Only allow one queue per process can have GWS assigned */ +list_for_each_entry (pqn, &pqm->queues, process_queue_list) { +if (pqn->q && pqn->q->gws) +return -EINVAL ; + } + + pqn->q->gws = gws; + pdd->qpd.num_gws = gws ?amdgpu_amdkfd_get_num_gws (dev->kgd) :0 ;
You'll have to call pqn->q->device->dqm->ops.update_queue somewhere, to make sure the runlist gets updated with the new GWS parameters. See pqm_update_queue or pqm_set_cu_mask for reference.
Regards,
Felix
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +10
-0+return 0 ; +} + +static void *pqm_get_gws (struct process_queue_manager *pqm,unsigned int qid) +{ +struct process_queue_node *pqn; + + pqn =get_queue_by_qid (pqm, qid); +if (!pqn) { +pr_debug ("No queue %d exists for get gws operation\n" , qid);
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) · line 129
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +7
-0+return NULL ; + } + +return pqn->q->gws; +} + +void kfd_process_dequeue_from_all_devices (struct kfd_process *p) {struct kfd_process_device *pdd;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/7 drm/amdgpu: Add function to add/remove gws to kfd process
In reply to a message not in the archiveGWS bo is shared between all kfd processes. Add function to add gws to kfd process's bo list so gws can be evicted from and restored for process.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 103 +++++++++++++++++++++-- 2 files changed, 100 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +2 -0
@@ -155,6 +155,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,void amdgpu_amdkfd_free_gtt_mem (struct kgd_dev *kgd,void *mem_obj);int amdgpu_amdkfd_alloc_gws (struct kgd_dev *kgd,size_t size,void **mem_obj);void amdgpu_amdkfd_free_gws (struct kgd_dev *kgd,void *mem_obj); +int amdgpu_amdkfd_add_gws_to_process (void *info,void *gws,struct kgd_mem **mem); +int amdgpu_amdkfd_remove_gws_from_process (void *info,void *mem);uint32_t amdgpu_amdkfd_get_fw_version (struct kgd_dev *kgd,enum kgd_engine_type type); void amdgpu_amdkfd_get_local_mem_info(struct kgd_dev *kgd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +98 -5
125 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1557952664-12218-5-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 5/7] drm/amdgpu: Add function to add/remove gws to kfd process
Quoted 93 lines · Oak
GWS bo is shared between all kfd processes. Add function to add gws to kfd process's bo list so gws can be evicted from and restored for process.
Change-Id I75d74cfdadb7075ff8b2b68634e205deb73dc1eaSigned-off-by Oak Zeng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 103 +++++++++++++++++++++-- 2 files changed, 100 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +2
-0@@ -155,6 +155,8 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,void amdgpu_amdkfd_free_gtt_mem (struct kgd_dev *kgd,void *mem_obj);int amdgpu_amdkfd_alloc_gws (struct kgd_dev *kgd,size_t size,void **mem_obj);void amdgpu_amdkfd_free_gws (struct kgd_dev *kgd,void *mem_obj); +int amdgpu_amdkfd_add_gws_to_process (void *info,void *gws,struct kgd_mem **mem); +int amdgpu_amdkfd_remove_gws_from_process (void *info,void *mem);uint32_t amdgpu_amdkfd_get_fw_version (struct kgd_dev *kgd,enum kgd_engine_type type); void amdgpu_amdkfd_get_local_mem_info(struct kgd_dev *kgd,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +34
-5@@ -457,6 +457,17 @@ static void add_kgd_mem_to_kfd_bo_list(struct kgd_mem *mem,mutex_unlock (&process_info->lock); } +static void remove_kgd_mem_from_kfd_bo_list (struct kgd_mem *mem, +struct amdkfd_process_info *process_info) +{ +struct ttm_validate_buffer *bo_list_entry; + + bo_list_entry = &mem->validate_list; +mutex_lock (&process_info->lock); +list_del (&bo_list_entry->head); +mutex_unlock (&process_info->lock); +} +/* Initializes user pages. It registers the MMU notifier and validates * the userptr BO in the GTT domain. * @@ -1183,12 +1194,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(if (user_addr) { ret =init_user_pages (*mem, current->mm, user_addr); -if (ret) { -mutex_lock (&avm->process_info->lock); -list_del (&(*mem)->validate_list.head); -mutex_unlock (&avm->process_info->lock); +if (ret) goto allocate_init_user_pages_failed; - } }if (offset)@@ -1197,6 +1204,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(return 0 ; allocate_init_user_pages_failed: +remove_kgd_mem_from_kfd_bo_list (*mem, avm->process_info);amdgpu_bo_unref (&bo);/* Don't unreserve system mem limit twice */ goto err_reserve_limit;@@ -2104,3 +2112,88 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef)kfree (pd_bo_list);return ret; } + +int amdgpu_amdkfd_add_gws_to_process (void *info,void *gws,struct kgd_mem **mem) +{ +struct amdkfd_process_info *process_info = (struct amdkfd_process_info *)info; +struct amdgpu_bo *gws_bo = (struct amdgpu_bo *)gws; +int ret; + +if (!info || !gws) +return -EINVAL ; + + *mem =kzalloc (sizeof (struct kgd_mem ),GFP_KERNEL ); +if (!*mem) +return -EINVAL ; + +mutex_init (&(*mem)->lock); + (*mem)->bo =amdgpu_bo_ref (gws_bo); + (*mem)->domain =AMDGPU_GEM_DOMAIN_GWS ; + (*mem)->process_info = process_info; +add_kgd_mem_to_kfd_bo_list (*mem, process_info, false); +amdgpu_sync_create (&(*mem)->sync); +
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) · line 2145
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +10
-0+ +/* Validate gws bo the first time it is added to process */ +mutex_lock (&(*mem)->process_info->lock); + ret =amdgpu_bo_reserve (gws_bo, false); +if (unlikely (ret)) { +pr_err ("Reserve gws bo failed %d\n" , ret); + goto bo_reservation_failure; + } + + ret =amdgpu_amdkfd_bo_validate (gws_bo,AMDGPU_GEM_DOMAIN_GWS , false);
We may have to wait here (the third parameter controls this). For other BOs I think we don't wait on validate because the wait would happen when the memory is mapped to GPUVM. But the GWS BO is never mapped to GPUVM. So we probably have to wait here.
Regards,
Felix
Quoted 44 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +44
-0+if (ret) { +pr_err ("GWS BO validate failed %d\n" , ret); + goto bo_validation_failure; + } +/* GWS resource is shared b/t amdgpu and amdkfd +* Add process eviction fence to bo so they can +* evict each other. +*/ +amdgpu_bo_fence (gws_bo, &process_info->eviction_fence->base, true); +amdgpu_bo_unreserve (gws_bo); +mutex_unlock (&(*mem)->process_info->lock); + +return ret; + +bo_validation_failure: +amdgpu_bo_unreserve (gws_bo); +bo_reservation_failure: +mutex_unlock (&(*mem)->process_info->lock); +amdgpu_sync_free (&(*mem)->sync); +remove_kgd_mem_from_kfd_bo_list (*mem, process_info); +amdgpu_bo_unref (&gws_bo); +mutex_destroy (&(*mem)->lock); +kfree (*mem); + *mem =NULL ; +return ret; +} + +int amdgpu_amdkfd_remove_gws_from_process (void *info,void *mem) +{ +int ret; +struct amdkfd_process_info *process_info = (struct amdkfd_process_info *)info; +struct kgd_mem *kgd_mem = (struct kgd_mem *)mem; +struct amdgpu_bo *gws_bo = kgd_mem->bo; + +/* Remove BO from process's validate list so restore worker won't touch +* it anymore +*/ +remove_kgd_mem_from_kfd_bo_list (kgd_mem, process_info); + + ret =amdgpu_bo_reserve (gws_bo, false); +if (unlikely (ret)) { +pr_err ("Reserve gws bo failed %d\n" , ret); +//TODO add BO back to validate_list? +return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) · line 2199
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +10
-0+ } +amdgpu_amdkfd_remove_eviction_fence (gws_bo, + process_info->eviction_fence); +amdgpu_bo_unreserve (gws_bo); +amdgpu_sync_free (&kgd_mem->sync); +amdgpu_bo_unref (&gws_bo); +mutex_destroy (&kgd_mem->lock); +kfree (mem); +return 0 ; +}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/7 drm/amdkfd: New IOCTL to allocate queue GWS
In reply to a message not in the archiveAdd a new kfd ioctl to allocate queue GWS. Queue
GWS is released on queue destroy.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 39 ++++++++++++++++++++++ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 6 ++++ include/uapi/linux/kfd_ioctl.h | 20 ++++++++++- 3 files changed, 64 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +39 -0
@@ -1559,6 +1559,43 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,return err; } +static int kfd_ioctl_alloc_queue_gws (struct file *filep, +struct kfd_process *p,void *data) +{ +int retval; +struct kfd_ioctl_alloc_queue_gws_args *args = data; +struct kfd_dev *dev =NULL ; +struct kgd_mem *mem; + +if (args->num_gws ==0 ) +return -EINVAL ; + +if (!hws_gws_support || + dev->dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS ) +return -EINVAL ; + + dev =kfd_device_by_id (args->gpu_id); +if (!dev) { +pr_debug ("Could not find gpu id 0x%x\n" , args->gpu_id); +return -EINVAL ; + } + + retval =amdgpu_amdkfd_add_gws_to_process (p->kgd_process_info, + dev->gws, &mem); +if (unlikely (retval)) +return retval; + +mutex_lock (&p->mutex); + retval =pqm_set_gws (&p->pqm, args->queue_id, mem); +mutex_unlock (&p->mutex); + +if (unlikely (retval)) +amdgpu_amdkfd_remove_gws_from_process (p->kgd_process_info, mem); + + args->first_gws =0 ; +return retval; +} +static int kfd_ioctl_get_dmabuf_info (struct file *filep,struct kfd_process *p,void *data) {
@@ -1761,6 +1798,8 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {AMDKFD_IOCTL_DEF (AMDKFD_IOC_IMPORT_DMABUF , kfd_ioctl_import_dmabuf,0 ), +AMDKFD_IOCTL_DEF (AMDKFD_IOC_ALLOC_QUEUE_GWS , + kfd_ioctl_alloc_queue_gws, 0), };#define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +6 -0
@@ -363,6 +363,12 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)return -1 ; } +if (pqm_get_gws (pqm, qid)) { +amdgpu_amdkfd_remove_gws_from_process (pqm->process->kgd_process_info, +pqm_get_gws (pqm, qid)); +pqm_set_gws (pqm, qid,NULL ); + } +if (pqn->kq) {/* destroy kernel queue (DIQ) */ dqm = pqn->kq->dev->dqm;
include/uapi/linux/kfd_ioctl.h +19 -1
@@ -410,6 +410,21 @@ struct kfd_ioctl_unmap_memory_from_gpu_args {__u32 n_success;/* to/from KFD */ }; +/* Allocate GWS for specific queue +* +* @gpu_id: device identifier +* @queue_id: queue's id that GWS is allocated for +* @num_gws: how many GWS to allocate +* @first_gws: index of the first GWS allocated. +* only support contiguous GWS allocation +*/ +struct kfd_ioctl_alloc_queue_gws_args { +__u32 gpu_id;/* to KFD */ +__u32 queue_id;/* to KFD */ +__u32 num_gws;/* to KFD */ +__u32 first_gws;/* from KFD */ +}; +struct kfd_ioctl_get_dmabuf_info_args {__u64 size;/* from KFD */ __u64 metadata_ptr;/* to KFD */
@@ -529,7 +544,10 @@ enum kfd_mmio_remap {#define AMDKFD_IOC_IMPORT_DMABUF \ AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args) +#define AMDKFD_IOC_ALLOC_QUEUE_GWS \ + AMDKFD_IOWR(0x22, struct kfd_ioctl_alloc_queue_gws_args) +#define AMDKFD_COMMAND_START 0x01 -#define AMDKFD_COMMAND_END 0x1E +#define AMDKFD_COMMAND_END 0x23#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1557952664-12218-6-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 6/7] drm/amdkfd: New IOCTL to allocate queue GWS
Quoted 114 lines · Oak
[CAUTION: External Email]
Add a new kfd ioctl to allocate queue GWS. Queue
GWS is released on queue destroy.Change-Id I60153c26a577992ad873e4292e759e5c3d5bbd15Signed-off-by Oak Zeng <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 39 ++++++++++++++++++++++ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 6 ++++ include/uapi/linux/kfd_ioctl.h | 20 ++++++++++- 3 files changed, 64 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +39
-0@@ -1559,6 +1559,43 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,return err; } +static int kfd_ioctl_alloc_queue_gws (struct file *filep, +struct kfd_process *p,void *data) +{ +int retval; +struct kfd_ioctl_alloc_queue_gws_args *args = data; +struct kfd_dev *dev =NULL ; +struct kgd_mem *mem; + +if (args->num_gws ==0 ) +return -EINVAL ; + +if (!hws_gws_support || + dev->dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS ) +return -EINVAL ; + + dev =kfd_device_by_id (args->gpu_id); +if (!dev) { +pr_debug ("Could not find gpu id 0x%x\n" , args->gpu_id); +return -EINVAL ; + } + + retval =amdgpu_amdkfd_add_gws_to_process (p->kgd_process_info, + dev->gws, &mem); +if (unlikely (retval)) +return retval; + +mutex_lock (&p->mutex); + retval =pqm_set_gws (&p->pqm, args->queue_id, mem); +mutex_unlock (&p->mutex); + +if (unlikely (retval)) +amdgpu_amdkfd_remove_gws_from_process (p->kgd_process_info, mem); + + args->first_gws =0 ; +return retval; +} +static int kfd_ioctl_get_dmabuf_info (struct file *filep,struct kfd_process *p,void *data) {@@ -1761,6 +1798,8 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {AMDKFD_IOCTL_DEF (AMDKFD_IOC_IMPORT_DMABUF , kfd_ioctl_import_dmabuf,0 ), +AMDKFD_IOCTL_DEF (AMDKFD_IOC_ALLOC_QUEUE_GWS , + kfd_ioctl_alloc_queue_gws, 0), };#define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls)drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +6
-0@@ -363,6 +363,12 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)return -1 ; } +if (pqm_get_gws (pqm, qid)) { +amdgpu_amdkfd_remove_gws_from_process (pqm->process->kgd_process_info, +pqm_get_gws (pqm, qid)); +pqm_set_gws (pqm, qid,NULL ); + } +if (pqn->kq) {/* destroy kernel queue (DIQ) */ dqm = pqn->kq->dev->dqm;include/uapi/linux/kfd_ioctl.h +15
-0@@ -410,6 +410,21 @@ struct kfd_ioctl_unmap_memory_from_gpu_args {__u32 n_success;/* to/from KFD */ }; +/* Allocate GWS for specific queue +* +* @gpu_id: device identifier +* @queue_id: queue's id that GWS is allocated for +* @num_gws: how many GWS to allocate +* @first_gws: index of the first GWS allocated. +* only support contiguous GWS allocation +*/ +struct kfd_ioctl_alloc_queue_gws_args { +__u32 gpu_id;/* to KFD */ +__u32 queue_id;/* to KFD */ +__u32 num_gws;/* to KFD */ +__u32 first_gws;/* from KFD */ +}; +struct kfd_ioctl_get_dmabuf_info_args {__u64 size;/* from KFD */ __u64 metadata_ptr;/* to KFD */
include/uapi/linux/kfd_ioctl.h enum kfd_mmio_remap { · line 549
Quoted 6 lines
include/uapi/linux/kfd_ioctl.h +3
-0@@ -529,7 +544,10 @@ enum kfd_mmio_remap {#define AMDKFD_IOC_IMPORT_DMABUF \ AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args) +#define AMDKFD_IOC_ALLOC_QUEUE_GWS \ + AMDKFD_IOWR(0x22, struct kfd_ioctl_alloc_queue_gws_args) +
This has to be 0x1E for upstream. When we merge this back into amd-kfd-staging, we'll have to move the other non-upstream ioctl numbers.
include/uapi/linux/kfd_ioctl.h enum kfd_mmio_remap { · line 551
Quoted 3 lines
include/uapi/linux/kfd_ioctl.h +1
-1#define AMDKFD_COMMAND_START 0x01 -#define AMDKFD_COMMAND_END 0x1E +#define AMDKFD_COMMAND_END 0x23
0x1F
Regards,
Felix
Quoted 9 lines
include/uapi/linux/kfd_ioctl.h +0
-1#endif --2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/7 drm/amdkfd: PM4 packets change to support GWS
In reply to a message not in the archiveAdd a field in map_queues packet to indicate whether this is a gws control queue. Only one queue per process can be gws control queue. Change num_gws field in map_process packet to 7 bits
--- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_ai.h | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1 -0
@@ -159,6 +159,7 @@ static int pm_map_queues_v9(struct packet_manager *pm, uint32_t *buffer, packet->bitfields2.engine_sel = engine_sel__mes_map_queues__compute_vi; + packet->bitfields2.gws_control_queue = q->gws ?1 :0 ; packet->bitfields2.queue_type = queue_type__mes_map_queues__normal_compute_vi;
drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers_ai.h +4 -3
@@ -176,8 +176,7 @@ struct pm4_mes_map_process {union {struct { -uint32_t num_gws:6 ; -uint32_t reserved7:1 ; +uint32_t num_gws:7 ;uint32_t sdma_enable:1 ;uint32_t num_oac:4 ;uint32_t reserved8:4 ;
@@ -272,7 +271,9 @@ struct pm4_mes_map_queues {struct {uint32_t reserved1:4 ;enum mes_map_queues_queue_sel_enum queue_sel:2 ; -uint32_t reserved2:15 ; +uint32_t reserved5:6 ; +uint32_t gws_control_queue:1 ; +uint32_t reserved2:8 ;enum mes_map_queues_queue_type_enum queue_type:3 ;uint32_t reserved3:2 ;enum mes_map_queues_engine_sel_enum engine_sel:3 ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines · Oak
Add
amdgpu_amdkfdinterface to getnum_gwsand addnum_gwsto/sys/class/kfd/kfd/topology/nodes/x/properties. Only reportnum_gwsif MEC FW support GWS barriers. Currently it is determined by a environment variable which will be replaced
It's not an environment variable, it's a module parameter. With that fixed, the patch is Reviewed-by: Felix Kuehling <[email protected]>
Patches 2, 3, 7 are also Reviewed-by: Felix Kuehling <[email protected]>. I replied with comments on patches 4, 5, 6.
Regards,
Felix
Quoted 108 lines
with MEC FW version check when firmware is ready.
Change-Id Ie0d00fb20a37ef2856860dbecbe1ad0ca1ef09f7Signed-off-by Oak Zeng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +++++ drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 5 +++++ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 1 + 6 files changed, 29 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +7
-0@@ -544,6 +544,13 @@ uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct kgd_dev *kgd)return adev->rmmio_remap.bus_addr; } +uint32_t amdgpu_amdkfd_get_num_gws (struct kgd_dev *kgd) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)kgd; + +return adev->gds.gws_size; +} +int amdgpu_amdkfd_submit_ib (struct kgd_dev *kgd,enum kgd_engine_type engine,uint32_t vmid,uint64_t gpu_addr,uint32_t *ib_cmd,uint32_t ib_len)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1
-0@@ -169,6 +169,7 @@ int amdgpu_amdkfd_get_dmabuf_info(struct kgd_dev *kgd, int dma_buf_fd,uint64_t amdgpu_amdkfd_get_vram_usage (struct kgd_dev *kgd);uint64_t amdgpu_amdkfd_get_hive_id (struct kgd_dev *kgd);uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr (struct kgd_dev *kgd); +uint32_t amdgpu_amdkfd_get_num_gws (struct kgd_dev *kgd);uint8_t amdgpu_amdkfd_get_xgmi_hops_count (struct kgd_dev *dst,struct kgd_dev *src);#define read_user_wptr (mmptr, wptr, dst) \drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10
-0@@ -666,6 +666,16 @@ MODULE_PARM_DESC(noretry,int halt_if_hws_hang;module_param (halt_if_hws_hang, int,0644 );MODULE_PARM_DESC (halt_if_hws_hang,"Halt if HWS hang is detected (0 = off (default), 1 = on)" ); + +/** +* DOC: hws_gws_support(bool) +* Whether HWS support gws barriers. Default value: false (not supported) +* This will be replaced with a MEC firmware version check once firmware +* is ready +*/ +bool hws_gws_support; +module_param (hws_gws_support, bool,0444 ); +MODULE_PARM_DESC (hws_gws_support,"MEC FW support gws barriers (false = not supported (Default), true = supported)" );#endif /** drivers/gpu/drm/amd/amdkfd/kfd_priv.h +5
-0@@ -160,6 +160,11 @@ extern int noretry;*/ extern int halt_if_hws_hang; +/* +* Whether MEC FW support GWS barriers +*/ +extern bool hws_gws_support; +enum cache_policy { cache_policy_coherent, cache_policy_noncoherentdrivers/gpu/drm/amd/amdkfd/kfd_topology.c +5
-0@@ -454,6 +454,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, dev->node_props.lds_size_in_kb);sysfs_show_32bit_prop (buffer,"gds_size_in_kb" , dev->node_props.gds_size_in_kb); +sysfs_show_32bit_prop (buffer,"num_gws" , + dev->node_props.num_gws);sysfs_show_32bit_prop (buffer,"wave_front_size" , dev->node_props.wave_front_size); sysfs_show_32bit_prop(buffer, "array_count",@@ -1290,6 +1292,9 @@ int kfd_topology_add_device(struct kfd_dev *gpu) dev->node_props.num_sdma_engines = gpu->device_info->num_sdma_engines; dev->node_props.num_sdma_xgmi_engines = gpu->device_info->num_xgmi_sdma_engines; + dev->node_props.num_gws = (hws_gws_support && + dev->gpu->dqm->sched_policy !=KFD_SCHED_POLICY_NO_HWS ) ? +amdgpu_amdkfd_get_num_gws (dev->gpu->kgd) :0 ;kfd_fill_mem_clk_max_info (dev);kfd_fill_iolink_non_crat_info (dev);drivers/gpu/drm/amd/amdkfd/kfd_topology.h +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_topology.h struct kfd_node_properties { · line 71
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1
-0@@ -65,6 +65,7 @@ struct kfd_node_properties {uint32_t max_waves_per_simd;uint32_t lds_size_in_kb;uint32_t gds_size_in_kb; +uint32_t num_gws;uint32_t wave_front_size;uint32_t array_count;uint32_t simd_arrays_per_engine;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx