drm/amdkfd: Adjust function sequences to avoid unnecessary declarations
Subsystems (3)
PATCH 1/3 drm/amdkfd: Adjust function sequences to avoid unnecessary declarations
This is cleaner.
--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +7 -12
@@ -26,18 +26,6 @@#include "kfd_pm4_headers_ai.h" #include "kfd_pm4_opcodes.h" -static bool initialize_v9 (struct kernel_queue *kq,struct kfd_dev *dev, -enum kfd_queue_type type,unsigned int queue_size); -static void uninitialize_v9 (struct kernel_queue *kq); -static void submit_packet_v9 (struct kernel_queue *kq); - -void kernel_queue_init_v9 (struct kernel_queue_ops *ops) -{ - ops->initialize = initialize_v9; - ops->uninitialize = uninitialize_v9; - ops->submit_packet = submit_packet_v9; -} -static bool initialize_v9 (struct kernel_queue *kq,struct kfd_dev *dev,enum kfd_queue_type type,unsigned int queue_size) {
@@ -67,6 +55,13 @@ static void submit_packet_v9(struct kernel_queue *kq) kq->pending_wptr64); } +void kernel_queue_init_v9 (struct kernel_queue_ops *ops) +{ + ops->initialize = initialize_v9; + ops->uninitialize = uninitialize_v9; + ops->submit_packet = submit_packet_v9; +} +static int pm_map_process_v9 (struct packet_manager *pm,uint32_t *buffer,struct qcm_process_device *qpd) {
Signature · 6 lines
2.17.1 _______________________________________________ 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): [email protected]
PATCH 2/3 drm/amdkfd: only keep release_mem function for Hawaii
release_mem won't be used at all on GFX9 and GFX10, so delete it.
--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2 -33
@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,
@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2 -31
@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,
@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
Signature · 6 lines
2.17.1 _______________________________________________ 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): [email protected]
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?
Regards,
Felix
Quoted 111 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
_______________________________________________
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): 31102345-20f7-1b0e-dd2a-f7984b253a07-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Felix,
That's because v8 and v7 share the same packet_manager_funcs. In this case, it is better to keep it as it is.
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?
Regards,
Felix
Quoted 111 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
_______________________________________________
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): DM6PR12MB2778C141CFEA0006DA2CEC6DF0780-lmeGfMZKVrFSet88YzIdmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
I think that the versioning is getting a little confusing since we're using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we'll keep having these questions of "why is Hawaii GFX8", "why is Arcturus GFX9", etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Felix,
That's because v8 and v7 share the same packet_manager_funcs. In this case, it is better to keep it as it is.
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]<mailto:[email protected]>>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?
Regards,
Felix
Quoted 111 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]<mailto:[email protected]>>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
_______________________________________________
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): CY4PR1201MB2533087B346C4619F461FF3185780-1iTaO6aE1DCmssYNuJz6EmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Felix,
That's because v8 and v7 share the same packet_manager_funcs. In this case, it is better to keep it as it is.
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]<mailto:[email protected]>>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?
Regards,
Felix
Quoted 111 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]<mailto:[email protected]>>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
_______________________________________________
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): 41a6b535-ab7a-44f4-2899-f211f5ddc296-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
Regards,
Felix
On 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Felix,
That's because v8 and v7 share the same packet_manager_funcs. In this case, it is better to keep it as it is.
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]<mailto:[email protected]>>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?
Regards,
Felix
Quoted 111 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]<mailto:[email protected]>>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
_______________________________________________
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): 85fd399c-5fa9-bdef-cdf6-433e80ba6407-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
That makes sense, Felix.
My big issue is that if I am looking for Hawaii, I go to gfx7, I don’t look in gfx8. And then I have to search the git history to see if it was a mistake, or intentional. As it stands, the consolidation of code is just going to make things more confusing in the end when it comes to functions like this where GFX versions are not respected, which I think is what Felix is trying to get at. If the GFX name is in the function, it should apply to all ASICs in that GFX family.
I understand that it can help to avoid issues where a bugfix goes into one gfx* file and is missed in the other (which might be the impetus for your cleanup efforts), but that’s mostly on the dev to do properly. Otherwise anyone who is even reasonably new to the code is going to be completely confused, which is something we want to avoid. Even those who are working on the code daily will be chasing ghosts looking in the “wrong” gfx* files/functions trying to figure out what’s happening.
All I want is clarity and consistency. If we’re using the GFX versions for naming, then let’s keep the functions and definitions correct, at the cost of duplicated code, because accuracy is key. Might mean we have to undo some of Yong’s consolidation, but if the end result is correct and easily-understood code, then it’s worth it.
Kent
From: Kuehling, Felix <[email protected]>
Sent: Thursday, November 7, 2019 12:47 PM
To: Zhao, Yong <[email protected]>; Russell, Kent <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
Regards,
Felix
On 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Felix,
That's because v8 and v7 share the same packet_manager_funcs. In this case, it is better to keep it as it is.
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]<mailto:[email protected]>>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?
Regards,
Felix
Quoted 111 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]<mailto:[email protected]>>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
In reply to a message not in the archiveQuoted 6 lines · Felix
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g., amdgpu_uvd.c amdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:
static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_ring_test_ring,
.test_ib = amdgpu_uvd_ring_test_ib, .insert_nop = uvd_v7_0_ring_insert_nop, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = amdgpu_uvd_ring_begin_use, .end_use = amdgpu_uvd_ring_end_use,
...
};
while we override more of them for the video encode engines:
static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_enc_ring_test_ring,
.test_ib = uvd_v7_0_enc_ring_test_ib,
.insert_nop = amdgpu_ring_insert_nop,
.insert_end = uvd_v7_0_enc_ring_insert_end,
.pad_ib = amdgpu_ring_generic_pad_ib,
.begin_use = amdgpu_uvd_ring_begin_use,
.end_use = amdgpu_uvd_ring_end_use,
...
};
But still maintain IP specific components.
Alex
Quoted 181 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <[email protected]> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 118 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status),
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-1- .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): CADnq5_Og4AWKdYFpa8hvmd2XXjr1Wzb_a26gqsq1H6c7NkWmMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Kent,
This consolidation is a must, because we should not have duplicated it in the first place. The kernel queue functions by design are generic. The reasson why GFX8 and GFX9 are different is because GFX9 is SOC15 where packet formats and doorbell size changed. On the other hand, kfd_kernel_queue_v7.c file is pretty much empty by reusing v8 functions, even though it is there. Furthermore, in my opinion kfd_kernel_queue_v7.c should be merged into v8 counterpart, From GFX9 onwards, packet formats should stay the same. For kernel queues, we should be able to differentiate it by pre SOC15 or not, and I have an impression that MEC firmware agrees to maintain the kernel queue interface stable across generations most of time.
Regards,
Yong
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, November 7, 2019 1:32 PM
To: Kuehling, Felix <[email protected]>
Cc: Zhao, Yong <[email protected]>; Russell, Kent <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 6 lines · Felix
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g., amdgpu_uvd.c amdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:
static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_ring_test_ring,
.test_ib = amdgpu_uvd_ring_test_ib, .insert_nop = uvd_v7_0_ring_insert_nop, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = amdgpu_uvd_ring_begin_use, .end_use = amdgpu_uvd_ring_end_use,
...
};
while we override more of them for the video encode engines:
static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_enc_ring_test_ring,
.test_ib = uvd_v7_0_enc_ring_test_ib,
.insert_nop = amdgpu_ring_insert_nop,
.insert_end = uvd_v7_0_enc_ring_insert_end,
.pad_ib = amdgpu_ring_generic_pad_ib,
.begin_use = amdgpu_uvd_ring_begin_use,
.end_use = amdgpu_uvd_ring_end_use,
...
};
But still maintain IP specific components.
Alex
Quoted 181 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 118 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status),
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-1- .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): DM6PR12MB2778007D58A5332F6A030DA3F0780-lmeGfMZKVrFSet88YzIdmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
On 2019-11-07 13:54, Zhao, Yong wrote:
Hi Kent,
This consolidation is a must, because we should not have duplicated it in the first place.
The code is working fine with the duplication. You disagree with duplicating the code in the first place. But that's just your opinion. It's not a must in any objective sense.
The kernel queue functions by design are generic. The reasson why GFX8 and GFX9 are different is because GFX9 is SOC15 where packet formats and doorbell size changed. On the other hand, kfd_kernel_queue_v7.c file is pretty much empty by reusing v8 functions, even though it is there. Furthermore, in my opinion kfd_kernel_queue_v7.c should be merged into v8 counterpart, From GFX9 onwards, packet formats should stay the same. For kernel queues, we should be able to differentiate it by pre SOC15 or not, and I have an impression that MEC firmware agrees to maintain the kernel queue interface stable across generations most of time.
OK, you're making assumptions about PM4 packets on future ASIC generations. It's true that the transition to SOC15 with 64-bit doorbells and read/write-pointers was particularly disruptive. Your assumption will hold until it gets broken by some other disruptive change.
For now, if you want clear naming, we could call the GFXv7/8 packet manager functions "pre-SOC15" or "legacy" and the GFXv9/10 and future functions "SOC15". This may work for a while. But I suspect at some point something is going to change and we'll need to create a new version for a newer ASIC generation. You already have a small taste of that with the different TBA-enable bit in the MAP_PROCESS packet in GFXv10.
Regards,
Felix
Regards,
Yong
________________________________
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Thursday, November 7, 2019 1:32 PM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>
Cc: Zhao, Yong <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 6 lines · On Thu, Nov 7, 2019 at 12:47 PM Kuehling, Felix…
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g., amdgpu_uvd.c amdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:
static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_ring_test_ring,
.test_ib = amdgpu_uvd_ring_test_ib, .insert_nop = uvd_v7_0_ring_insert_nop, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = amdgpu_uvd_ring_begin_use, .end_use = amdgpu_uvd_ring_end_use,
...
};
while we override more of them for the video encode engines:
static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_enc_ring_test_ring,
.test_ib = uvd_v7_0_enc_ring_test_ib,
.insert_nop = amdgpu_ring_insert_nop,
.insert_end = uvd_v7_0_enc_ring_insert_end,
.pad_ib = amdgpu_ring_generic_pad_ib,
.begin_use = amdgpu_uvd_ring_begin_use,
.end_use = amdgpu_uvd_ring_end_use,
...
};
But still maintain IP specific components.
Alex
Quoted 181 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]><mailto:[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 118 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]><mailto:[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status),
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-1- .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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): b4a76aeb-4d2c-c348-01bd-a40124930241-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Hi Felix,
The code working fine is true except that all not new features after this duplication are broken. If I want to make all GFX10 feature complete, I have to either manually adapt several duplications to the GFX10 file or do this consolidation. From this perspective and ease of my work, it is a must.
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]>
Sent: Thursday, November 7, 2019 2:12 PM
To: Zhao, Yong <[email protected]>; Alex Deucher <[email protected]>
Cc: Russell, Kent <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
On 2019-11-07 13:54, Zhao, Yong wrote:
Hi Kent,
This consolidation is a must, because we should not have duplicated it in the first place.
The code is working fine with the duplication. You disagree with duplicating the code in the first place. But that's just your opinion. It's not a must in any objective sense.
The kernel queue functions by design are generic. The reasson why GFX8 and GFX9 are different is because GFX9 is SOC15 where packet formats and doorbell size changed. On the other hand, kfd_kernel_queue_v7.c file is pretty much empty by reusing v8 functions, even though it is there. Furthermore, in my opinion kfd_kernel_queue_v7.c should be merged into v8 counterpart, From GFX9 onwards, packet formats should stay the same. For kernel queues, we should be able to differentiate it by pre SOC15 or not, and I have an impression that MEC firmware agrees to maintain the kernel queue interface stable across generations most of time.
OK, you're making assumptions about PM4 packets on future ASIC generations. It's true that the transition to SOC15 with 64-bit doorbells and read/write-pointers was particularly disruptive. Your assumption will hold until it gets broken by some other disruptive change.
For now, if you want clear naming, we could call the GFXv7/8 packet manager functions "pre-SOC15" or "legacy" and the GFXv9/10 and future functions "SOC15". This may work for a while. But I suspect at some point something is going to change and we'll need to create a new version for a newer ASIC generation. You already have a small taste of that with the different TBA-enable bit in the MAP_PROCESS packet in GFXv10.
Regards,
Felix
Regards,
Yong
________________________________
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Thursday, November 7, 2019 1:32 PM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>
Cc: Zhao, Yong <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 6 lines · On Thu, Nov 7, 2019 at 12:47 PM Kuehling, Felix…
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g., amdgpu_uvd.c amdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:
static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_ring_test_ring,
.test_ib = amdgpu_uvd_ring_test_ib, .insert_nop = uvd_v7_0_ring_insert_nop, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = amdgpu_uvd_ring_begin_use, .end_use = amdgpu_uvd_ring_end_use,
...
};
while we override more of them for the video encode engines:
static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_enc_ring_test_ring,
.test_ib = uvd_v7_0_enc_ring_test_ib,
.insert_nop = amdgpu_ring_insert_nop,
.insert_end = uvd_v7_0_enc_ring_insert_end,
.pad_ib = amdgpu_ring_generic_pad_ib,
.begin_use = amdgpu_uvd_ring_begin_use,
.end_use = amdgpu_uvd_ring_end_use,
...
};
But still maintain IP specific components.
Alex
Quoted 181 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]><mailto:[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 118 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]><mailto:[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status),
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-1- .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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): DM6PR12MB2778CD10620AEDD371AC088EF0780-lmeGfMZKVrFSet88YzIdmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Kuehling, Felix
Reviewed-byRe: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
On 2019-11-07 14:40, Zhao, Yong wrote:
Hi Felix,
The code working fine is true except that all not new features after this duplication are broken. If I want to make all GFX10 feature complete, I have to either manually adapt several duplications to the GFX10 file or do this consolidation. From this perspective and ease of my work, it is a must.
"A must" means there is no alternative. You already listed two alternatives yourself: "either manually adapt several duplications to the GFX10 file or do this consolidation."
In _your_ opinion, the consolidation means less work for _you_. That's _your_ point of view. The discussion in this code review pointed out other points of view. When you take all of them into account, you may reconsider what is less work overall, and what is easier to maintain.
I'm not opposing your change per-se. But I'd like you to consider the whole picture, including the consequences of any design decisions you're making and imposing on anyone working on this code in the future. In this cases I think it's a relatively minor issue and it may just come down to a matter of opinion that I don't feel terribly strongly about.
With that said, the change is
Regards,
Felix
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]><mailto:[email protected]>
Sent: Thursday, November 7, 2019 2:12 PM
To: Zhao, Yong <[email protected]><mailto:[email protected]>; Alex Deucher <[email protected]><mailto:[email protected]>
Cc: Russell, Kent <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
On 2019-11-07 13:54, Zhao, Yong wrote:
Hi Kent,
This consolidation is a must, because we should not have duplicated it in the first place.
The code is working fine with the duplication. You disagree with duplicating the code in the first place. But that's just your opinion. It's not a must in any objective sense.
The kernel queue functions by design are generic. The reasson why GFX8 and GFX9 are different is because GFX9 is SOC15 where packet formats and doorbell size changed. On the other hand, kfd_kernel_queue_v7.c file is pretty much empty by reusing v8 functions, even though it is there. Furthermore, in my opinion kfd_kernel_queue_v7.c should be merged into v8 counterpart, From GFX9 onwards, packet formats should stay the same. For kernel queues, we should be able to differentiate it by pre SOC15 or not, and I have an impression that MEC firmware agrees to maintain the kernel queue interface stable across generations most of time.
OK, you're making assumptions about PM4 packets on future ASIC generations. It's true that the transition to SOC15 with 64-bit doorbells and read/write-pointers was particularly disruptive. Your assumption will hold until it gets broken by some other disruptive change.
For now, if you want clear naming, we could call the GFXv7/8 packet manager functions "pre-SOC15" or "legacy" and the GFXv9/10 and future functions "SOC15". This may work for a while. But I suspect at some point something is going to change and we'll need to create a new version for a newer ASIC generation. You already have a small taste of that with the different TBA-enable bit in the MAP_PROCESS packet in GFXv10.
Regards,
Felix
Regards,
Yong
________________________________
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Thursday, November 7, 2019 1:32 PM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>
Cc: Zhao, Yong <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 6 lines · On Thu, Nov 7, 2019 at 12:47 PM Kuehling, Felix…
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g., amdgpu_uvd.c amdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:
static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_ring_test_ring,
.test_ib = amdgpu_uvd_ring_test_ib, .insert_nop = uvd_v7_0_ring_insert_nop, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = amdgpu_uvd_ring_begin_use, .end_use = amdgpu_uvd_ring_end_use,
...
};
while we override more of them for the video encode engines:
static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_enc_ring_test_ring,
.test_ib = uvd_v7_0_enc_ring_test_ib,
.insert_nop = amdgpu_ring_insert_nop,
.insert_end = uvd_v7_0_enc_ring_insert_end,
.pad_ib = amdgpu_ring_generic_pad_ib,
.begin_use = amdgpu_uvd_ring_begin_use,
.end_use = amdgpu_uvd_ring_end_use,
...
};
But still maintain IP specific components.
Alex
Quoted 181 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]><mailto:[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 118 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]><mailto:[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status),
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-1- .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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): 6e021a24-eeb0-e1e1-d467-87ab48a6c7bc-5C7GfCeVMHo@public.gmane.org
Zhao, Yong
Reviewed-by Felix KuehlingRe: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
After considering Kent's concern, I actually took the consolidation to the next level where v9 and v10 have no divergence. With that, I think the "mustness" is stronger. Please check out the new patch.
Regards,
Yong
On 2019-11-07 3:31 p.m., Kuehling, Felix wrote:
On 2019-11-07 14:40, Zhao, Yong wrote:
Hi Felix,
The code working fine is true except that all not new features after this duplication are broken. If I want to make all GFX10 feature complete, I have to either manually adapt several duplications to the GFX10 file or do this consolidation. From this perspective and ease of my work, it is a must.
"A must" means there is no alternative. You already listed two alternatives yourself: "either manually adapt several duplications to the GFX10 file or do this consolidation."
In _your_ opinion, the consolidation means less work for _you_. That's _your_ point of view. The discussion in this code review pointed out other points of view. When you take all of them into account, you may reconsider what is less work overall, and what is easier to maintain.
I'm not opposing your change per-se. But I'd like you to consider the whole picture, including the consequences of any design decisions you're making and imposing on anyone working on this code in the future. In this cases I think it's a relatively minor issue and it may just come down to a matter of opinion that I don't feel terribly strongly about.
With that said, the change is
Regards,
Felix
Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]><mailto:[email protected]>
Sent: Thursday, November 7, 2019 2:12 PM
To: Zhao, Yong <[email protected]><mailto:[email protected]>; Alex Deucher <[email protected]><mailto:[email protected]>
Cc: Russell, Kent <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
On 2019-11-07 13:54, Zhao, Yong wrote:
Hi Kent,
This consolidation is a must, because we should not have duplicated it in the first place.
The code is working fine with the duplication. You disagree with duplicating the code in the first place. But that's just your opinion. It's not a must in any objective sense.
The kernel queue functions by design are generic. The reasson why GFX8 and GFX9 are different is because GFX9 is SOC15 where packet formats and doorbell size changed. On the other hand, kfd_kernel_queue_v7.c file is pretty much empty by reusing v8 functions, even though it is there. Furthermore, in my opinion kfd_kernel_queue_v7.c should be merged into v8 counterpart, From GFX9 onwards, packet formats should stay the same. For kernel queues, we should be able to differentiate it by pre SOC15 or not, and I have an impression that MEC firmware agrees to maintain the kernel queue interface stable across generations most of time.
OK, you're making assumptions about PM4 packets on future ASIC generations. It's true that the transition to SOC15 with 64-bit doorbells and read/write-pointers was particularly disruptive. Your assumption will hold until it gets broken by some other disruptive change.
For now, if you want clear naming, we could call the GFXv7/8 packet manager functions "pre-SOC15" or "legacy" and the GFXv9/10 and future functions "SOC15". This may work for a while. But I suspect at some point something is going to change and we'll need to create a new version for a newer ASIC generation. You already have a small taste of that with the different TBA-enable bit in the MAP_PROCESS packet in GFXv10.
Regards,
Felix
Regards,
Yong
________________________________
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Thursday, November 7, 2019 1:32 PM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>
Cc: Zhao, Yong <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
Quoted 6 lines · On Thu, Nov 7, 2019 at 12:47 PM Kuehling, Felix…
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g., amdgpu_uvd.c amdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:
static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_ring_test_ring,
.test_ib = amdgpu_uvd_ring_test_ib, .insert_nop = uvd_v7_0_ring_insert_nop, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = amdgpu_uvd_ring_begin_use, .end_use = amdgpu_uvd_ring_end_use,
...
};
while we override more of them for the video encode engines:
static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = {
...
.test_ring = uvd_v7_0_enc_ring_test_ring,
.test_ib = uvd_v7_0_enc_ring_test_ib,
.insert_nop = amdgpu_ring_insert_nop,
.insert_end = uvd_v7_0_enc_ring_insert_end,
.pad_ib = amdgpu_ring_generic_pad_ib,
.begin_use = amdgpu_uvd_ring_begin_use,
.end_use = amdgpu_uvd_ring_end_use,
...
};
But still maintain IP specific components.
Alex
Quoted 181 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]><mailto:[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 118 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]><mailto:[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status),
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +1
-1- .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
In reply to a message not in the archiveQuoted 41 lines · Alex Deucher
Quoted 5 lines · Felix
No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will add a lot of confusion when talking to firmware teams.
You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.
This is the price we pay for micro-optimizing minor code duplication.
What we've tried to do in amdgpu is to break out shared code in to common helpers that are not IP specific and use that in each IP module (e.g.,
amdgpu_uvd.camdgpu_gfx.c, etc.). Sometimes we can use a particular chunk of code across multiple generations. E.g., the uvd stuff is a good example. We have shared generic uvd helpers that work for most UVD IP versions, and then if we need an IP specific version, we override that in the callbacks with a version specific one. E.g., for the video decode engines we use the generic helpers for a number of ring functions:static const struct
amdgpu_ring_funcsuvd_v7_0_ring_vm_funcs= {
...
.test_ring =uvd_v7_0_ring_test_ring,
.test_ib =amdgpu_uvd_ring_test_ib, .insert_nop =uvd_v7_0_ring_insert_nop, .pad_ib =amdgpu_ring_generic_pad_ib, .begin_use =amdgpu_uvd_ring_begin_use, .end_use =amdgpu_uvd_ring_end_use,
...
};while we override more of them for the video encode engines:
static const struct
amdgpu_ring_funcsuvd_v7_0_enc_ring_vm_funcs= {
...
.test_ring =uvd_v7_0_enc_ring_test_ring,
.test_ib =uvd_v7_0_enc_ring_test_ib, .insert_nop =amdgpu_ring_insert_nop,
.insert_end =uvd_v7_0_enc_ring_insert_end,
.pad_ib =amdgpu_ring_generic_pad_ib,
.begin_use =amdgpu_uvd_ring_begin_use,
.end_use =amdgpu_uvd_ring_end_use,
...
};
Quoted 1 line
But still maintain IP specific components.
Thanks Alex. In this case the common code is in kfd_packet_manager.c and the IP-version-specific code that writes the actual PM4 packets is in the kernel_queue_v*.c files. Yong is trying to merge the PM4 packet writing code for v9 and v10 because the packet formats are essentially unchanged. It makes the naming conventions in the code a bit meaningless because v9 now really means "v9 and v10". Apparently there is precedent for this, as we already did the same thing with v7 and v8, which I forgot about in my initial code review.
Regards,
Felix
Quoted 188 lines
Alex
Quoted 185 lines
Regards,
FelixOn 2019-11-07 12:39, Zhao, Yong wrote:
Hi Kent,
I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
Yong
On 2019-11-07 12:33 p.m., Russell, Kent wrote:
I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2, or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes things, and only GFX11 ASICs use those functions/variables.
Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.
Kent
From: amd-gfx <[email protected]> On Behalf Of Zhao, Yong
Sent: Thursday, November 7, 2019 11:57 AM
To: Kuehling, Felix <[email protected]>; [email protected]
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiHi Felix,
That's because v8 and v7 share the same
packet_manager_funcs. In this case, it is better to keep it as it is.Regards,
Yong
________________________________
From: Kuehling, Felix <[email protected]>
Sent: Wednesday, November 6, 2019 11:45 PM
To: Zhao, Yong <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdkfd: only keeprelease_memfunction for HawaiiQuoted 1 line · Yong
release_memwon't be used at all on GFX9 and GFX10, so delete it.Hawaii was GFXv7. So we're not using the
release_mempacket on GFXv8 either. Why arbitrarily limit this change to GFXv9 and 10?Regards,
FelixQuoted 110 lines
Change-Id I13787a8a29b83e7516c582a7401f2e14721edf5fSigned-off-by Yong Zhao <[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++----------------- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 33 ++--------------- 2 files changed, 4 insertions(+), 64 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2
-33@@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v10 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - -WARN_ON (!buffer); - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return sizeof (struct pm4_mec_release_mem ) /sizeof (unsigned int ); -} -const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_process = pm_map_process_v10, .runlist = pm_runlist_v10,@@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = { .map_queues = pm_map_queues_v10, .unmap_queues = pm_unmap_queues_v10, .query_status = pm_query_status_v10, - .release_mem = pm_release_mem_v10, + .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-30@@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,return 0 ; } - -static int pm_release_mem_v9 (uint64_t gpu_addr,uint32_t *buffer) -{ -struct pm4_mec_release_mem *packet; - - packet = (struct pm4_mec_release_mem *)buffer; -memset (buffer,0 ,sizeof (struct pm4_mec_release_mem )); - - packet->header.u32All =pm_build_pm4_header (IT_RELEASE_MEM , -sizeof (struct pm4_mec_release_mem )); - - packet->bitfields2.event_type =CACHE_FLUSH_AND_INV_TS_EVENT ; - packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe; - packet->bitfields2.tcl1_action_ena =1 ; - packet->bitfields2.tc_action_ena =1 ; - packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru; - - packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low; - packet->bitfields3.int_sel = - int_sel__mec_release_mem__send_interrupt_after_write_confirm; - - packet->bitfields4.address_lo_32b = (gpu_addr &0xffffffff ) >>2 ; - packet->address_hi =upper_32_bits (gpu_addr); - - packet->data_lo =0 ; - -return 0 ; -} -const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_process = pm_map_process_v9, .runlist = pm_runlist_v9,@@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .map_queues = pm_map_queues_v9, .unmap_queues = pm_unmap_queues_v9, .query_status = pm_query_status_v9, - .release_mem = pm_release_mem_v9,drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 354
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +2
-1+ .release_mem = NULL, .map_process_size = sizeof(struct pm4_mes_map_process), .runlist_size = sizeof(struct pm4_mes_runlist), .set_resources_size = sizeof(struct pm4_mes_set_resources), .map_queues_size = sizeof(struct pm4_mes_map_queues), .unmap_queues_size = sizeof(struct pm4_mes_unmap_queues), .query_status_size = sizeof(struct pm4_mes_query_status), - .release_mem_size = sizeof(struct pm4_mec_release_mem) + .release_mem_size = 0, };_______________________________________________
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 3/3 drm/amdkfd: Use kernel queue v9 functions for v10
In reply to a message not in the archiveThe kernel queue functions for v9 and v10 are the same except pm_map_process_v* which have small difference, so they should be reused. This eliminates the need of reapplying several patches which were applied on v9 but not on v10, such as bigger GWS and more than 2 SDMA engine support which were introduced on Arcturus.
--- drivers/gpu/drm/amd/amdkfd/Makefile | 1 - drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h | 1 - .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 317 ------------------ .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 49 ++- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 - 6 files changed, 44 insertions(+), 331 deletions(-) delete mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c
drivers/gpu/drm/amd/amdkfd/Makefile +0 -1
@@ -41,7 +41,6 @@ AMDKFD_FILES := $(AMDKFD_PATH)/kfd_module.o \ $(AMDKFD_PATH)/kfd_kernel_queue_cik.o \ $(AMDKFD_PATH)/kfd_kernel_queue_vi.o \ $(AMDKFD_PATH)/kfd_kernel_queue_v9.o \ - $(AMDKFD_PATH)/kfd_kernel_queue_v10.o \ $(AMDKFD_PATH)/kfd_packet_manager.o \ $(AMDKFD_PATH)/kfd_process_queue_manager.o \ $(AMDKFD_PATH)/kfd_device_queue_manager.o \
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +1 -3
@@ -332,12 +332,10 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,case CHIP_RAVEN :case CHIP_RENOIR :case CHIP_ARCTURUS : -kernel_queue_init_v9 (&kq->ops_asic_specific); -break ;case CHIP_NAVI10 :case CHIP_NAVI12 :case CHIP_NAVI14 : -kernel_queue_init_v10 (&kq->ops_asic_specific); +kernel_queue_init_v9 (&kq->ops_asic_specific);break ;default : WARN(1, "Unexpected ASIC family %u",
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h +0 -1
@@ -102,6 +102,5 @@ struct kernel_queue {void kernel_queue_init_cik (struct kernel_queue_ops *ops);void kernel_queue_init_vi (struct kernel_queue_ops *ops);void kernel_queue_init_v9 (struct kernel_queue_ops *ops); -void kernel_queue_init_v10 (struct kernel_queue_ops *ops);#endif /* KFD_KERNEL_QUEUE_H_ */
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c deleted +0 -317
317 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +43 -6
70 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0 -3
@@ -996,9 +996,6 @@ void pm_release_ib(struct packet_manager *pm);/* Following PM funcs can be shared among VI and AI */ unsigned int pm_build_pm4_header (unsigned int opcode,size_t packet_size); -int pm_set_resources_vi (struct packet_manager *pm,uint32_t *buffer, -struct scheduling_resources *res); -uint64_t kfd_get_number_elems (struct kfd_dev *kfd);
Signature · 6 lines
2.17.1 _______________________________________________ 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): [email protected]
Re: [PATCH 3/3] drm/amdkfd: Use kernel queue v9 functions for v10
Quoted 5 lines · Yong
The kernel queue functions for v9 and v10 are the same except pm_map_process_v* which have small difference, so they should be reused. This eliminates the need of reapplying several patches which were applied on v9 but not on v10, such as bigger GWS and more than 2 SDMA engine support which were introduced on Arcturus.
This looks reasonable in principle. See one suggestion inline to simplify it further.
Quoted 59 lines
Change-Id I2d385961e3c884db14e30b5afc98d0d9e4cb1802Signed-off-by Yong Zhao <[email protected]>--- drivers/gpu/drm/amd/amdkfd/Makefile | 1 - drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h | 1 - .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 317 ------------------ .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 49 ++- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 - 6 files changed, 44 insertions(+), 331 deletions(-)delete mode 100644
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.cdrivers/gpu/drm/amd/amdkfd/Makefile +0
-1@@ -41,7 +41,6 @@ AMDKFD_FILES := $(AMDKFD_PATH)/kfd_module.o \ $(AMDKFD_PATH)/kfd_kernel_queue_cik.o \ $(AMDKFD_PATH)/kfd_kernel_queue_vi.o \ $(AMDKFD_PATH)/kfd_kernel_queue_v9.o \ - $(AMDKFD_PATH)/kfd_kernel_queue_v10.o \ $(AMDKFD_PATH)/kfd_packet_manager.o \ $(AMDKFD_PATH)/kfd_process_queue_manager.o \ $(AMDKFD_PATH)/kfd_device_queue_manager.o \drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +1
-3@@ -332,12 +332,10 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,case CHIP_RAVEN :case CHIP_RENOIR :case CHIP_ARCTURUS : -kernel_queue_init_v9 (&kq->ops_asic_specific); -break ;case CHIP_NAVI10 :case CHIP_NAVI12 :case CHIP_NAVI14 : -kernel_queue_init_v10 (&kq->ops_asic_specific); +kernel_queue_init_v9 (&kq->ops_asic_specific);break ;default : WARN(1, "Unexpected ASIC family %u",drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h +0
-1@@ -102,6 +102,5 @@ struct kernel_queue {void kernel_queue_init_cik (struct kernel_queue_ops *ops);void kernel_queue_init_vi (struct kernel_queue_ops *ops);void kernel_queue_init_v9 (struct kernel_queue_ops *ops); -void kernel_queue_init_v10 (struct kernel_queue_ops *ops);#endif /* KFD_KERNEL_QUEUE_H_ */ drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c deleted +0
-0
[snip]
Quoted 20 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +3
-2@@ -62,8 +62,9 @@ void kernel_queue_init_v9(struct kernel_queue_ops *ops) ops->submit_packet = submit_packet_v9; } -static int pm_map_process_v9 (struct packet_manager *pm, -uint32_t *buffer,struct qcm_process_device *qpd) +static int pm_map_process_v9_base (struct packet_manager *pm, +uint32_t *buffer,struct qcm_process_device *qpd, +unsigned int sq_shader_tba_hi_trap_en_shift) {struct pm4_mes_map_process *packet;uint64_t vm_page_table_base_addr = qpd->page_table_base;@@ -85,10 +86,16 @@ static int pm_map_process_v9(struct packet_manager *pm, packet->sh_mem_config = qpd->sh_mem_config; packet->sh_mem_bases = qpd->sh_mem_bases;
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c static int pm_map_process_v9(struct packet_manager *pm, · line 94
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +6
-4- packet->sq_shader_tba_lo =lower_32_bits (qpd->tba_addr >>8 ); - packet->sq_shader_tba_hi =upper_32_bits (qpd->tba_addr >>8 ); - packet->sq_shader_tma_lo =lower_32_bits (qpd->tma_addr >>8 ); - packet->sq_shader_tma_hi =upper_32_bits (qpd->tma_addr >>8 ); +if (qpd->tba_addr) { + packet->sq_shader_tba_lo =lower_32_bits (qpd->tba_addr >>8 ); + packet->sq_shader_tba_hi =upper_32_bits (qpd->tba_addr >>8 ); +if (sq_shader_tba_hi_trap_en_shift) { + packet->sq_shader_tba_hi |= +1 << sq_shader_tba_hi_trap_en_shift;
If you pass in a mask instead of a shift, you don't need the conditional. I.e.
packet->sq_shader_tba_hi = upper_32_bits(qpd->tba_addr >> 8) |sq_shader_tba_hi_trap_en_mask;
Quoted 20 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +9
-0+ } + packet->sq_shader_tma_lo =lower_32_bits (qpd->tma_addr >>8 ); + packet->sq_shader_tma_hi =upper_32_bits (qpd->tma_addr >>8 ); + } packet->gds_addr_lo =lower_32_bits (qpd->gds_context_area); packet->gds_addr_hi =upper_32_bits (qpd->gds_context_area);@@ -101,6 +108,11 @@ static int pm_map_process_v9(struct packet_manager *pm,return 0 ; } +static int pm_map_process_v9 (struct packet_manager *pm, +uint32_t *buffer,struct qcm_process_device *qpd) { +return pm_map_process_v9_base (pm, buffer, qpd,0 ); +} +static int pm_runlist_v9 (struct packet_manager *pm,uint32_t *buffer,uint64_t ib,size_t ib_size_in_dwords,bool chain) {
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c const struct packet_manager_funcs kfd_v9_pm_funcs = { · line 373
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +7
-0@@ -352,3 +364,28 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = { .query_status_size = sizeof(struct pm4_mes_query_status), .release_mem_size = 0, }; + +#include "gc/gc_10_1_0_sh_mask.h" + +static int pm_map_process_v10 (struct packet_manager *pm, +uint32_t *buffer,struct qcm_process_device *qpd) { +return pm_map_process_v9_base (pm, buffer, qpd, +SQ_SHADER_TBA_HI__TRAP_EN__SHIFT );
With my suggestion above, pass in (1 <<SQ_SHADER_TBA_HI__TRAP_EN__SHIFT) here.
Regards,
Felix
Quoted 23 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +18
-0+} + +const struct packet_manager_funcs kfd_v10_pm_funcs = { + .map_process = pm_map_process_v10, + .runlist = pm_runlist_v9, + .set_resources = pm_set_resources_v9, + .map_queues = pm_map_queues_v9, + .unmap_queues = pm_unmap_queues_v9, + .query_status = pm_query_status_v9, + .release_mem =NULL , + .map_process_size =sizeof (struct pm4_mes_map_process ), + .runlist_size =sizeof (struct pm4_mes_runlist ), + .set_resources_size =sizeof (struct pm4_mes_set_resources ), + .map_queues_size =sizeof (struct pm4_mes_map_queues ), + .unmap_queues_size =sizeof (struct pm4_mes_unmap_queues ), + .query_status_size =sizeof (struct pm4_mes_query_status ), + .release_mem_size =0 , +};drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_priv.h void pm_release_ib(struct packet_manager *pm); · line 1001
Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-3@@ -996,9 +996,6 @@ void pm_release_ib(struct packet_manager *pm);/* Following PM funcs can be shared among VI and AI */ unsigned int pm_build_pm4_header (unsigned int opcode,size_t packet_size); -int pm_set_resources_vi (struct packet_manager *pm,uint32_t *buffer, -struct scheduling_resources *res); -uint64_t kfd_get_number_elems (struct kfd_dev *kfd);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Kuehling, Felix
Reviewed-by Felix KuehlingQuoted 4 lines · Yong
This is cleaner.
Change-Id I8cdecad387d8c547a088c6050f77385ee1135be1Signed-off-by Yong Zhao <[email protected]>
Quoted 31 lines
--- .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +0
-12@@ -26,18 +26,6 @@#include "kfd_pm4_headers_ai.h" #include "kfd_pm4_opcodes.h" -static bool initialize_v9 (struct kernel_queue *kq,struct kfd_dev *dev, -enum kfd_queue_type type,unsigned int queue_size); -static void uninitialize_v9 (struct kernel_queue *kq); -static void submit_packet_v9 (struct kernel_queue *kq); - -void kernel_queue_init_v9 (struct kernel_queue_ops *ops) -{ - ops->initialize = initialize_v9; - ops->uninitialize = uninitialize_v9; - ops->submit_packet = submit_packet_v9; -} -static bool initialize_v9 (struct kernel_queue *kq,struct kfd_dev *dev,enum kfd_queue_type type,unsigned int queue_size) {@@ -67,6 +55,13 @@ static void submit_packet_v9(struct kernel_queue *kq) kq->pending_wptr64); }
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c static void submit_packet_v9(struct kernel_queue *kq) · line 67
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c +7
-0+void kernel_queue_init_v9 (struct kernel_queue_ops *ops) +{ + ops->initialize = initialize_v9; + ops->uninitialize = uninitialize_v9; + ops->submit_packet = submit_packet_v9; +} +static int pm_map_process_v9 (struct packet_manager *pm,uint32_t *buffer,struct qcm_process_device *qpd) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx