All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Shashank Sharma <shashank.sharma@amd.com>, amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com, amaranath.somalapuram@amd.com,
	christian.koenig@amd.com
Subject: Re: [PATCH v3 1/5] drm/amdgpu: add UAPI for workload hints to ctx ioctl
Date: Tue, 27 Sep 2022 10:28:53 -0400	[thread overview]
Message-ID: <9912aab4-7168-1eb7-5018-e2b140397741@amd.com> (raw)
In-Reply-To: <20220926214014.5450-2-shashank.sharma@amd.com>

Am 2022-09-26 um 17:40 schrieb Shashank Sharma:
> Allow the user to specify a workload hint to the kernel.
> We can use these to tweak the dpm heuristics to better match
> the workload for improved performance.
>
> V3: Create only set() workload UAPI (Christian)
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
> ---
>   include/uapi/drm/amdgpu_drm.h | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index c2c9c674a223..23d354242699 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -212,6 +212,7 @@ union drm_amdgpu_bo_list {
>   #define AMDGPU_CTX_OP_QUERY_STATE2	4
>   #define AMDGPU_CTX_OP_GET_STABLE_PSTATE	5
>   #define AMDGPU_CTX_OP_SET_STABLE_PSTATE	6
> +#define AMDGPU_CTX_OP_SET_WORKLOAD_PROFILE	7
>   
>   /* GPU reset status */
>   #define AMDGPU_CTX_NO_RESET		0
> @@ -252,6 +253,17 @@ union drm_amdgpu_bo_list {
>   #define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK  3
>   #define AMDGPU_CTX_STABLE_PSTATE_PEAK  4
>   
> +/* GPU workload hints, flag bits 8-15 */
> +#define AMDGPU_CTX_WORKLOAD_HINT_SHIFT     8
> +#define AMDGPU_CTX_WORKLOAD_HINT_MASK      (0xff << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)

8 bits seems overkill for this. Are we ever going to have 256 different 
workload types? Maybe 4 bits would be enough. That would allow up to 16 
types.


> +#define AMDGPU_CTX_WORKLOAD_HINT_NONE      (0 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)
> +#define AMDGPU_CTX_WORKLOAD_HINT_3D        (1 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)
> +#define AMDGPU_CTX_WORKLOAD_HINT_VIDEO     (2 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)
> +#define AMDGPU_CTX_WORKLOAD_HINT_VR        (3 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)
> +#define AMDGPU_CTX_WORKLOAD_HINT_COMPUTE   (4 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)
> +#define AMDGPU_CTX_WORKLOAD_HINT_MAX	   AMDGPU_CTX_WORKLOAD_HINT_COMPUTE
> +#define AMDGPU_CTX_WORKLOAD_INDEX(n)	   (n >> AMDGPU_CTX_WORKLOAD_HINT_SHIFT)

The macro argument (n) should be wrapped in parentheses. Also, it may be 
a good idea to apply the AMDGPU_CTX_WORKLOAD_HINT_MASK when extracting 
the index, in case more flags are added at higher bits in the future:

     (((n) & AMDGPU_CTX_WORKLOAD_HINT_MASK) >> AMDGPU_WORKLOAD_HINT_SHIFT)

Regards,
   Felix


> +
>   struct drm_amdgpu_ctx_in {
>   	/** AMDGPU_CTX_OP_* */
>   	__u32	op;
> @@ -281,6 +293,11 @@ union drm_amdgpu_ctx_out {
>   			__u32	flags;
>   			__u32	_pad;
>   		} pstate;
> +
> +		struct {
> +			__u32	flags;
> +			__u32	_pad;
> +		} workload;
>   };
>   
>   union drm_amdgpu_ctx {

  parent reply	other threads:[~2022-09-27 14:29 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 21:40 [PATCH v3 0/5] GPU workload hints for better performance Shashank Sharma
2022-09-26 21:40 ` [PATCH v3 1/5] drm/amdgpu: add UAPI for workload hints to ctx ioctl Shashank Sharma
2022-09-27  6:07   ` Christian König
2022-09-27 14:28   ` Felix Kuehling [this message]
2023-03-21  3:05   ` Marek Olšák
2023-03-21 13:00     ` Sharma, Shashank
2023-03-21 13:54       ` Christian König
2023-03-22 14:05         ` Marek Olšák
2023-03-22 14:08           ` Christian König
2023-03-22 14:24             ` Marek Olšák
2023-03-22 14:29               ` Christian König
2023-03-22 14:36                 ` Marek Olšák
2023-03-22 14:52                   ` Alex Deucher
2023-03-22 15:11                     ` Marek Olšák
2023-03-22 14:38                 ` Sharma, Shashank
2022-09-26 21:40 ` [PATCH v3 2/5] drm/amdgpu: add new functions to set GPU power profile Shashank Sharma
2022-09-27  2:14   ` Quan, Evan
2022-09-27  7:29     ` Sharma, Shashank
2022-09-27  9:29       ` Quan, Evan
2022-09-27 10:00         ` Sharma, Shashank
2022-09-27  6:08   ` Christian König
2022-09-27  9:58   ` Lazar, Lijo
2022-09-27 11:41     ` Sharma, Shashank
2022-09-27 12:10       ` Lazar, Lijo
2022-09-27 12:23         ` Sharma, Shashank
2022-09-27 12:39           ` Lazar, Lijo
2022-09-27 12:53             ` Sharma, Shashank
2022-09-27 13:29               ` Lazar, Lijo
2022-09-27 13:47                 ` Sharma, Shashank
2022-09-27 14:00                   ` Lazar, Lijo
2022-09-27 14:20                     ` Sharma, Shashank
2022-09-27 14:34                       ` Lazar, Lijo
2022-09-27 14:50                         ` Sharma, Shashank
2022-09-27 15:20   ` Felix Kuehling
2022-09-26 21:40 ` [PATCH v3 3/5] drm/amdgpu: set GPU workload via ctx IOCTL Shashank Sharma
2022-09-27  6:09   ` Christian König
2022-09-26 21:40 ` [PATCH v3 4/5] drm/amdgpu: switch GPU workload profile Shashank Sharma
2022-09-27  6:11   ` Christian König
2022-09-27 10:03   ` Lazar, Lijo
2022-09-27 11:47     ` Sharma, Shashank
2022-09-27 12:20       ` Lazar, Lijo
2022-09-27 12:25         ` Sharma, Shashank
2022-09-27 16:33       ` Michel Dänzer
2022-09-27 17:06         ` Sharma, Shashank
2022-09-27 17:29           ` Michel Dänzer
2022-09-26 21:40 ` [PATCH v3 5/5] drm/amdgpu: switch workload context to/from compute Shashank Sharma
2022-09-27  6:12   ` Christian König
2022-09-27 14:48     ` Felix Kuehling
2022-09-27 14:58       ` Sharma, Shashank
2022-09-27 15:23         ` Felix Kuehling
2022-09-27 15:38           ` Sharma, Shashank
2022-09-27 20:40             ` Alex Deucher
2022-09-28  7:05               ` Lazar, Lijo
2022-09-28  8:56               ` Sharma, Shashank
2022-09-28  9:00                 ` Sharma, Shashank
2022-09-28 21:51                 ` Alex Deucher
2022-09-29  8:48                   ` Sharma, Shashank
2022-09-29 11:10                     ` Lazar, Lijo
2022-09-29 13:20                       ` Sharma, Shashank
2022-09-29 13:37                         ` Lazar, Lijo
2022-09-29 14:00                           ` Sharma, Shashank
2022-09-29 14:14                             ` Lazar, Lijo
2022-09-29 14:40                               ` Sharma, Shashank
2022-09-29 18:32                               ` Alex Deucher
2022-09-30  5:08                                 ` Lazar, Lijo
2022-09-30  8:37                                   ` Sharma, Shashank
2022-09-30  9:13                                     ` Lazar, Lijo
2022-09-30  9:22                                       ` Sharma, Shashank
2022-09-30  9:54                                         ` Lazar, Lijo
2022-09-30 10:09                                           ` Sharma, Shashank
2022-09-29 18:07                       ` Felix Kuehling
2022-09-30  4:46                         ` Lazar, Lijo
2022-09-27 16:24 ` [PATCH v3 0/5] GPU workload hints for better performance Michel Dänzer
2022-09-27 16:59   ` Sharma, Shashank
2022-09-27 17:13     ` Michel Dänzer
2022-09-27 17:25       ` Sharma, Shashank

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9912aab4-7168-1eb7-5018-e2b140397741@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amaranath.somalapuram@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=shashank.sharma@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.