<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:windowtext">That makes sense, Felix.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Kent<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> Kuehling, Felix <Felix.Kuehling@amd.com>
<br>
<b>Sent:</b> Thursday, November 7, 2019 12:47 PM<br>
<b>To:</b> Zhao, Yong <Yong.Zhao@amd.com>; Russell, Kent <Kent.Russell@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>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.<o:p></o:p></p>
<p>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.<o:p></o:p></p>
<p>This is the price we pay for micro-optimizing minor code duplication.<o:p></o:p></p>
<p>Regards,<br>
  Felix<o:p></o:p></p>
<div>
<p class="MsoNormal">On 2019-11-07 12:39, Zhao, Yong wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Hi Kent, <o:p></o:p></p>
<p>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.
<o:p></o:p></p>
<p>Yong<o:p></o:p></p>
<div>
<p class="MsoNormal">On 2019-11-07 12:33 p.m., Russell, Kent wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">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. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Kent<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx <a href="mailto:amd-gfx-bounces@lists.freedesktop.org">
<amd-gfx-bounces@lists.freedesktop.org></a> <b>On Behalf Of </b>Zhao, Yong<br>
<b>Sent:</b> Thursday, November 7, 2019 11:57 AM<br>
<b>To:</b> Kuehling, Felix <a href="mailto:Felix.Kuehling@amd.com"><Felix.Kuehling@amd.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Hi Felix,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">That's because v8 and v7 share the same
</span>packet_manager_funcs. In this case, it is better to keep it as it is.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Yong<o:p></o:p></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b>From:</b> Kuehling, Felix <<a href="mailto:Felix.Kuehling@amd.com">Felix.Kuehling@amd.com</a>><br>
<b>Sent:</b> Wednesday, November 6, 2019 11:45 PM<br>
<b>To:</b> Zhao, Yong <<a href="mailto:Yong.Zhao@amd.com">Yong.Zhao@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">On 2019-10-30 20:17, Zhao, Yong wrote:<br>
> release_mem won't be used at all on GFX9 and GFX10, so delete it.<br>
<br>
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 <br>
either. Why arbitrarily limit this change to GFXv9 and 10?<br>
<br>
Regards,<br>
   Felix<br>
<br>
><br>
> Change-Id: I13787a8a29b83e7516c582a7401f2e14721edf5f<br>
> Signed-off-by: Yong Zhao <<a href="mailto:Yong.Zhao@amd.com">Yong.Zhao@amd.com</a>><br>
> ---<br>
>   .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++-----------------<br>
>   .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c  | 33 ++---------------<br>
>   2 files changed, 4 insertions(+), 64 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c<br>
> index aed32ab7102e..bfd6221acae9 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c<br>
> @@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,<br>
>        return 0;<br>
>   }<br>
>   <br>
> -<br>
> -static int pm_release_mem_v10(uint64_t gpu_addr, uint32_t *buffer)<br>
> -{<br>
> -     struct pm4_mec_release_mem *packet;<br>
> -<br>
> -     WARN_ON(!buffer);<br>
> -<br>
> -     packet = (struct pm4_mec_release_mem *)buffer;<br>
> -     memset(buffer, 0, sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->header.u32All = pm_build_pm4_header(IT_RELEASE_MEM,<br>
> -                                     sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->bitfields2.event_type = CACHE_FLUSH_AND_INV_TS_EVENT;<br>
> -     packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe;<br>
> -     packet->bitfields2.tcl1_action_ena = 1;<br>
> -     packet->bitfields2.tc_action_ena = 1;<br>
> -     packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru;<br>
> -<br>
> -     packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low;<br>
> -     packet->bitfields3.int_sel =<br>
> -             int_sel__mec_release_mem__send_interrupt_after_write_confirm;<br>
> -<br>
> -     packet->bitfields4.address_lo_32b = (gpu_addr & 0xffffffff) >> 2;<br>
> -     packet->address_hi = upper_32_bits(gpu_addr);<br>
> -<br>
> -     packet->data_lo = 0;<br>
> -<br>
> -     return sizeof(struct pm4_mec_release_mem) / sizeof(unsigned int);<br>
> -}<br>
> -<br>
>   const struct packet_manager_funcs kfd_v10_pm_funcs = {<br>
>        .map_process                    = pm_map_process_v10,<br>
>        .runlist                        = pm_runlist_v10,<br>
> @@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = {<br>
>        .map_queues                     = pm_map_queues_v10,<br>
>        .unmap_queues                   = pm_unmap_queues_v10,<br>
>        .query_status                   = pm_query_status_v10,<br>
> -     .release_mem                    = pm_release_mem_v10,<br>
> +     .release_mem                    = NULL,<br>
>        .map_process_size               = sizeof(struct pm4_mes_map_process),<br>
>        .runlist_size                   = sizeof(struct pm4_mes_runlist),<br>
>        .set_resources_size             = sizeof(struct pm4_mes_set_resources),<br>
>        .map_queues_size                = sizeof(struct pm4_mes_map_queues),<br>
>        .unmap_queues_size              = sizeof(struct pm4_mes_unmap_queues),<br>
>        .query_status_size              = sizeof(struct pm4_mes_query_status),<br>
> -     .release_mem_size               = sizeof(struct pm4_mec_release_mem)<br>
> +     .release_mem_size               = 0,<br>
>   };<br>
>   <br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c<br>
> index 3b5ca2b1d7a6..f0e4910a8865 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c<br>
> @@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,<br>
>        return 0;<br>
>   }<br>
>   <br>
> -<br>
> -static int pm_release_mem_v9(uint64_t gpu_addr, uint32_t *buffer)<br>
> -{<br>
> -     struct pm4_mec_release_mem *packet;<br>
> -<br>
> -     packet = (struct pm4_mec_release_mem *)buffer;<br>
> -     memset(buffer, 0, sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->header.u32All = pm_build_pm4_header(IT_RELEASE_MEM,<br>
> -                                     sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->bitfields2.event_type = CACHE_FLUSH_AND_INV_TS_EVENT;<br>
> -     packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe;<br>
> -     packet->bitfields2.tcl1_action_ena = 1;<br>
> -     packet->bitfields2.tc_action_ena = 1;<br>
> -     packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru;<br>
> -<br>
> -     packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low;<br>
> -     packet->bitfields3.int_sel =<br>
> -             int_sel__mec_release_mem__send_interrupt_after_write_confirm;<br>
> -<br>
> -     packet->bitfields4.address_lo_32b = (gpu_addr & 0xffffffff) >> 2;<br>
> -     packet->address_hi = upper_32_bits(gpu_addr);<br>
> -<br>
> -     packet->data_lo = 0;<br>
> -<br>
> -     return 0;<br>
> -}<br>
> -<br>
>   const struct packet_manager_funcs kfd_v9_pm_funcs = {<br>
>        .map_process            = pm_map_process_v9,<br>
>        .runlist                = pm_runlist_v9,<br>
> @@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = {<br>
>        .map_queues             = pm_map_queues_v9,<br>
>        .unmap_queues           = pm_unmap_queues_v9,<br>
>        .query_status           = pm_query_status_v9,<br>
> -     .release_mem            = pm_release_mem_v9,<br>
> +     .release_mem            = NULL,<br>
>        .map_process_size       = sizeof(struct pm4_mes_map_process),<br>
>        .runlist_size           = sizeof(struct pm4_mes_runlist),<br>
>        .set_resources_size     = sizeof(struct pm4_mes_set_resources),<br>
>        .map_queues_size        = sizeof(struct pm4_mes_map_queues),<br>
>        .unmap_queues_size      = sizeof(struct pm4_mes_unmap_queues),<br>
>        .query_status_size      = sizeof(struct pm4_mes_query_status),<br>
> -     .release_mem_size       = sizeof(struct pm4_mec_release_mem)<br>
> +     .release_mem_size       = 0,<br>
>   };<o:p></o:p></p>
</div>
</div>
</blockquote>
</blockquote>
</div>
</body>
</html>