Selectively spread compute rings across pipes
Subsystems (2)
cover Selectively spread compute rings across pipes
This was disabled due to an OCL perf regression as discussed on amd-gfx.
This series re-enables the feature for ASICs that are not affected, and also introduces a boot parameter to force the policy on or off. This should help future effort of comparing performance with the feature enabled/disabled.
Andres Rodriguez (2):
drm/amdgpu: use multipipe compute policy on non PL11 asics drm/amdgpu: add option for force enable multipipe policy for compute
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 20 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-)
Signature · 6 lines
2.9.3 _______________________________________________ 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): 20170926162246.3200-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/2 drm/amdgpu: use multipipe compute policy on non PL11 asics
A performance regression for OpenCL tests on Polaris11 had this feature disabled for all asics.
Instead, disable it selectively on the affected asics.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +12 -2
@@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s } } +static bool amdgpu_gfx_is_multipipe_capable (struct amdgpu_device *adev) +{ +/* FIXME: spreading the queues across pipes causes perf regressions +* on POLARIS11 compute workloads */ +if (adev->asic_type ==CHIP_POLARIS11 ) +return false; + +return adev->gfx.mec.num_mec >1 ; +} +void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev) {int i, queue, pipe, mec; +bool multipipe_policy =amdgpu_gfx_is_multipipe_capable (adev);/* policy for amdgpu compute queue ownership */ for (i =0 ; i <AMDGPU_MAX_COMPUTE_QUEUES ; ++i) {
@@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -/* FIXME: spreading the queues across pipes causes perf regressions */ -if (0 ) { +if (multipipe_policy) {/* policy: amdgpu owns the first two queues of the first MEC */ if (mec ==0 && queue <2 )set_bit (i, adev->gfx.mec.queue_bitmap);
Signature · 6 lines
2.9.3 _______________________________________________ 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): 20170926162246.3200-2-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Hi Andres,
With your this patch, OCLperf hung.
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to queue_bitmap.
Then UMD can use different number queue to submit command for compute selected by amdgpu_queue_mgr_map.
I checked amdgpu_queue_mgr_map implementation, CS_IOCTL can map user ring to different hw ring depending on busy or idle, right?
If yes, I see a bug in it, which will result in our sched_fence not work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.
Regards,
David Zhou
Quoted 36 lines · Andres Rodriguez
A performance regression for OpenCL tests on Polaris11 had this feature disabled for all asics.
Instead, disable it selectively on the affected asics.
Signed-off-by Andres Rodriguez <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11
-0@@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s } } +static bool amdgpu_gfx_is_multipipe_capable (struct amdgpu_device *adev) +{ +/* FIXME: spreading the queues across pipes causes perf regressions +* on POLARIS11 compute workloads */ +if (adev->asic_type ==CHIP_POLARIS11 ) +return false; + +return adev->gfx.mec.num_mec >1 ; +} +void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev) {int i, queue, pipe, mec; +bool multipipe_policy =amdgpu_gfx_is_multipipe_capable (adev);/* policy for amdgpu compute queue ownership */ for (i =0 ; i <AMDGPU_MAX_COMPUTE_QUEUES ; ++i) {
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev) · line 142
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-2@@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -/* FIXME: spreading the queues across pipes causes perf regressions */ -if (0 ) { +if (multipipe_policy) {/* policy: amdgpu owns the first two queues of the first MEC */ if (mec ==0 && queue <2 )set_bit (i, adev->gfx.mec.queue_bitmap);
_______________________________________________
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]
A message that is not in the archive (sent off-list or not yet received): 2200a1fa-d1d3-bd92-825d-987ecd355dac-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Sorry my mail client seems to have blown up. My reply got cut off, here is the full version:
Quoted 2 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.
It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000
What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 6 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?
Yes, when a queue is first used, amdgpu_queue_mgr_map will decide what the mapping is for a usermode ring to a kernel ring id.
Quoted 3 lines
If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.
I think here you mean that work will execute out of order because it will go to different rings?
That should not happen, since the id mapping is permanent on a per-context basis. Once a mapping is decided, it will be cached for this context so that we keep execution order guarantees. See the id-caching code in amdgpu_queue_mgr.c for reference.
As long as the usermode keeps submitting work to the same ring, it will all be executed in order (all in the same ring). There is no change in this guarantee compared to pre-patch. Note that even before this patch amdgpu_queue_mgr_map has been using an LRU policy for a long time now.
Regards,
Andres
Quoted 29 lines · Andres Rodriguez
Quoted 3 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000
Quoted 80 lines
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 68 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.Regards,
David Zhou
Quoted 48 lines · Andres Rodriguez
A performance regression for OpenCL tests on Polaris11 had this feature disabled for all asics.
Instead, disable it selectively on the affected asics.
Signed-off-by Andres Rodriguez <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0@@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask,unsigned
max_se, unsignedmax_s}}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11
-1+static bool amdgpu_gfx_is_multipipe_capable (struct amdgpu_device *adev) +{ +/* FIXME: spreading the queues across pipes causes perf regressions +* on POLARIS11 compute workloads */ +if (adev->asic_type ==CHIP_POLARIS11 ) +return false; + +return adev->gfx.mec.num_mec >1 ; +} +void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev) {int i, queue, pipe, mec; +bool multipipe_policy =amdgpu_gfx_is_multipipe_capable (adev);/* policy for amdgpu compute queue ownership */ for (i =0 ; i <AMDGPU_MAX_COMPUTE_QUEUES ; ++i) {@@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -/* FIXME: spreading the queues across pipes causes perf regressions */
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-1-if (0 ) { +if (multipipe_policy) {/* policy: amdgpu owns the first two queues of the first MEC */
if (mec == 0 && queue < 2) set_bit(i, adev->gfx.mec.queue_bitmap);
_______________________________________________
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): CAFQ_0eFcs+DLu6sEEEtX1GJU+ccb1B2bHPSkrAdk3OUVfqq3zg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Then snychronization should have no problem, it maybe relate to multipipe hw setting issue.
Regards,
David Zhou
________________________________
From: Andres Rodriguez <[email protected]>
Sent: Tuesday, November 7, 2017 2:00:57 AM
To: Zhou, David(ChunMing); amd-gfx list
Cc: Deucher, Alexander
Subject: Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Sorry my mail client seems to have blown up. My reply got cut off, here is the full version:
Quoted 2 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.
It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000
What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 6 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?
Yes, when a queue is first used, amdgpu_queue_mgr_map will decide what the mapping is for a usermode ring to a kernel ring id.
Quoted 3 lines
If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.
I think here you mean that work will execute out of order because it will go to different rings?
That should not happen, since the id mapping is permanent on a per-context basis. Once a mapping is decided, it will be cached for this context so that we keep execution order guarantees. See the id-caching code in amdgpu_queue_mgr.c for reference.
As long as the usermode keeps submitting work to the same ring, it will all be executed in order (all in the same ring). There is no change in this guarantee compared to pre-patch. Note that even before this patch amdgpu_queue_mgr_map has been using an LRU policy for a long time now.
Regards,
Andres
Quoted 29 lines · Andres Rodriguez
Quoted 3 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000
Quoted 80 lines
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 68 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.Regards,
David Zhou
Quoted 48 lines · Andres Rodriguez
A performance regression for OpenCL tests on Polaris11 had this feature disabled for all asics.
Instead, disable it selectively on the affected asics.
Signed-off-by Andres Rodriguez <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0@@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask,unsigned
max_se, unsignedmax_s}}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11
-1+static bool amdgpu_gfx_is_multipipe_capable (struct amdgpu_device *adev) +{ +/* FIXME: spreading the queues across pipes causes perf regressions +* on POLARIS11 compute workloads */ +if (adev->asic_type ==CHIP_POLARIS11 ) +return false; + +return adev->gfx.mec.num_mec >1 ; +} +void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev) {int i, queue, pipe, mec; +bool multipipe_policy =amdgpu_gfx_is_multipipe_capable (adev);/* policy for amdgpu compute queue ownership */ for (i =0 ; i <AMDGPU_MAX_COMPUTE_QUEUES ; ++i) {@@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -/* FIXME: spreading the queues across pipes causes perf regressions */
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-1-if (0 ) { +if (multipipe_policy) {/* policy: amdgpu owns the first two queues of the first MEC */
if (mec == 0 && queue < 2) set_bit(i, adev->gfx.mec.queue_bitmap);
_______________________________________________
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): MWHPR1201MB0206CEC26FF751CB39B529D6B4510-3iK1xFAIwjrUF/YbdlDdgWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Do you have any work actually going into multiple pipes? My understanding is that opencl will only use one queue at a time (but I'm not really certain about that).
What you can also check is if the app works correctly when it executed on pipe0, and if it hangs on pipe 1+. I removed all the locations where pipe0 was hardcoded in the open driver, but it is possible it is still hardcoded somewhere on the closed stack.
Regards,
Andres
Quoted 166 lines · David(ChunMing)
Then snychronization should have no problem, it maybe relate to multipipe hw setting issue.
Regards,
David Zhou
------------------------------
*From:* Andres Rodriguez <[email protected]> *Sent:* Tuesday, November 7, 2017 2:00:57 AM
*To:* Zhou, David(ChunMing); amd-gfx list
*Cc:* Deucher, Alexander
*Subject:* Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asicsSorry my mail client seems to have blown up. My reply got cut off, here is the full version:
Quoted 2 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 6 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?Yes, when a queue is first used,
amdgpu_queue_mgr_mapwill decide what the mapping is for a usermode ring to a kernel ring id.Quoted 3 lines
If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.I think here you mean that work will execute out of order because it will go to different rings?
That should not happen, since the id mapping is permanent on a per-context basis. Once a mapping is decided, it will be cached for this context so that we keep execution order guarantees. See the id-caching code in
amdgpu_queue_mgr.cfor reference.As long as the usermode keeps submitting work to the same ring, it will all be executed in order (all in the same ring). There is no change in this guarantee compared to pre-patch. Note that even before this patch
amdgpu_queue_mgr_maphas been using an LRU policy for a long time now.Regards,
AndresQuoted 29 lines · Andres Rodriguez
Quoted 3 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000Quoted 16 lines
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 5 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map userring
Quoted 3 lines
Quoted 3 lines
to different hw ring depending on busy or idle, right?
If yes, I see a bug in it, which will result in our
sched_fencenotwork.
Quoted 21 lines
Quoted 21 lines
Our sched fence assumes the job will be executed in order, your mapping queue breaks this.
Regards,
David Zhou
Quoted 11 lines · Andres Rodriguez
A performance regression for OpenCL tests on Polaris11 had this feature disabled for all asics.
Instead, disable it selectively on the affected asics.
Signed-off-by Andres Rodriguez <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0@@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask,unsigned
max_se, unsignedmax_s}}
+static bool amdgpu_gfx_is_multipipe_capable(structamdgpu_device*adev)
Quoted 32 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-0+{ +/* FIXME: spreading the queues across pipes causes perf regressions
Quoted 28 lines
Quoted 27 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +8
-1+* on POLARIS11 compute workloads */ +if (adev->asic_type ==CHIP_POLARIS11 ) +return false; + +return adev->gfx.mec.num_mec >1 ; +} +void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev) {int i, queue, pipe, mec; +bool multipipe_policy =amdgpu_gfx_is_multipipe_capable (adev);/* policy for amdgpu compute queue ownership */ for (i =0 ; i <AMDGPU_MAX_COMPUTE_QUEUES ; ++i) {@@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -/* FIXME: spreading the queues across pipes causes perf regressions */
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-1-if (0 ) { +if (multipipe_policy) {/* policy: amdgpu owns the first two queues of the first MEC */
if (mec == 0 && queue < 2) set_bit(i, adev->gfx.mec.queue_bitmap);
_______________________________________________
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): CAFQ_0eEqvKgUEUicckuPtvjZq-f4BXdhQO_p8hPVvy4Jh_KQgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
I got the infomation about this issue:
"
* If I install #491963 (failed in the report) with “./amdgpu-pro-install -y --opencl=legacy” command, the test passed. It failed when rocm is also installed with “./amdgpu-pro-install -y --opencl=legacy,rocm” command."
So I guess the hung is related to the pipe is used both ORCA and rocm. But Felix said they dont support rocm on Tonga, that could mean this issue doesn't matter currently.
Regards,
David Zhou
________________________________
From: Andres Rodriguez <[email protected]>
Sent: Tuesday, November 7, 2017 3:26:38 PM
To: Zhou, David(ChunMing)
Cc: amd-gfx list; Deucher, Alexander
Subject: Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Do you have any work actually going into multiple pipes? My understanding is that opencl will only use one queue at a time (but I'm not really certain about that).
What you can also check is if the app works correctly when it executed on pipe0, and if it hangs on pipe 1+. I removed all the locations where pipe0 was hardcoded in the open driver, but it is possible it is still hardcoded somewhere on the closed stack.
Regards,
Andres
On Nov 6, 2017 10:19 PM, "Zhou, David(ChunMing)" <[email protected]<mailto:[email protected]>> wrote:
Then snychronization should have no problem, it maybe relate to multipipe hw setting issue.
Regards,
David Zhou
________________________________
From: Andres Rodriguez <[email protected]<mailto:[email protected]>>
Sent: Tuesday, November 7, 2017 2:00:57 AM
To: Zhou, David(ChunMing); amd-gfx list
Cc: Deucher, Alexander
Subject: Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Sorry my mail client seems to have blown up. My reply got cut off, here is the full version:
Quoted 2 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.
It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000
What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 6 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?
Yes, when a queue is first used, amdgpu_queue_mgr_map will decide what the mapping is for a usermode ring to a kernel ring id.
Quoted 3 lines
If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.
I think here you mean that work will execute out of order because it will go to different rings?
That should not happen, since the id mapping is permanent on a per-context basis. Once a mapping is decided, it will be cached for this context so that we keep execution order guarantees. See the id-caching code in amdgpu_queue_mgr.c for reference.
As long as the usermode keeps submitting work to the same ring, it will all be executed in order (all in the same ring). There is no change in this guarantee compared to pre-patch. Note that even before this patch amdgpu_queue_mgr_map has been using an LRU policy for a long time now.
Regards,
Andres
Quoted 29 lines · On Mon, Nov 6, 2017 at 12:44 PM, Andres Rodriguez…
Quoted 3 lines · Chunming Zhou
Hi Andres,
Hi David,
Quoted 1 line
With your this patch, OCLperf hung.
Is this on all ASICs or just a specific one?
Quoted 5 lines
Could you explain more?
If I am correctly, the difference of with and without this patch is setting first two queue or setting all queues of pipe0 to
queue_bitmap.It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0;
Pre-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000
Quoted 80 lines
Post-patch:
|-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware.
Quoted 68 lines
Then UMD can use different number queue to submit command for compute selected by
amdgpu_queue_mgr_map.I checked
amdgpu_queue_mgr_mapimplementation,CS_IOCTLcan map user ring to different hw ring depending on busy or idle, right?If yes, I see a bug in it, which will result in our
sched_fencenot work. Our sched fence assumes the job will be executed in order, your mapping queue breaks this.Regards,
David Zhou
Quoted 48 lines · Andres Rodriguez
A performance regression for OpenCL tests on Polaris11 had this feature disabled for all asics.
Instead, disable it selectively on the affected asics.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0@@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask,unsigned
max_se, unsignedmax_s}}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11
-1+static bool amdgpu_gfx_is_multipipe_capable (struct amdgpu_device *adev) +{ +/* FIXME: spreading the queues across pipes causes perf regressions +* on POLARIS11 compute workloads */ +if (adev->asic_type ==CHIP_POLARIS11 ) +return false; + +return adev->gfx.mec.num_mec >1 ; +} +void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev) {int i, queue, pipe, mec; +bool multipipe_policy =amdgpu_gfx_is_multipipe_capable (adev);/* policy for amdgpu compute queue ownership */ for (i =0 ; i <AMDGPU_MAX_COMPUTE_QUEUES ; ++i) {@@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)if (mec >= adev->gfx.mec.num_mec)break ; -/* FIXME: spreading the queues across pipes causes perf regressions */
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-1-if (0 ) { +if (multipipe_policy) {/* policy: amdgpu owns the first two queues of the first MEC */
if (mec == 0 && queue < 2) set_bit(i, adev->gfx.mec.queue_bitmap);
_______________________________________________
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): MWHPR1201MB02066E434C312ECA541C51C8B4510-3iK1xFAIwjrUF/YbdlDdgWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Not sure amd-gfx is the right list for this. The code I'm talking about is not upstream yet, and the problem being discussed occurs on the DKMS branch.
Even though we say we don't support Tonga (there are known issues with ROCm on Tonga), KFD will detect and initialize it. That means the HWS is initialized. If user mode initializes the ROCr Runtime (even if it's just for device enumeration), I believe at least one user mode queue is created, that will just sit idle. That idle user mode queue is probably on pipe 0. The pipe will periodically switch between the idle user mode queue and a kernel compute queue.
You can see a hexdump of MQDs of all KFD user mode queues in /sys/kernel/debug/kfd/mqds. You can also inspect the HQDs in /sys/kernel/debug/kfd/hqds.
Regards,
Felix
Quoted 261 lines · David(ChunMing)
I got the infomation about this issue:
"
# If I install #491963 (failed in the report) with “./amdgpu-pro-install -y --opencl=legacy” command, the test passed. It failed when rocm is also installed with “./amdgpu-pro-install -y --opencl=legacy,rocm” command."
So I guess the hung is related to the pipe is used both ORCA and rocm. But Felix said they dont support rocm on Tonga, that could mean this issue doesn't matter currently.
Regards,
David Zhou
------------------------------------------------------------------------
*From:* Andres Rodriguez <[email protected]>
*Sent:* Tuesday, November 7, 2017 3:26:38 PM
*To:* Zhou, David(ChunMing)
*Cc:* amd-gfx list; Deucher, Alexander
*Subject:* Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics
Do you have any work actually going into multiple pipes? My understanding is that opencl will only use one queue at a time (but I'm not really certain about that).What you can also check is if the app works correctly when it executed on pipe0, and if it hangs on pipe 1+. I removed all the locations where pipe0 was hardcoded in the open driver, but it is possible it is still hardcoded somewhere on the closed stack.
Regards,
AndresOn Nov 6, 2017 10:19 PM, "Zhou, David(ChunMing)" <[email protected] <mailto:[email protected]>> wrote:
Then snychronization should have no problem, it maybe relate to multipipe hw setting issue. Regards, David Zhou ------------------------------------------------------------------------ *From:* Andres Rodriguez <[email protected] <mailto:[email protected]>> *Sent:* Tuesday, November 7, 2017 2:00:57 AM *To:* Zhou, David(ChunMing); amd-gfx list *Cc:* Deucher, Alexander *Subject:* Re: [PATCH 1/2] drm/amdgpu: use multipipe compute policy on non PL11 asics Sorry my mail client seems to have blown up. My reply got cut off, here is the full version: On 2017-11-06 01:49 AM, Chunming Zhou wrote: > Hi Andres, > Hi David, > With your this patch, OCLperf hung. Is this on all ASICs or just a specific one? > > Could you explain more? > > If I am correctly, the difference of with and without this patch is > setting first two queue or setting all queues of pipe0 to queue_bitmap. It is slightly different. With this patch we will also use the first two queues of all pipes, not just pipe 0; Pre-patch: |-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11111111 00000000 00000000 00000000 Post-patch: |-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| 11000000 11000000 11000000 11000000 What this means is that we are allowing real multithreading for compute. Jobs on different pipes allow for parallel execution of work. Jobs on the same pipe (but different queues) use timeslicing to share the hardware. > > Then UMD can use different number queue to submit command for compute > selected by amdgpu_queue_mgr_map. > > I checked amdgpu_queue_mgr_map implementation, CS_IOCTL can map user > ring to different hw ring depending on busy or idle, right? Yes, when a queue is first used, amdgpu_queue_mgr_map will decide what the mapping is for a usermode ring to a kernel ring id. > If yes, I see a bug in it, which will result in our sched_fence not > work. Our sched fence assumes the job will be executed in order, your > mapping queue breaks this. I think here you mean that work will execute out of order because it will go to different rings? That should not happen, since the id mapping is permanent on a per-context basis. Once a mapping is decided, it will be cached for this context so that we keep execution order guarantees. See the id-caching code in amdgpu_queue_mgr.c for reference. As long as the usermode keeps submitting work to the same ring, it will all be executed in order (all in the same ring). There is no change in this guarantee compared to pre-patch. Note that even before this patch amdgpu_queue_mgr_map has been using an LRU policy for a long time now. Regards, Andres On Mon, Nov 6, 2017 at 12:44 PM, Andres Rodriguez <[email protected] <mailto:[email protected]>> wrote: > > > On 2017-11-06 01:49 AM, Chunming Zhou wrote: >> >> Hi Andres, >> > > Hi David, > >> With your this patch, OCLperf hung. > > > Is this on all ASICs or just a specific one? > >> >> Could you explain more? >> >> If I am correctly, the difference of with and without this patch is >> setting first two queue or setting all queues of pipe0 to queue_bitmap. > > > It is slightly different. With this patch we will also use the first two > queues of all pipes, not just pipe 0; > > Pre-patch: > > |-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| > 11111111 00000000 00000000 00000000 > > Post-patch: > > |-Pipe 0-||-Pipe 1-||-Pipe 2-||-Pipe 3-| > 11000000 11000000 11000000 11000000 > > What this means is that we are allowing real multithreading for compute. > Jobs on different pipes allow for parallel execution of work. Jobs on the > same pipe (but different queues) use timeslicing to share the hardware. > > > >> >> Then UMD can use different number queue to submit command for compute >> selected by amdgpu_queue_mgr_map. >> >> I checked amdgpu_queue_mgr_map implementation, CS_IOCTL can map user ring >> to different hw ring depending on busy or idle, right? >> >> If yes, I see a bug in it, which will result in our sched_fence not work. >> Our sched fence assumes the job will be executed in order, your mapping >> queue breaks this. >> >> >> Regards, >> >> David Zhou >> >> >> On 2017年09月27日 00:22, Andres Rodriguez wrote: >>> >>> A performance regression for OpenCL tests on Polaris11 had this feature >>> disabled for all asics. >>> >>> Instead, disable it selectively on the affected asics. >>> >>> Signed-off-by: Andres Rodriguez <[email protected] <mailto:[email protected]>> >>> --- >>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++++++++++-- >>> 1 file changed, 12 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c >>> index 4f6c68f..3d76e76 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c >>> @@ -109,9 +109,20 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, >>> unsigned max_se, unsigned max_s >>> } >>> } >>> +static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev) >>> +{ >>> + /* FIXME: spreading the queues across pipes causes perf regressions >>> + * on POLARIS11 compute workloads */ >>> + if (adev->asic_type == CHIP_POLARIS11) >>> + return false; >>> + >>> + return adev->gfx.mec.num_mec > 1; >>> +} >>> + >>> void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev) >>> { >>> int i, queue, pipe, mec; >>> + bool multipipe_policy = amdgpu_gfx_is_multipipe_capable(adev); >>> /* policy for amdgpu compute queue ownership */ >>> for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) { >>> @@ -125,8 +136,7 @@ void amdgpu_gfx_compute_queue_acquire(struct >>> amdgpu_device *adev) >>> if (mec >= adev->gfx.mec.num_mec) >>> break; >>> - /* FIXME: spreading the queues across pipes causes perf >>> regressions */ >>> - if (0) { >>> + if (multipipe_policy) { >>> /* policy: amdgpu owns the first two queues of the first >>> MEC */ >>> if (mec == 0 && queue < 2) >>> set_bit(i, adev->gfx.mec.queue_bitmap); >> >> >
Quoted 4 lines
_______________________________________________
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 2/2 drm/amdgpu: add option for force enable multipipe policy for compute
In reply to a message not in the archiveUseful for testing the effects of multipipe compute without recompiling.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 6 ++++++ 3 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -121,6 +121,7 @@ extern int amdgpu_cntl_sb_buf_per_se;extern int amdgpu_param_buf_per_se;extern int amdgpu_job_hang_limit;extern int amdgpu_lbpw; +extern int amdgpu_compute_multipipe;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -122,6 +122,7 @@ int amdgpu_cntl_sb_buf_per_se = 0;int amdgpu_param_buf_per_se =0 ;int amdgpu_job_hang_limit =0 ;int amdgpu_lbpw =-1 ; +int amdgpu_compute_multipipe =-1 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );
@@ -265,6 +266,9 @@ module_param_named(job_hang_limit, amdgpu_job_hang_limit, int ,0444);MODULE_PARM_DESC (lbpw,"Load Balancing Per Watt (LBPW) support (1 = enable, 0 = disable, -1 = auto)" );module_param_named (lbpw, amdgpu_lbpw, int,0444 ); +MODULE_PARM_DESC (compute_multipipe,"Force compute queues to be spread across pipes (1 = enable, 0 = disable, -1 = auto)" ); +module_param_named (compute_multipipe, amdgpu_compute_multipipe, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +6 -0
@@ -111,6 +111,12 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sstatic bool amdgpu_gfx_is_multipipe_capable (struct amdgpu_device *adev) { +if (amdgpu_compute_multipipe !=-1 ) { +DRM_INFO ("amdgpu: forcing compute pipe policy %d\n" , + amdgpu_compute_multipipe); +return amdgpu_compute_multipipe ==1 ; + } +/* FIXME: spreading the queues across pipes causes perf regressions * on POLARIS11 compute workloads */ if (adev->asic_type ==CHIP_POLARIS11 )
Signature · 6 lines
2.9.3 _______________________________________________ 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): 20170926162246.3200-3-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/2] drm/amdgpu: add option for force enable multipipe policy for compute
Quoted 3 lines · Andres Rodriguez
Useful for testing the effects of multipipe compute without recompiling.
Signed-off-by Andres Rodriguez <[email protected]>
I'm skeptical that it's a good idea to add a module parameter for this. See Daniel's rationale in
https://lists.freedesktop.org/archives/dri-devel/2017-September/153690.html
. In particular, since we don't fully understand how this stuff works yet, it's better for now to stick to changing the code for experiments.
In general, the output of
modinfo -p amdgpu
is quite a horror show already, we should try to clean that up rather than making it worse.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
The series is Acked-by: Felix Kuehling <[email protected]>
Regards,
Felix
Quoted 8 lines · Andres Rodriguez
This was disabled due to an OCL perf regression as discussed on amd-gfx.
This series re-enables the feature for ASICs that are not affected, and also introduces a boot parameter to force the policy on or off. This should help future effort of comparing performance with the feature enabled/disabled.
Quoted 9 lines
Andres Rodriguez (2):
drm/amdgpu: use multipipe compute policy on non PL11 asics drm/amdgpu: add option for force enable multipipe policy for computedrivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 20 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-)
_______________________________________________
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): 63adcb76-1a0b-e351-c70a-08761b02120e-5C7GfCeVMHo@public.gmane.org
Alex Deucher
AppliedQuoted 12 lines · Felix Kuehling
The series is Acked-by: Felix Kuehling <[email protected]>
Regards,
FelixQuoted 5 lines · Andres Rodriguez
This was disabled due to an OCL perf regression as discussed on amd-gfx.
This series re-enables the feature for ASICs that are not affected, and also introduces a boot parameter to force the policy on or off. This should help future effort of comparing performance with the feature enabled/disabled.
Applied. thanks!
Alex
Quoted 13 lines
Quoted 12 lines
Andres Rodriguez (2):
drm/amdgpu: use multipipe compute policy on non PL11 asics drm/amdgpu: add option for force enable multipipe policy for computedrivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 20 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-)
Quoted 4 lines
_______________________________________________
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