As mentioned offline, patch 1 is missing previous Marek's Rb, please re-add it before pushing.

Looks good to me.

Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>

On 06/15/2017 02:11 PM, Boyan Ding wrote:
Metrics such as IPC are better represented as floats instead of ints.
This will help query with AMD_performance monitor to return more
useful values instead of 0 and 1s.

Signed-off-by: Boyan Ding <boyan.j.d...@gmail.com>
---
  .../drivers/nouveau/nvc0/nvc0_query_hw_metric.c    | 28 +++++++++++-----------
  1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c
index 6d4deaf2ba..b5de02f9fb 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c
@@ -54,12 +54,12 @@ static const struct nvc0_hw_metric_cfg {
_Q(INST_REPLAY_OVERHEAD,
        "metric-inst_replay_overhead",
-      UINT64,
+      FLOAT,
        "Average number of replays for each instruction executed"),
_Q(ISSUED_IPC,
        "metric-issued_ipc",
-      UINT64,
+      FLOAT,
        "Instructions issued per cycle"),
_Q(ISSUE_SLOTS,
@@ -75,12 +75,12 @@ static const struct nvc0_hw_metric_cfg {
_Q(IPC,
        "metric-ipc",
-      UINT64,
+      FLOAT,
        "Instructions executed per cycle"),
_Q(SHARED_REPLAY_OVERHEAD,
        "metric-shared_replay_overhead",
-      UINT64,
+      FLOAT,
        "Average number of replays due to shared memory conflicts for each "
        "instruction executed"),
@@ -520,12 +520,12 @@ sm20_hw_metric_calc_result(struct nvc0_hw_query *hq, uint64_t res64[8])
     case NVC0_HW_METRIC_QUERY_INST_REPLAY_OVERHEAD:
        /* (inst_issued - inst_executed) / inst_executed */
        if (res64[1])
-         result.u64 = (res64[0] - res64[1]) / (double)res64[1];
+         result.f = (res64[0] - res64[1]) / (double)res64[1];
        break;
     case NVC0_HW_METRIC_QUERY_ISSUED_IPC:
        /* inst_issued / active_cycles */
        if (res64[1])
-         result.u64 = res64[0] / (double)res64[1];
+         result.f = res64[0] / (double)res64[1];
        break;
     case NVC0_HW_METRIC_QUERY_ISSUE_SLOT_UTILIZATION:
        /* ((inst_issued / 2) / active_cycles) * 100 */
@@ -535,7 +535,7 @@ sm20_hw_metric_calc_result(struct nvc0_hw_query *hq, 
uint64_t res64[8])
     case NVC0_HW_METRIC_QUERY_IPC:
        /* inst_executed / active_cycles */
        if (res64[1])
-         result.u64 = res64[0] / (double)res64[1];
+         result.f = res64[0] / (double)res64[1];
        break;
     default:
        debug_printf("invalid metric type: %d\n",
@@ -565,14 +565,14 @@ sm21_hw_metric_calc_result(struct nvc0_hw_query *hq, 
uint64_t res64[8])
     case NVC0_HW_METRIC_QUERY_INST_REPLAY_OVERHEAD:
        /* (metric-inst_issued - inst_executed) / inst_executed */
        if (res64[4])
-         result.u64 = (((res64[0] + res64[1] + (res64[2] + res64[3]) * 2) -
-                         res64[4]) / (double)res64[4]);
+         result.f = (((res64[0] + res64[1] + (res64[2] + res64[3]) * 2) -
+                       res64[4]) / (double)res64[4]);
        break;
     case NVC0_HW_METRIC_QUERY_ISSUED_IPC:
        /* metric-inst_issued / active_cycles */
        if (res64[4])
-         result.u64 = (res64[0] + res64[1] + (res64[2] + res64[3]) * 2) /
-                      (double)res64[4];
+         result.f = (res64[0] + res64[1] + (res64[2] + res64[3]) * 2) /
+                    (double)res64[4];
        break;
     case NVC0_HW_METRIC_QUERY_ISSUE_SLOTS:
        /* issued1_0 + issued1_1 + issued2_0 + issued2_1 */
@@ -617,12 +617,12 @@ sm30_hw_metric_calc_result(struct nvc0_hw_query *hq, 
uint64_t res64[8])
     case NVC0_HW_METRIC_QUERY_INST_REPLAY_OVERHEAD:
        /* (metric-inst_issued - inst_executed) / inst_executed */
        if (res64[2])
-         result.u64 = (((res64[0] + res64[1] * 2) - res64[2]) / 
(double)res64[2]);
+         result.f = (((res64[0] + res64[1] * 2) - res64[2]) / 
(double)res64[2]);
        break;
     case NVC0_HW_METRIC_QUERY_ISSUED_IPC:
        /* metric-inst_issued / active_cycles */
        if (res64[2])
-         result.u64 = (res64[0] + res64[1] * 2) / (double)res64[2];
+         result.f = (res64[0] + res64[1] * 2) / (double)res64[2];
        break;
     case NVC0_HW_METRIC_QUERY_ISSUE_SLOTS:
        /* inst_issued1 + inst_issued2 */
@@ -638,7 +638,7 @@ sm30_hw_metric_calc_result(struct nvc0_hw_query *hq, 
uint64_t res64[8])
     case NVC0_HW_METRIC_QUERY_SHARED_REPLAY_OVERHEAD:
        /* (shared_load_replay + shared_store_replay) / inst_executed */
        if (res64[2])
-         result.u64 = (res64[0] + res64[1]) / (double)res64[2];
+         result.f = (res64[0] + res64[1]) / (double)res64[2];
        break;
     case NVC0_HW_METRIC_QUERY_WARP_EXECUTION_EFFICIENCY:
        /* thread_inst_executed / (inst_executed * max. number of threads per

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to