public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* [PATCH] powerpc/perf: Add json metric events to present CPI stall cycles in powerpc
@ 2023-02-16  6:12 Athira Rajeev
  2023-02-16 18:10 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Athira Rajeev @ 2023-02-16  6:12 UTC (permalink / raw)
  To: mpe, acme, jolsa
  Cc: irogers, ak, rnsastry, kjain, linux-perf-users, maddy,
	james.clark, namhyung, disgoel, linuxppc-dev

Power10 Performance Monitoring Unit (PMU) provides events
to understand stall cycles of different pipeline stages.
These events along with completed instructions provides
useful metrics for application tuning.

Patch implements the json changes to collect counter statistics
to present the high level CPI stall breakdown metrics. New metric
group is named as "CPI_STALL_RATIO" and this new metric group
presents these stall metrics:
- DISPATCHED_CPI ( Dispatch stall cycles per insn )
- ISSUE_STALL_CPI ( Issue stall cycles per insn )
- EXECUTION_STALL_CPI ( Execution stall cycles per insn )
- COMPLETION_STALL_CPI ( Completition stall cycles per insn )

To avoid multipling of events, PM_RUN_INST_CMPL event has been
modified to use PMC5(performance monitoring counter5) instead
of PMC4. This change is needed, since completion stall event
is using PMC4.

Usage example:

 ./perf stat --metric-no-group -M CPI_STALL_RATIO <workload>

 Performance counter stats for 'workload':

    63,056,817,982      PM_CMPL_STALL                    #     0.28 COMPLETION_STALL_CPI
 1,743,988,038,896      PM_ISSUE_STALL                   #     7.73 ISSUE_STALL_CPI
   225,597,495,030      PM_RUN_INST_CMPL                 #     6.18 DISPATCHED_CPI
                                                  #    37.48 EXECUTION_STALL_CPI
 1,393,916,546,654      PM_DISP_STALL_CYC
 8,455,376,836,463      PM_EXEC_STALL

"--metric-no-group" is used for forcing PM_RUN_INST_CMPL to be scheduled
in all group for more accuracy.

Signed-off-by: Athira Rajeev <atrajeev@linux•vnet.ibm.com>
---
 tools/perf/pmu-events/arch/powerpc/power10/metrics.json | 8 ++++----
 tools/perf/pmu-events/arch/powerpc/power10/others.json  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
index b57526fa44f2..6f53583a0c62 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
@@ -15,7 +15,7 @@
     {
         "BriefDescription": "Average cycles per completed instruction when dispatch was stalled for any reason",
         "MetricExpr": "PM_DISP_STALL_CYC / PM_RUN_INST_CMPL",
-        "MetricGroup": "CPI",
+        "MetricGroup": "CPI;CPI_STALL_RATIO",
         "MetricName": "DISPATCHED_CPI"
     },
     {
@@ -147,13 +147,13 @@
     {
         "BriefDescription": "Average cycles per completed instruction when the NTC instruction has been dispatched but not issued for any reason",
         "MetricExpr": "PM_ISSUE_STALL / PM_RUN_INST_CMPL",
-        "MetricGroup": "CPI",
+        "MetricGroup": "CPI;CPI_STALL_RATIO",
         "MetricName": "ISSUE_STALL_CPI"
     },
     {
         "BriefDescription": "Average cycles per completed instruction when the NTC instruction is waiting to be finished in one of the execution units",
         "MetricExpr": "PM_EXEC_STALL / PM_RUN_INST_CMPL",
-        "MetricGroup": "CPI",
+        "MetricGroup": "CPI;CPI_STALL_RATIO",
         "MetricName": "EXECUTION_STALL_CPI"
     },
     {
@@ -309,7 +309,7 @@
     {
         "BriefDescription": "Average cycles per completed instruction when the NTC instruction cannot complete because the thread was blocked",
         "MetricExpr": "PM_CMPL_STALL / PM_RUN_INST_CMPL",
-        "MetricGroup": "CPI",
+        "MetricGroup": "CPI;CPI_STALL_RATIO",
         "MetricName": "COMPLETION_STALL_CPI"
     },
     {
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/others.json b/tools/perf/pmu-events/arch/powerpc/power10/others.json
index 7d0de1a2860b..a771e4b6bec5 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/others.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/others.json
@@ -265,7 +265,7 @@
     "BriefDescription": "Load Missed L1, counted at finish time."
   },
   {
-    "EventCode": "0x400FA",
+    "EventCode": "0x500FA",
     "EventName": "PM_RUN_INST_CMPL",
     "BriefDescription": "Completed PowerPC instructions gated by the run latch."
   }
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/perf: Add json metric events to present CPI stall cycles in powerpc
  2023-02-16  6:12 [PATCH] powerpc/perf: Add json metric events to present CPI stall cycles in powerpc Athira Rajeev
@ 2023-02-16 18:10 ` Ian Rogers
  2023-02-17 20:19   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2023-02-16 18:10 UTC (permalink / raw)
  To: Athira Rajeev
  Cc: ak, rnsastry, acme, linux-perf-users, maddy, james.clark, jolsa,
	kjain, namhyung, disgoel, linuxppc-dev

On Wed, Feb 15, 2023 at 10:12 PM Athira Rajeev
<atrajeev@linux•vnet.ibm.com> wrote:
>
> Power10 Performance Monitoring Unit (PMU) provides events
> to understand stall cycles of different pipeline stages.
> These events along with completed instructions provides
> useful metrics for application tuning.
>
> Patch implements the json changes to collect counter statistics
> to present the high level CPI stall breakdown metrics. New metric
> group is named as "CPI_STALL_RATIO" and this new metric group
> presents these stall metrics:
> - DISPATCHED_CPI ( Dispatch stall cycles per insn )
> - ISSUE_STALL_CPI ( Issue stall cycles per insn )
> - EXECUTION_STALL_CPI ( Execution stall cycles per insn )
> - COMPLETION_STALL_CPI ( Completition stall cycles per insn )
>
> To avoid multipling of events, PM_RUN_INST_CMPL event has been
> modified to use PMC5(performance monitoring counter5) instead
> of PMC4. This change is needed, since completion stall event
> is using PMC4.
>
> Usage example:
>
>  ./perf stat --metric-no-group -M CPI_STALL_RATIO <workload>
>
>  Performance counter stats for 'workload':
>
>     63,056,817,982      PM_CMPL_STALL                    #     0.28 COMPLETION_STALL_CPI
>  1,743,988,038,896      PM_ISSUE_STALL                   #     7.73 ISSUE_STALL_CPI
>    225,597,495,030      PM_RUN_INST_CMPL                 #     6.18 DISPATCHED_CPI
>                                                   #    37.48 EXECUTION_STALL_CPI
>  1,393,916,546,654      PM_DISP_STALL_CYC
>  8,455,376,836,463      PM_EXEC_STALL
>
> "--metric-no-group" is used for forcing PM_RUN_INST_CMPL to be scheduled
> in all group for more accuracy.
>
> Signed-off-by: Athira Rajeev <atrajeev@linux•vnet.ibm.com>

Acked-by: Ian Rogers <irogers@google•com>

Thanks,
Ian

> ---
>  tools/perf/pmu-events/arch/powerpc/power10/metrics.json | 8 ++++----
>  tools/perf/pmu-events/arch/powerpc/power10/others.json  | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
> index b57526fa44f2..6f53583a0c62 100644
> --- a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
> +++ b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
> @@ -15,7 +15,7 @@
>      {
>          "BriefDescription": "Average cycles per completed instruction when dispatch was stalled for any reason",
>          "MetricExpr": "PM_DISP_STALL_CYC / PM_RUN_INST_CMPL",
> -        "MetricGroup": "CPI",
> +        "MetricGroup": "CPI;CPI_STALL_RATIO",
>          "MetricName": "DISPATCHED_CPI"
>      },
>      {
> @@ -147,13 +147,13 @@
>      {
>          "BriefDescription": "Average cycles per completed instruction when the NTC instruction has been dispatched but not issued for any reason",
>          "MetricExpr": "PM_ISSUE_STALL / PM_RUN_INST_CMPL",
> -        "MetricGroup": "CPI",
> +        "MetricGroup": "CPI;CPI_STALL_RATIO",
>          "MetricName": "ISSUE_STALL_CPI"
>      },
>      {
>          "BriefDescription": "Average cycles per completed instruction when the NTC instruction is waiting to be finished in one of the execution units",
>          "MetricExpr": "PM_EXEC_STALL / PM_RUN_INST_CMPL",
> -        "MetricGroup": "CPI",
> +        "MetricGroup": "CPI;CPI_STALL_RATIO",
>          "MetricName": "EXECUTION_STALL_CPI"
>      },
>      {
> @@ -309,7 +309,7 @@
>      {
>          "BriefDescription": "Average cycles per completed instruction when the NTC instruction cannot complete because the thread was blocked",
>          "MetricExpr": "PM_CMPL_STALL / PM_RUN_INST_CMPL",
> -        "MetricGroup": "CPI",
> +        "MetricGroup": "CPI;CPI_STALL_RATIO",
>          "MetricName": "COMPLETION_STALL_CPI"
>      },
>      {
> diff --git a/tools/perf/pmu-events/arch/powerpc/power10/others.json b/tools/perf/pmu-events/arch/powerpc/power10/others.json
> index 7d0de1a2860b..a771e4b6bec5 100644
> --- a/tools/perf/pmu-events/arch/powerpc/power10/others.json
> +++ b/tools/perf/pmu-events/arch/powerpc/power10/others.json
> @@ -265,7 +265,7 @@
>      "BriefDescription": "Load Missed L1, counted at finish time."
>    },
>    {
> -    "EventCode": "0x400FA",
> +    "EventCode": "0x500FA",
>      "EventName": "PM_RUN_INST_CMPL",
>      "BriefDescription": "Completed PowerPC instructions gated by the run latch."
>    }
> --
> 2.31.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/perf: Add json metric events to present CPI stall cycles in powerpc
  2023-02-16 18:10 ` Ian Rogers
@ 2023-02-17 20:19   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-02-17 20:19 UTC (permalink / raw)
  To: Ian Rogers
  Cc: ak, rnsastry, maddy, linux-perf-users, Athira Rajeev, james.clark,
	jolsa, kjain, namhyung, disgoel, linuxppc-dev

Em Thu, Feb 16, 2023 at 10:10:05AM -0800, Ian Rogers escreveu:
> On Wed, Feb 15, 2023 at 10:12 PM Athira Rajeev
> <atrajeev@linux•vnet.ibm.com> wrote:
> >
> > Power10 Performance Monitoring Unit (PMU) provides events
> > to understand stall cycles of different pipeline stages.
> > These events along with completed instructions provides
> > useful metrics for application tuning.
> >
> > Patch implements the json changes to collect counter statistics
> > to present the high level CPI stall breakdown metrics. New metric
> > group is named as "CPI_STALL_RATIO" and this new metric group
> > presents these stall metrics:
> > - DISPATCHED_CPI ( Dispatch stall cycles per insn )
> > - ISSUE_STALL_CPI ( Issue stall cycles per insn )
> > - EXECUTION_STALL_CPI ( Execution stall cycles per insn )
> > - COMPLETION_STALL_CPI ( Completition stall cycles per insn )
> >
> > To avoid multipling of events, PM_RUN_INST_CMPL event has been
> > modified to use PMC5(performance monitoring counter5) instead
> > of PMC4. This change is needed, since completion stall event
> > is using PMC4.
> >
> > Usage example:
> >
> >  ./perf stat --metric-no-group -M CPI_STALL_RATIO <workload>
> >
> >  Performance counter stats for 'workload':
> >
> >     63,056,817,982      PM_CMPL_STALL                    #     0.28 COMPLETION_STALL_CPI
> >  1,743,988,038,896      PM_ISSUE_STALL                   #     7.73 ISSUE_STALL_CPI
> >    225,597,495,030      PM_RUN_INST_CMPL                 #     6.18 DISPATCHED_CPI
> >                                                   #    37.48 EXECUTION_STALL_CPI
> >  1,393,916,546,654      PM_DISP_STALL_CYC
> >  8,455,376,836,463      PM_EXEC_STALL
> >
> > "--metric-no-group" is used for forcing PM_RUN_INST_CMPL to be scheduled
> > in all group for more accuracy.
> >
> > Signed-off-by: Athira Rajeev <atrajeev@linux•vnet.ibm.com>
> 
> Acked-by: Ian Rogers <irogers@google•com>

Thanks, applied.

- Arnaldo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-17 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16  6:12 [PATCH] powerpc/perf: Add json metric events to present CPI stall cycles in powerpc Athira Rajeev
2023-02-16 18:10 ` Ian Rogers
2023-02-17 20:19   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox