Skip to contentSkip to conversation

drm/amdgpu: disable GFXOFF and PG during compute for GFX9

PATCH In review Jesse Zhang 2 participants 4 messages Oct 11, 2023 – Oct 12, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: disable GFXOFF and PG during compute for GFX9

Temporary workaround to fix issues observed in some compute applications when GFXOFF is enabled on GFX9.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index d3805dbbbb6f..fef93d4edcbc 100644
@@ -683,12 +683,16 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
 
 void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)
 {
+	enum amd_powergating_state state = idle ? AMD_PG_STATE_GATE : AMD_PG_STATE_UNGATE;
 	/* Temporary workaround to fix issues observed in some
 	 * compute applications when GFXOFF is enabled on GFX11.
 	 */
 	if (IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 11) {
 		pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled");
 		amdgpu_gfx_off_ctrl(adev, idle);
+	} else if ((IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 9) &&
+		(adev->flags & AMD_IS_APU)) {
+		adev->ip_blocks[AMD_IP_BLOCK_TYPE_GFX].version->funcs->set_powergating_state((void *)adev, state);
 	}
 	amdgpu_dpm_switch_power_profile(adev,
 					PP_SMC_POWER_PROFILE_COMPUTE,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 17 lines · Jesse Zhang

Temporary workaround to fix issues observed in some compute applications when GFXOFF is enabled on GFX9.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -0
index d3805dbbbb6f..fef93d4edcbc 100644
@@ -683,12 +683,16 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
 
 void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)
 {

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev, · line 695

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
+       enum amd_powergating_state state = idle ? AMD_PG_STATE_GATE : AMD_PG_STATE_UNGATE;
        /* Temporary workaround to fix issues observed in some
         * compute applications when GFXOFF is enabled on GFX11.
         */
        if (IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 11) {
                pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled");
                amdgpu_gfx_off_ctrl(adev, idle);
+       } else if ((IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 9) &&
+               (adev->flags & AMD_IS_APU)) {
+               adev->ip_blocks[AMD_IP_BLOCK_TYPE_GFX].version->funcs->set_powergating_state((void *)adev, state);

Why not use amdgpu_gfx_off_ctrl(adev, idle); for consistency?

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -1
        }
        amdgpu_dpm_switch_power_profile(adev,
                                        PP_SMC_POWER_PROFILE_COMPUTE,
--

2.25.1

#2 lore raw

[AMD Official Use Only - General]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 11, 2023 10:20 PM
To: Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Yang, Philip <[email protected]>; Kuehling, Felix <[email protected]>; Zhang, Yifan <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: disable GFXOFF and PG during compute for GFX9

Quoted 22 lines · Jesse Zhang

Temporary workaround to fix issues observed in some compute applications when GFXOFF is enabled on GFX9.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
index d3805dbbbb6f..fef93d4edcbc 100644
@@ -683,12 +683,16 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device
 *adev,
 
 void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool
 idle)  {
+       enum amd_powergating_state state = idle ? AMD_PG_STATE_GATE :
+ AMD_PG_STATE_UNGATE;
        /* Temporary workaround to fix issues observed in some

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_submit_ib(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -0
         * compute applications when GFXOFF is enabled on GFX11.
         */
        if (IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 11) {
                pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled");
                amdgpu_gfx_off_ctrl(adev, idle);
+       } else if ((IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 9) &&
+               (adev->flags & AMD_IS_APU)) {
+
+ adev->ip_blocks[AMD_IP_BLOCK_TYPE_GFX].version->funcs->set_powergati
+ ng_state((void *)adev, state);

Why not use amdgpu_gfx_off_ctrl(adev, idle); for consistency?
[Zhang, Jesse(Jie)] Hi Alex,
amdgpu_gfx_off_ctrl only disable gfxoff. It also need to disable gfx9's powergating to workaround.
So use the set_powergating_state to disable gfxoff and PG.

Jesse
Alex

Quoted 6 lines
        }
        amdgpu_dpm_switch_power_profile(adev,
                                        PP_SMC_POWER_PROFILE_COMPUTE,

--
2.25.1

Acked-by
#3 lore raw
Quoted 40 lines · Jesse(Jie)

[AMD Official Use Only - General]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 11, 2023 10:20 PM
To: Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Yang, Philip <[email protected]>; Kuehling, Felix <[email protected]>; Zhang, Yifan <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: disable GFXOFF and PG during compute for GFX9

Quoted 29 lines · Jesse Zhang

Temporary workaround to fix issues observed in some compute applications when GFXOFF is enabled on GFX9.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index d3805dbbbb6f..fef93d4edcbc 100644
@@ -683,12 +683,16 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device
 *adev,
 
 void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool
 idle)  {
+       enum amd_powergating_state state = idle ? AMD_PG_STATE_GATE :
+ AMD_PG_STATE_UNGATE;
        /* Temporary workaround to fix issues observed in some
         * compute applications when GFXOFF is enabled on GFX11.
         */
        if (IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 11) {
                pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled");
                amdgpu_gfx_off_ctrl(adev, idle);
+       } else if ((IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)) == 9) &&
+               (adev->flags & AMD_IS_APU)) {
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_submit_ib(struct amdgpu_device

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3 -0
+
+ adev->ip_blocks[AMD_IP_BLOCK_TYPE_GFX].version->funcs->set_powergati
+ ng_state((void *)adev, state);

Why not use amdgpu_gfx_off_ctrl(adev, idle); for consistency?
[Zhang, Jesse(Jie)] Hi Alex,
amdgpu_gfx_off_ctrl only disable gfxoff. It also need to disable gfx9's powergating to workaround.
So use the set_powergating_state to disable gfxoff and PG.

Thanks for clarifying. Maybe add a comment to that effect. With that fixed:

Alex

Quoted 10 lines

Jesse
Alex

Quoted 6 lines
        }
        amdgpu_dpm_switch_power_profile(adev,
                                        PP_SMC_POWER_PROFILE_COMPUTE,

--
2.25.1