Add DG2 OA test
Subsystems (2)
cover Add DG2 OA test
Add tests for changes in perf OA for DG2.
v2:
- Rebase
- Reposting since some patches did no land in the ML
Lionel Landwerlin (4):
lib/i915/perf: implement report accumulation for new format lib/i915/perf: fixup conversion script for XEHPSDV lib/i915/perf: make warning message more helpful lib/i915/perf: Add DG2 metrics
Nerlige Ramappa, Umesh (1):
i915/perf: Limit sseu-config tests for gen11
Umesh Nerlige Ramappa (18):
i915/perf: Check regularly if we are done reading reports i915/perf: Fix OA short_reads test
i915/perf: Check return value from getparam i915/perf: Bump timestamp tolerance for DG1 i915/perf: Account for OA sampling interval in polling test i915/perf: Add support for 64-bit counters i915/perf: Define OA report types
i915/perf: Use ARRAY_SIZE consistently for num_properties i915/perf: Use gt in perf tests and lib i915/perf: Explicitly state rendercopy needs for a test i915/perf: Skip tests that use rendercopy i915/perf: Add OA formats for DG2
i915/perf: Add a test for non-power-of-2 oa reports i915/perf: Fix CS timestamp vs OA timstamp mismatch i915/perf: Treat ticks as 64 bit
i915/perf: Treat timestamp as 64 bit value i915/perf: Fix DG2 A0 report header
i915/perf: Wait longer for rc6 residency in DG2
include/drm-uapi/i915_drm.h | 12 + lib/i915/perf-configs/guids.xml | 24 + lib/i915/perf-configs/mdapi-xml-convert.py | 70 +- lib/i915/perf-configs/oa-dg2.xml | 9920 +++++++++++++++++ .../perf-configs/perf-metricset-codegen.py | 13 + lib/i915/perf-configs/update-guids.py | 2 +- lib/i915/perf.c | 104 +- lib/meson.build | 2 +- tests/i915/perf.c | 623 +- 9 files changed, 10589 insertions(+), 181 deletions(-) create mode 100644 lib/i915/perf-configs/oa-dg2.xml
Signature · 1 line
2.25.1
PATCH 1/23 i915/perf: Check regularly if we are done reading reports
If we pass a user buffer as large as the OA buffer, the OA unit will return all available reports. In the second part of the buffer-fill/enable-disable tests, we are collecting all reports within a time window, but we only check the time window in the outer while loop. We may have read well past that window if OA returns more reports. Fix this rare failure by checking for the window within the inner for loop.
--- tests/i915/perf.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tests/i915/perf.c +10 -0
@@ -2522,6 +2522,9 @@ test_buffer_fill(void) first_timestamp = report[1 ]; last_timestamp = report[1 ]; +if (((last_timestamp - first_timestamp) * oa_period) < (fill_duration /2 )) +break ; +if (oa_report_is_periodic (oa_exponent, report)) {memcpy (last_periodic_report, report,sizeof (last_periodic_report));
@@ -2537,6 +2540,8 @@ test_buffer_fill(void)do_ioctl (stream_fd,I915_PERF_IOCTL_DISABLE ,0 ); +igt_debug ("first ts = %u, last ts = %u\n" , first_timestamp, last_timestamp); + igt_debug("%f < %zu < %f\n", report_size * n_full_oa_reports * 0.45, n_periodic_reports * report_size,
@@ -2732,6 +2737,9 @@ test_enable_disable(void)oa_report_is_periodic (oa_exponent, report), oa_report_get_ctx_id(report)); +if (((last_timestamp - first_timestamp) * oa_period) < (fill_duration /2 )) +break ; +if (oa_report_is_periodic (oa_exponent, report)) {memcpy (last_periodic_report, report,sizeof (last_periodic_report));
@@ -2755,6 +2763,8 @@ test_enable_disable(void)do_ioctl (stream_fd,I915_PERF_IOCTL_DISABLE ,0 ); +igt_debug ("first ts = %u, last ts = %u\n" , first_timestamp, last_timestamp); + igt_debug("%f < %zu < %f\n", report_size * n_full_oa_reports * 0.45, n_periodic_reports * report_size,
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 01/23] i915/perf: Check regularly if we are done reading reports
Quoted 8 lines · Umesh Nerlige Ramappa
If we pass a user buffer as large as the OA buffer, the OA unit will return all available reports. In the second part of the buffer-fill/enable-disable tests, we are collecting all reports within a time window, but we only check the time window in the outer while loop. We may have read well past that window if OA returns more reports. Fix this rare failure by checking for the window within the inner for loop.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 46 lines
--- tests/i915/perf.c | 10 ++++++++++ 1 file changed, 10 insertions(+)tests/i915/perf.c +10
-0@@ -2522,6 +2522,9 @@ test_buffer_fill(void) first_timestamp = report[1 ]; last_timestamp = report[1 ]; +if (((last_timestamp - first_timestamp) * oa_period) < (fill_duration /2 )) +break ; +if (oa_report_is_periodic (oa_exponent, report)) {memcpy (last_periodic_report, report,sizeof (last_periodic_report));@@ -2537,6 +2540,8 @@ test_buffer_fill(void)do_ioctl (stream_fd,I915_PERF_IOCTL_DISABLE ,0 ); +igt_debug ("first ts = %u, last ts = %u\n" , first_timestamp, last_timestamp); + igt_debug("%f < %zu < %f\n", report_size * n_full_oa_reports * 0.45, n_periodic_reports * report_size,@@ -2732,6 +2737,9 @@ test_enable_disable(void)oa_report_is_periodic (oa_exponent, report), oa_report_get_ctx_id(report)); +if (((last_timestamp - first_timestamp) * oa_period) < (fill_duration /2 )) +break ; +if (oa_report_is_periodic (oa_exponent, report)) {memcpy (last_periodic_report, report,sizeof (last_periodic_report));@@ -2755,6 +2763,8 @@ test_enable_disable(void)do_ioctl (stream_fd,I915_PERF_IOCTL_DISABLE ,0 ); +igt_debug ("first ts = %u, last ts = %u\n" , first_timestamp, last_timestamp); + igt_debug("%f < %zu < %f\n", report_size * n_full_oa_reports * 0.45, n_periodic_reports * report_size,
PATCH 2/23 i915/perf: Fix OA short_reads test
In reply to Umesh Nerlige RamappaWith 5000 ns oa exponent, report lost errors can occur. A report lost header can be read by the user even when there are no valid OA report samples, so we get an 8 byte read. This defeats the EFAULT check.
When checking for EFAULT on a sampled report, discard any report lost errors.
--- tests/i915/perf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tests/i915/perf.c +6 -1
@@ -2853,8 +2853,13 @@ test_short_reads(void)/* A read that can't return a single record because it would result * in a fault on buffer overrun should result in an EFAULT error... +* +* Make sure to weed out all report lost errors before verifying EFAULT. */ - ret =read (stream_fd, pages + page_size -16 , page_size); + header = (void *)(pages + page_size -16 ); +do { + ret =read (stream_fd, header, page_size); + }while (ret >0 && header->type ==DRM_I915_PERF_RECORD_OA_REPORT_LOST );igt_assert_eq (ret,-1 );igt_assert_eq (errno,EFAULT );
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 02/23] i915/perf: Fix OA short_reads test
Quoted 8 lines · Umesh Nerlige Ramappa
With 5000 ns oa exponent, report lost errors can occur. A report lost header can be read by the user even when there are no valid OA report samples, so we get an 8 byte read. This defeats the EFAULT check.
When checking for EFAULT on a sampled report, discard any report lost errors.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 23 lines
--- tests/i915/perf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tests/i915/perf.c +6
-1@@ -2853,8 +2853,13 @@ test_short_reads(void)/* A read that can't return a single record because it would result * in a fault on buffer overrun should result in an EFAULT error... +* +* Make sure to weed out all report lost errors before verifying EFAULT. */ - ret =read (stream_fd, pages + page_size -16 , page_size); + header = (void *)(pages + page_size -16 ); +do { + ret =read (stream_fd, header, page_size); + }while (ret >0 && header->type ==DRM_I915_PERF_RECORD_OA_REPORT_LOST );igt_assert_eq (ret,-1 );igt_assert_eq (errno,EFAULT );
PATCH 3/23 i915/perf: Check return value from getparam
In reply to Umesh Nerlige RamappaIn some cases getparam could fail. Check return from getparam and fail early on.
--- lib/i915/perf.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
lib/i915/perf.c +15 -13
@@ -287,19 +287,16 @@ intel_perf_for_devinfo(uint32_t device_id,return perf; } -static uint32_t -getparam (int drm_fd,uint32_t param) +static int +getparam (int drm_fd,uint32_t param,uint32_t *val) { -struct drm_i915_getparam gp; -int val =-1 ; - -memset (&gp,0 ,sizeof (gp)); - gp.param = param; - gp.value = &val; +struct drm_i915_getparam gp; -perf_ioctl (drm_fd,DRM_IOCTL_I915_GETPARAM , &gp); +memset (&gp,0 ,sizeof (gp)); + gp.param = param; + gp.value = (int *)val; -return val; +return perf_ioctl (drm_fd,DRM_IOCTL_I915_GETPARAM , &gp); } static bool
@@ -415,9 +412,9 @@ open_master_sysfs_dir(int drm_fd)struct intel_perf *intel_perf_for_fd (int drm_fd) { -uint32_t device_id =getparam (drm_fd,I915_PARAM_CHIPSET_ID ); -uint32_t device_revision =getparam (drm_fd,I915_PARAM_REVISION ); -uint32_t timestamp_frequency =getparam (drm_fd,I915_PARAM_CS_TIMESTAMP_FREQUENCY ); +uint32_t device_id; +uint32_t device_revision; +uint32_t timestamp_frequency;uint64_t gt_min_freq;uint64_t gt_max_freq;struct drm_i915_query_topology_info *topology;
@@ -434,6 +431,11 @@ intel_perf_for_fd(int drm_fd) }close (sysfs_dir_fd); +if (getparam (drm_fd,I915_PARAM_CHIPSET_ID , &device_id) || +getparam (drm_fd,I915_PARAM_REVISION , &device_revision) || +getparam (drm_fd,I915_PARAM_CS_TIMESTAMP_FREQUENCY , ×tamp_frequency)) +return NULL ; + topology =query_topology (drm_fd);if (!topology)return NULL ;
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 03/23] i915/perf: Check return value from getparam
Quoted 4 lines · Umesh Nerlige Ramappa
In some cases getparam could fail. Check return from getparam and fail early on.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Something is odd with the indentation but otherwise :
Quoted 60 lines
--- lib/i915/perf.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)lib/i915/perf.c +15
-13@@ -287,19 +287,16 @@ intel_perf_for_devinfo(uint32_t device_id,return perf; } -static uint32_t -getparam (int drm_fd,uint32_t param) +static int +getparam (int drm_fd,uint32_t param,uint32_t *val) { -struct drm_i915_getparam gp; -int val =-1 ; - -memset (&gp,0 ,sizeof (gp)); - gp.param = param; - gp.value = &val; +struct drm_i915_getparam gp; -perf_ioctl (drm_fd,DRM_IOCTL_I915_GETPARAM , &gp); +memset (&gp,0 ,sizeof (gp)); + gp.param = param; + gp.value = (int *)val; -return val; +return perf_ioctl (drm_fd,DRM_IOCTL_I915_GETPARAM , &gp); } static bool@@ -415,9 +412,9 @@ open_master_sysfs_dir(int drm_fd)struct intel_perf *intel_perf_for_fd (int drm_fd) { -uint32_t device_id =getparam (drm_fd,I915_PARAM_CHIPSET_ID ); -uint32_t device_revision =getparam (drm_fd,I915_PARAM_REVISION ); -uint32_t timestamp_frequency =getparam (drm_fd,I915_PARAM_CS_TIMESTAMP_FREQUENCY ); +uint32_t device_id; +uint32_t device_revision; +uint32_t timestamp_frequency;uint64_t gt_min_freq;uint64_t gt_max_freq;struct drm_i915_query_topology_info *topology;@@ -434,6 +431,11 @@ intel_perf_for_fd(int drm_fd) }close (sysfs_dir_fd); +if (getparam (drm_fd,I915_PARAM_CHIPSET_ID , &device_id) || +getparam (drm_fd,I915_PARAM_REVISION , &device_revision) || +getparam (drm_fd,I915_PARAM_CS_TIMESTAMP_FREQUENCY , ×tamp_frequency)) +return NULL ; + topology =query_topology (drm_fd);if (!topology)return NULL ;
PATCH 4/23 i915/perf: Limit sseu-config tests for gen11
In reply to Umesh Nerlige RamappaFrom: "Nerlige Ramappa, Umesh" <[email protected]>
On Gen11, the Media driver will need to limit dispatch to only big subslices (usually half the EUs depending on EU fusing). If media, render and OA are running in parallel, then OA will lose the NOA config because half of the EUs will be turned off by media. To avoid this with concurrent use cases, an sseu config to keep all EUs powered on is passed to OA in the i915_perf_open_ioctl params. This configuration is made part of the render contexts, so that it's applied when 3d contexts are running. Since this is an issue on gen11, limit sseu-config tests to gen11.
--- tests/i915/perf.c | 1 + 1 file changed, 1 insertion(+)
tests/i915/perf.c +1 -0
@@ -5112,6 +5112,7 @@ igt_main igt_subtest_group { igt_fixture {igt_require (i915_perf_revision (drm_fd) >=4 ); +igt_require (intel_gen (devid) ==11 ); }igt_describe ("Verify invalid SSEU opening parameters" );
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 04/23] i915/perf: Limit sseu-config tests for gen11
Quoted 12 lines · Umesh Nerlige Ramappa
From: "Nerlige Ramappa, Umesh" <[email protected]>
On Gen11, the Media driver will need to limit dispatch to only big subslices (usually half the EUs depending on EU fusing). If media, render and OA are running in parallel, then OA will lose the NOA config because half of the EUs will be turned off by media. To avoid this with concurrent use cases, an sseu config to keep all EUs powered on is passed to OA in the
i915_perf_open_ioctlparams. This configuration is made part of the render contexts, so that it's applied when 3d contexts are running. Since this is an issue on gen11, limit sseu-config tests to gen11.
Quoted 1 line
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 16 lines
--- tests/i915/perf.c | 1 + 1 file changed, 1 insertion(+)tests/i915/perf.c +1
-0@@ -5112,6 +5112,7 @@ igt_main igt_subtest_group { igt_fixture {igt_require (i915_perf_revision (drm_fd) >=4 ); +igt_require (intel_gen (devid) ==11 ); }igt_describe ("Verify invalid SSEU opening parameters" );
PATCH 5/23 i915/perf: Bump timestamp tolerance for DG1
In reply to Umesh Nerlige RamappaTimestamp deltas obtained from the batch vs the delta obtained from oa reports have a delta that's between 4 to 5 us in DG1. Adjust the test accordingly.
--- tests/i915/perf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tests/i915/perf.c +3 -2
@@ -4084,8 +4084,9 @@ static void gen12_single_ctx_helper(void) delta_delta = delta_ts64_ns > delta_oa32_ns ? (delta_ts64_ns - delta_oa32_ns) : (delta_oa32_ns - delta_ts64_ns); -if (delta_delta >500 ) { -igt_debug ("delta_delta exceeds margin, skipping..\n" ); +if (delta_delta >5000 ) { +igt_debug ("delta_delta = %d. exceeds margin, skipping..\n" , + delta_delta);exit (EAGAIN ); }
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 05/23] i915/perf: Bump timestamp tolerance for DG1
Quoted 5 lines · Umesh Nerlige Ramappa
Timestamp deltas obtained from the batch vs the delta obtained from oa reports have a delta that's between 4 to 5 us in DG1. Adjust the test accordingly.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
It's odd...
4/5us between 2 commands that follow each other exactly in a command stream?
Even if the PIPE_CONTROL stalls, it's supposed to write the timestamp after it's done stalling.
And the MI_REPORT_PERF_COUNT command is just after.
If you're sure there is no other explanation : Reviewed-by: Lionel Landwerlin <[email protected]>
Quoted 20 lines
--- tests/i915/perf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tests/i915/perf.c +3
-2@@ -4084,8 +4084,9 @@ static void gen12_single_ctx_helper(void) delta_delta = delta_ts64_ns > delta_oa32_ns ? (delta_ts64_ns - delta_oa32_ns) : (delta_oa32_ns - delta_ts64_ns); -if (delta_delta >500 ) { -igt_debug ("delta_delta exceeds margin, skipping..\n" ); +if (delta_delta >5000 ) { +igt_debug ("delta_delta = %d. exceeds margin, skipping..\n" , + delta_delta);exit (EAGAIN ); }
Re: [igt-dev] [PATCH i-g-t 05/23] i915/perf: Bump timestamp tolerance for DG1
Quoted 9 lines · Lionel Landwerlin
Quoted 5 lines · Umesh Nerlige Ramappa
Timestamp deltas obtained from the batch vs the delta obtained from oa reports have a delta that's between 4 to 5 us in DG1. Adjust the test accordingly.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>It's odd...
Quoted 8 lines
4/5us between 2 commands that follow each other exactly in a command stream?
Even if the
PIPE_CONTROLstalls, it's supposed to write the timestamp after it's done stalling.And the
MI_REPORT_PERF_COUNTcommand is just after.If you're sure there is no other explanation : Reviewed-by: Lionel Landwerlin <[email protected]>
Hmm, I debugged this a while ago. I will give it a quick retry and see if it's still the same issue.
Quoted 23 lines
Quoted 21 lines
--- tests/i915/perf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tests/i915/perf.c +3
-2@@ -4084,8 +4084,9 @@ static void gen12_single_ctx_helper(void) delta_delta = delta_ts64_ns > delta_oa32_ns ? (delta_ts64_ns - delta_oa32_ns) : (delta_oa32_ns - delta_ts64_ns); -if (delta_delta >500 ) { -igt_debug ("delta_delta exceeds margin, skipping..\n" ); +if (delta_delta >5000 ) { +igt_debug ("delta_delta = %d. exceeds margin, skipping..\n" , + delta_delta);exit (EAGAIN ); }
PATCH 6/23 i915/perf: Account for OA sampling interval in polling test
In reply to Umesh Nerlige RamappaThe polling test reads all the reports and then expects EAGAIN on a subsequent read since it has consumed all available data. This works well for OA sampling periods in the order of 10s of ms. For smaller sampling periods like 500 us, we end up reading valid data and the test fails. Fix the check to account for the OA sampling period.
--- tests/i915/perf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
tests/i915/perf.c +12 -4
@@ -2220,14 +2220,22 @@ test_polling(uint64_t requested_oa_period, bool set_kernel_hrtimer, uint64_t ker n_extra_iterations++;/* At this point, after consuming pending reports (and hoping -* the scheduler hasn't stopped us for too long we now -* expect EAGAIN on read. +* the scheduler hasn't stopped us for too long) we now expect +* EAGAIN on read. While this works most of the times, there are +* some rare failures when the OA period passed to this test is +* very small (say 500 us) and that results in some valid +* reports here. To weed out those rare occurences we assert +* only if the OA period is >= 40 ms because 40 ms has withstood +* the test of time on most platforms (ref: subtest: polling). */ while ((ret =read (stream_fd, buf,sizeof (buf))) <0 && errno ==EINTR ) ; -igt_assert_eq (ret,-1 ); -igt_assert_eq (errno,EAGAIN ); + +if (requested_oa_period >=40000000 ) { +igt_assert_eq (ret,-1 ); +igt_assert_eq (errno,EAGAIN ); + } n++; }
Signature · 1 line
2.25.1
PATCH 7/23 i915/perf: Add support for 64-bit counters
In reply to Umesh Nerlige RamappaAdd support for 64-bit counters.
--- tests/i915/perf.c | 70 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 7 deletions(-)
tests/i915/perf.c +63 -7
@@ -101,6 +101,8 @@ struct oa_format {int a40_high_off;/* bytes */ int a40_low_off;int n_a40; +int a64_off; +int n_a64;int a_off;int n_a;int first_a;
@@ -455,7 +457,7 @@ max_oa_exponent_for_freq_gt(uint64_t frequency)static uint64_t oa_exponent_to_ns (int exponent) { -return 1000000000ULL * (2ULL << exponent) / intel_perf->devinfo.timestamp_frequency; +return 1000000000ULL * (2ULL << exponent) / intel_perf->devinfo.timestamp_frequency; } static bool
@@ -658,6 +660,15 @@ gen8_read_40bit_a_counter(const uint32_t *report,return a40_low[a_id] | high; } +static uint64_t +gen12_read_64bit_a_counter (const uint32_t *report,enum drm_i915_oa_format fmt,int a_id) +{ +struct oa_format format =get_oa_format (fmt); +uint64_t *a64 = (uint64_t *)(((uint8_t *)report) + format.a64_off); + +return a64[a_id]; +} +static uint64_t gen8_40bit_a_delta (uint64_t value0,uint64_t value1) {
@@ -670,8 +681,8 @@ gen8_40bit_a_delta(uint64_t value0, uint64_t value1)static void accumulate_uint32 (size_t offset,uint32_t *report0, -uint32_t *report1, -uint64_t *delta) +uint32_t *report1, +uint64_t *delta) {uint32_t value0 = *(uint32_t *)(((uint8_t *)report0) + offset);uint32_t value1 = *(uint32_t *)(((uint8_t *)report1) + offset);
@@ -681,10 +692,10 @@ accumulate_uint32(size_t offset,static void accumulate_uint40 (int a_index, -uint32_t *report0, -uint32_t *report1, +uint32_t *report0, +uint32_t *report1,enum drm_i915_oa_format format, -uint64_t *delta) +uint64_t *delta) {uint64_t value0 =gen8_read_40bit_a_counter (report0, format, a_index), value1 =gen8_read_40bit_a_counter (report1, format, a_index);
@@ -692,6 +703,19 @@ accumulate_uint40(int a_index, *delta +=gen8_40bit_a_delta (value0, value1); } +static void +accumulate_uint64 (int a_index, +const uint32_t *report0, +const uint32_t *report1, +enum drm_i915_oa_format format, +uint64_t *delta) +{ +uint64_t value0 =gen12_read_64bit_a_counter (report0, format, a_index), + value1 =gen12_read_64bit_a_counter (report1, format, a_index); + + *delta += (value1 - value0); +} + static void accumulate_reports(struct accumulator *accumulator, uint32_t *start,
@@ -717,6 +741,11 @@ accumulate_reports(struct accumulator *accumulator, deltas + idx++); } +for (int i =0 ; i < format.n_a64; i++) { +accumulate_uint64 (i, start, end, accumulator->format, + deltas + idx++); + } +for (int i =0 ; i < format.n_a; i++) {accumulate_uint32 (format.a_off +4 * i, start, end, deltas + idx++);
@@ -747,6 +776,9 @@ accumulator_print(struct accumulator *accumulator, const char *title)for (int i =0 ; i < format.n_a40; i++)igt_debug ("\tA%u = %" PRIu64"\n" , i, deltas[idx++]); + +for (int i =0 ; i < format.n_a64; i++) +igt_debug ("\tA64_%u = %" PRIu64"\n" , i, deltas[idx++]); }else {igt_debug ("\ttime delta = %" PRIu64"\n" , deltas[idx++]); }
@@ -803,7 +835,19 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0,if (undefined_a_counters[j])continue ; -igt_debug ("A%d: delta = %" PRIu64"\n" , j, delta); +igt_debug ("A40_%d: delta = %" PRIu64"\n" , j, delta); +igt_assert (delta <= max_delta); + } + +for (int j =0 ; j < format.n_a64; j++) { +uint64_t delta =0 ; + +accumulate_uint64 (j, oa_report0, oa_report1, fmt, &delta); + +if (undefined_a_counters[j]) +continue ; + +igt_debug ("A64_%d: delta = %" PRIu64"\n" , format.first_a + j, delta);igt_assert (delta <= max_delta); }
@@ -1368,6 +1412,18 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) j, value0, value1, delta); } +for (int j =0 ; j < format.n_a64; j++) { +uint64_t value0 =gen12_read_64bit_a_counter (oa_report0, fmt, j); +uint64_t value1 =gen12_read_64bit_a_counter (oa_report1, fmt, j); +uint64_t delta = value1 - value0; + +if (undefined_a_counters[j]) +continue ; + +igt_debug ("A_64%d: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , + format.first_a + j, value0, value1, delta); + } +for (int j =0 ; j < format.n_a; j++) {uint32_t *a0 = (uint32_t *)(((uint8_t *)oa_report0) + format.a_off);
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 07/23] i915/perf: Add support for 64-bit counters
Quoted 3 lines · Umesh Nerlige Ramappa
Add support for 64-bit counters.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
With the unnecessary changes removed :
Quoted 18 lines
--- tests/i915/perf.c | 70 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 7 deletions(-)tests/i915/perf.c +2
-0@@ -101,6 +101,8 @@ struct oa_format {int a40_high_off;/* bytes */ int a40_low_off;int n_a40; +int a64_off; +int n_a64;int a_off;int n_a;int first_a;
tests/i915/perf.c max_oa_exponent_for_freq_gt(uint64_t frequency) · line 460
Quoted 5 lines
tests/i915/perf.c +1
-1@@ -455,7 +457,7 @@ max_oa_exponent_for_freq_gt(uint64_t frequency)static uint64_t oa_exponent_to_ns (int exponent) { -return 1000000000ULL * (2ULL << exponent) / intel_perf->devinfo.timestamp_frequency; +return 1000000000ULL * (2ULL << exponent) / intel_perf->devinfo.timestamp_frequency;
Can't see any change on the line above.
Quoted 20 lines
tests/i915/perf.c +9
-0} static bool@@ -658,6 +660,15 @@ gen8_read_40bit_a_counter(const uint32_t *report,return a40_low[a_id] | high; } +static uint64_t +gen12_read_64bit_a_counter (const uint32_t *report,enum drm_i915_oa_format fmt,int a_id) +{ +struct oa_format format =get_oa_format (fmt); +uint64_t *a64 = (uint64_t *)(((uint8_t *)report) + format.a64_off); + +return a64[a_id]; +} +static uint64_t gen8_40bit_a_delta (uint64_t value0,uint64_t value1) {
tests/i915/perf.c gen8_40bit_a_delta(uint64_t value0, uint64_t value1) · line 685
Quoted 7 lines
tests/i915/perf.c +2
-2@@ -670,8 +681,8 @@ gen8_40bit_a_delta(uint64_t value0, uint64_t value1)static void accumulate_uint32 (size_t offset,uint32_t *report0, -uint32_t *report1, -uint64_t *delta) +uint32_t *report1, +uint64_t *delta)
This hunk appears to just be noise.
Quoted 4 lines
tests/i915/perf.c +0
-0{uint32_t value0 = *(uint32_t *)(((uint8_t *)report0) + offset);uint32_t value1 = *(uint32_t *)(((uint8_t *)report1) + offset);
tests/i915/perf.c accumulate_uint32(size_t offset, · line 698
Quoted 10 lines
tests/i915/perf.c +3
-3@@ -681,10 +692,10 @@ accumulate_uint32(size_t offset,static void accumulate_uint40 (int a_index, -uint32_t *report0, -uint32_t *report1, +uint32_t *report0, +uint32_t *report1,enum drm_i915_oa_format format, -uint64_t *delta) +uint64_t *delta)
Here too
Quoted 85 lines
tests/i915/perf.c +46
-1{uint64_t value0 =gen8_read_40bit_a_counter (report0, format, a_index), value1 =gen8_read_40bit_a_counter (report1, format, a_index);@@ -692,6 +703,19 @@ accumulate_uint40(int a_index, *delta +=gen8_40bit_a_delta (value0, value1); } +static void +accumulate_uint64 (int a_index, +const uint32_t *report0, +const uint32_t *report1, +enum drm_i915_oa_format format, +uint64_t *delta) +{ +uint64_t value0 =gen12_read_64bit_a_counter (report0, format, a_index), + value1 =gen12_read_64bit_a_counter (report1, format, a_index); + + *delta += (value1 - value0); +} + static void accumulate_reports(struct accumulator *accumulator, uint32_t *start,@@ -717,6 +741,11 @@ accumulate_reports(struct accumulator *accumulator, deltas + idx++); } +for (int i =0 ; i < format.n_a64; i++) { +accumulate_uint64 (i, start, end, accumulator->format, + deltas + idx++); + } +for (int i =0 ; i < format.n_a; i++) {accumulate_uint32 (format.a_off +4 * i, start, end, deltas + idx++);@@ -747,6 +776,9 @@ accumulator_print(struct accumulator *accumulator, const char *title)for (int i =0 ; i < format.n_a40; i++)igt_debug ("\tA%u = %" PRIu64"\n" , i, deltas[idx++]); + +for (int i =0 ; i < format.n_a64; i++) +igt_debug ("\tA64_%u = %" PRIu64"\n" , i, deltas[idx++]); }else {igt_debug ("\ttime delta = %" PRIu64"\n" , deltas[idx++]); }@@ -803,7 +835,19 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0,if (undefined_a_counters[j])continue ; -igt_debug ("A%d: delta = %" PRIu64"\n" , j, delta); +igt_debug ("A40_%d: delta = %" PRIu64"\n" , j, delta); +igt_assert (delta <= max_delta); + } + +for (int j =0 ; j < format.n_a64; j++) { +uint64_t delta =0 ; + +accumulate_uint64 (j, oa_report0, oa_report1, fmt, &delta); + +if (undefined_a_counters[j]) +continue ; + +igt_debug ("A64_%d: delta = %" PRIu64"\n" , format.first_a + j, delta);igt_assert (delta <= max_delta); }@@ -1368,6 +1412,18 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) j, value0, value1, delta); } +for (int j =0 ; j < format.n_a64; j++) { +uint64_t value0 =gen12_read_64bit_a_counter (oa_report0, fmt, j); +uint64_t value1 =gen12_read_64bit_a_counter (oa_report1, fmt, j); +uint64_t delta = value1 - value0; + +if (undefined_a_counters[j]) +continue ; + +igt_debug ("A_64%d: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , + format.first_a + j, value0, value1, delta); + } +for (int j =0 ; j < format.n_a; j++) {uint32_t *a0 = (uint32_t *)(((uint8_t *)oa_report0) + format.a_off);
Re: [igt-dev] [PATCH i-g-t 07/23] i915/perf: Add support for 64-bit counters
Quoted 6 lines · Lionel Landwerlin
Quoted 3 lines · Umesh Nerlige Ramappa
Add support for 64-bit counters.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>With the unnecessary changes removed :
The noise is from minor checkpatch corrections - spaces to tabs in the beginning of the line. I agree, it's not relevant to this patch.
Do you still want me to remove them? I am okay either ways.
Thanks,
Umesh
Quoted 150 lines
Reviewed-by Lionel Landwerlin <[email protected]>Quoted 18 lines
--- tests/i915/perf.c | 70 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 7 deletions(-)tests/i915/perf.c +2
-0@@ -101,6 +101,8 @@ struct oa_format {int a40_high_off;/* bytes */ int a40_low_off;int n_a40; +int a64_off; +int n_a64;int a_off;int n_a;int first_a;tests/i915/perf.c max_oa_exponent_for_freq_gt(uint64_t frequency) · line 460
Quoted 5 lines
tests/i915/perf.c +1
-1@@ -455,7 +457,7 @@ max_oa_exponent_for_freq_gt(uint64_t frequency)static uint64_t oa_exponent_to_ns (int exponent) { -return 1000000000ULL * (2ULL << exponent) / intel_perf->devinfo.timestamp_frequency; +return 1000000000ULL * (2ULL << exponent) / intel_perf->devinfo.timestamp_frequency;Can't see any change on the line above.
Quoted 18 lines
tests/i915/perf.c +9
-0} static bool@@ -658,6 +660,15 @@ gen8_read_40bit_a_counter(const uint32_t *report,return a40_low[a_id] | high; } +static uint64_t +gen12_read_64bit_a_counter (const uint32_t *report,enum drm_i915_oa_format fmt,int a_id) +{ +struct oa_format format =get_oa_format (fmt); +uint64_t *a64 = (uint64_t *)(((uint8_t *)report) + format.a64_off); + +return a64[a_id]; +} +static uint64_t gen8_40bit_a_delta (uint64_t value0,uint64_t value1) {tests/i915/perf.c gen8_40bit_a_delta(uint64_t value0, uint64_t value1) · line 685
Quoted 7 lines
tests/i915/perf.c +2
-2@@ -670,8 +681,8 @@ gen8_40bit_a_delta(uint64_t value0, uint64_t value1)static void accumulate_uint32 (size_t offset,uint32_t *report0, -uint32_t *report1, -uint64_t *delta) +uint32_t *report1, +uint64_t *delta)This hunk appears to just be noise.
tests/i915/perf.c accumulate_uint32(size_t offset, · line 697
Quoted 13 lines
tests/i915/perf.c +3
-3{uint32_t value0 = *(uint32_t *)(((uint8_t *)report0) + offset);uint32_t value1 = *(uint32_t *)(((uint8_t *)report1) + offset);@@ -681,10 +692,10 @@ accumulate_uint32(size_t offset,static void accumulate_uint40 (int a_index, -uint32_t *report0, -uint32_t *report1, +uint32_t *report0, +uint32_t *report1,enum drm_i915_oa_format format, -uint64_t *delta) +uint64_t *delta)Here too
Quoted 79 lines
tests/i915/perf.c +46
-1{uint64_t value0 =gen8_read_40bit_a_counter (report0, format, a_index), value1 =gen8_read_40bit_a_counter (report1, format, a_index);@@ -692,6 +703,19 @@ accumulate_uint40(int a_index, *delta +=gen8_40bit_a_delta (value0, value1); } +static void +accumulate_uint64 (int a_index, +const uint32_t *report0, +const uint32_t *report1, +enum drm_i915_oa_format format, +uint64_t *delta) +{ +uint64_t value0 =gen12_read_64bit_a_counter (report0, format, a_index), + value1 =gen12_read_64bit_a_counter (report1, format, a_index); + + *delta += (value1 - value0); +} + static void accumulate_reports(struct accumulator *accumulator, uint32_t *start,@@ -717,6 +741,11 @@ accumulate_reports(struct accumulator *accumulator, deltas + idx++); } +for (int i =0 ; i < format.n_a64; i++) { +accumulate_uint64 (i, start, end, accumulator->format, + deltas + idx++); + } +for (int i =0 ; i < format.n_a; i++) {accumulate_uint32 (format.a_off +4 * i, start, end, deltas + idx++);@@ -747,6 +776,9 @@ accumulator_print(struct accumulator *accumulator, const char *title)for (int i =0 ; i < format.n_a40; i++)igt_debug ("\tA%u = %" PRIu64"\n" , i, deltas[idx++]); + +for (int i =0 ; i < format.n_a64; i++) +igt_debug ("\tA64_%u = %" PRIu64"\n" , i, deltas[idx++]); }else {igt_debug ("\ttime delta = %" PRIu64"\n" , deltas[idx++]); }@@ -803,7 +835,19 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0,if (undefined_a_counters[j])continue ; -igt_debug ("A%d: delta = %" PRIu64"\n" , j, delta); +igt_debug ("A40_%d: delta = %" PRIu64"\n" , j, delta); +igt_assert (delta <= max_delta); + } + +for (int j =0 ; j < format.n_a64; j++) { +uint64_t delta =0 ; + +accumulate_uint64 (j, oa_report0, oa_report1, fmt, &delta); + +if (undefined_a_counters[j]) +continue ; + +igt_debug ("A64_%d: delta = %" PRIu64"\n" , format.first_a + j, delta);igt_assert (delta <= max_delta); }@@ -1368,6 +1412,18 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) j, value0, value1, delta); } +for (int j =0 ; j < format.n_a64; j++) { +uint64_t value0 =gen12_read_64bit_a_counter (oa_report0, fmt, j); +uint64_t value1 =gen12_read_64bit_a_counter (oa_report1, fmt, j); +uint64_t delta = value1 - value0; + +if (undefined_a_counters[j]) +continue ; + +igt_debug ("A_64%d: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , + format.first_a + j, value0, value1, delta); + } +for (int j =0 ; j < format.n_a; j++) {uint32_t *a0 = (uint32_t *)(((uint8_t *)oa_report0) + format.a_off);
Re: [igt-dev] [PATCH i-g-t 07/23] i915/perf: Add support for 64-bit counters
Quoted 6 lines · Umesh Nerlige Ramappa
Quoted 5 lines · Lionel Landwerlin
Quoted 3 lines · Umesh Nerlige Ramappa
Add support for 64-bit counters.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 8 lines
Quoted 1 line
With the unnecessary changes removed :
The noise is from minor checkpatch corrections - spaces to tabs in the beginning of the line. I agree, it's not relevant to this patch.
Do you still want me to remove them? I am okay either ways.
Thanks,
Umesh
I'm not familiar with checkpatch but I'm struggling to see why it would insert random changes like that.
If you ran it on previous patches it would have produced the same isolated changes no?
It would be best to have single commit doing coding style changes at the beginning or end of the series.
Thanks,
-Lionel
Quoted 166 lines
Quoted 166 lines
Reviewed-by Lionel Landwerlin <[email protected]>Quoted 18 lines
---
tests/i915/perf.c | 70 ++++++++++++++++++++++++++++++++++++++++++-----1 file changed, 63 insertions(+), 7 deletions(-)tests/i915/perf.c +0
-0@@ -101,6 +101,8 @@ struct oa_format {int
a40_high_off; /* bytes */
inta40_low_off;
intn_a40;
+ inta64_off;
+ intn_a64;
inta_off;
intn_a;
intfirst_a;tests/i915/perf.c +0
-0@@ -455,7 +457,7 @@ max_oa_exponent_for_freq_gt(uint64_t frequency)Quoted 7 lines
static
uint64_t
oa_exponent_to_ns(int exponent)
{
- return 1000000000ULL * (2ULL << exponent) /intel_perf->devinfo.timestamp_frequency;
+ return 1000000000ULL * (2ULL << exponent) /intel_perf->devinfo.timestamp_frequency;Can't see any change on the line above.
Quoted 21 lines
}
static booltests/i915/perf.c +9
-0@@ -658,6 +660,15 @@ gen8_read_40bit_a_counter(const uint32_t *report, return a40_low[a_id] | high; } +static uint64_t +gen12_read_64bit_a_counter (const uint32_t *report,enum drm_i915_oa_format fmt,int a_id) +{ + struct oa_format format = get_oa_format(fmt); + uint64_t *a64 = (uint64_t *)(((uint8_t *)report) + format.a64_off); + + return a64[a_id]; +} +static
uint64_t
gen8_40bit_a_delta(uint64_t value0,uint64_tvalue1) {tests/i915/perf.c +0
-0@@ -670,8 +681,8 @@ gen8_40bit_a_delta(uint64_t value0, uint64_t value1)Quoted 7 lines
static void
accumulate_uint32(size_t offset,
uint32_t*report0,
-uint32_t*report1,
-uint64_t*delta)
+uint32_t*report1,
+uint64_t*delta)This hunk appears to just be noise.
Quoted 5 lines
{
uint32_tvalue0 = *(uint32_t *)(((uint8_t *)report0) + offset);uint32_tvalue1 = *(uint32_t *)(((uint8_t *)report1) + offset);tests/i915/perf.c +0
-0@@ -681,10 +692,10 @@ accumulate_uint32(size_t offset,static void
Quoted 8 lines
accumulate_uint40(int
a_index,
-uint32_t*report0,
-uint32_t*report1,
+uint32_t*report0,
+uint32_t*report1,
enumdrm_i915_oa_formatformat,
-uint64_t*delta)
+uint64_t*delta)Here too
Quoted 89 lines
{
uint64_tvalue0 =gen8_read_40bit_a_counter(report0, format, a_index), value1 =gen8_read_40bit_a_counter(report1, format, a_index);tests/i915/perf.c +13
-0@@ -692,6 +703,19 @@ accumulate_uint40(int a_index, *delta += gen8_40bit_a_delta(value0, value1); } +static void +accumulate_uint64 (int a_index, + const uint32_t *report0, + const uint32_t *report1, + enum drm_i915_oa_format format, + uint64_t *delta) +{ + uint64_t value0 = gen12_read_64bit_a_counter(report0, format, a_index), + value1 = gen12_read_64bit_a_counter(report1, format, a_index); + + *delta += (value1 - value0); +} +static void
accumulate_reports(struct accumulator *accumulator,uint32_t*start,tests/i915/perf.c +33
-1@@ -717,6 +741,11 @@ accumulate_reports(struct accumulator *accumulator, deltas + idx++); } + for (int i = 0; i < format.n_a64; i++) { + accumulate_uint64(i, start, end, accumulator->format, + deltas + idx++); + } + for (int i = 0; i < format.n_a; i++) { accumulate_uint32(format.a_off + 4 * i, start, end, deltas + idx++);@@ -747,6 +776,9 @@ accumulator_print(struct accumulator *accumulator, const char *title) for (int i = 0; i < format.n_a40; i++) igt_debug("\tA%u = %"PRIu64"\n", i, deltas[idx++]); + + for (int i = 0; i < format.n_a64; i++) + igt_debug("\tA64_%u = %"PRIu64"\n", i, deltas[idx++]); } else { igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]); }@@ -803,7 +835,19 @@ gen8_sanity_check_test_oa_reports(constuint32_t *oa_report0, if (undefined_a_counters[j]) continue; - igt_debug("A%d: delta = %"PRIu64"\n", j, delta); + igt_debug("A40_%d: delta = %"PRIu64"\n", j, delta); + igt_assert(delta <= max_delta); + } + + for (int j = 0; j < format.n_a64; j++) { + uint64_t delta = 0; + + accumulate_uint64(j, oa_report0, oa_report1, fmt, &delta); + + if (undefined_a_counters[j]) + continue; + + igt_debug("A64_%d: delta = %"PRIu64"\n", format.first_a + j, delta); igt_assert(delta <= max_delta); }@@ -1368,6 +1412,18 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) j, value0, value1, delta); } + for (int j = 0; j < format.n_a64; j++) { + uint64_t value0 = gen12_read_64bit_a_counter(oa_report0, fmt, j); + uint64_t value1 = gen12_read_64bit_a_counter(oa_report1, fmt, j); + uint64_t delta = value1 - value0; + + if (undefined_a_counters[j]) + continue; + + igt_debug("A_64%d: 1st = %"PRIu64", 2nd = %"PRIu64", delta = %"PRIu64"\n", + format.first_a + j, value0, value1, delta); + } +for (int j = 0; j < format.n_a; j++) {
uint32_t*a0 = (uint32_t*)(((uint8_t *)oa_report0) + format.a_off);
Re: [igt-dev] [PATCH i-g-t 07/23] i915/perf: Add support for 64-bit counters
Quoted 17 lines · Lionel Landwerlin
Quoted 6 lines · Umesh Nerlige Ramappa
Quoted 5 lines · Lionel Landwerlin
Quoted 3 lines · Umesh Nerlige Ramappa
Add support for 64-bit counters.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>Quoted 8 lines
Quoted 1 line
With the unnecessary changes removed :
The noise is from minor checkpatch corrections - spaces to tabs in the beginning of the line. I agree, it's not relevant to this patch.
Do you still want me to remove them? I am okay either ways.
Thanks,
Umesh
Quoted 5 lines
I'm not familiar with checkpatch but I'm struggling to see why it would insert random changes like that.
If you ran it on previous patches it would have produced the same isolated changes no?
It would be best to have single commit doing coding style changes at the beginning or end of the series.
I am going to drop the coding style changes here and follow that up as a separate series since it's not relevant here.
Thanks,
Umesh
Quoted 175 lines
Thanks,
-Lionel
Quoted 166 lines
Quoted 166 lines
Reviewed-by Lionel Landwerlin <[email protected]>Quoted 18 lines
---
tests/i915/perf.c | 70 ++++++++++++++++++++++++++++++++++++++++++-----1 file changed, 63 insertions(+), 7 deletions(-)tests/i915/perf.c +0
-0@@ -101,6 +101,8 @@ struct oa_format {int
a40_high_off; /* bytes */
inta40_low_off;
intn_a40;
+ inta64_off;
+ intn_a64;
inta_off;
intn_a;
intfirst_a;tests/i915/perf.c +0
-0@@ -455,7 +457,7 @@ max_oa_exponent_for_freq_gt(uint64_t frequency)Quoted 7 lines
static
uint64_t
oa_exponent_to_ns(int exponent)
{
- return 1000000000ULL * (2ULL << exponent) /intel_perf->devinfo.timestamp_frequency;
+ return 1000000000ULL * (2ULL << exponent) /intel_perf->devinfo.timestamp_frequency;Can't see any change on the line above.
Quoted 21 lines
}
static booltests/i915/perf.c +9
-0@@ -658,6 +660,15 @@ gen8_read_40bit_a_counter(const uint32_t *report, return a40_low[a_id] | high; } +static uint64_t +gen12_read_64bit_a_counter (const uint32_t *report,enum drm_i915_oa_format fmt,int a_id) +{ + struct oa_format format = get_oa_format(fmt); + uint64_t *a64 = (uint64_t *)(((uint8_t *)report) + format.a64_off); + + return a64[a_id]; +} +static
uint64_t
gen8_40bit_a_delta(uint64_t value0,uint64_tvalue1) {tests/i915/perf.c +0
-0@@ -670,8 +681,8 @@ gen8_40bit_a_delta(uint64_t value0, uint64_t value1)Quoted 7 lines
static void
accumulate_uint32(size_t offset,
uint32_t*report0,
-uint32_t*report1,
-uint64_t*delta)
+uint32_t*report1,
+uint64_t*delta)This hunk appears to just be noise.
Quoted 5 lines
{
uint32_tvalue0 = *(uint32_t *)(((uint8_t *)report0) + offset);uint32_tvalue1 = *(uint32_t *)(((uint8_t *)report1) + offset);tests/i915/perf.c +0
-0@@ -681,10 +692,10 @@ accumulate_uint32(size_t offset,static void
Quoted 8 lines
accumulate_uint40(int
a_index,
-uint32_t*report0,
-uint32_t*report1,
+uint32_t*report0,
+uint32_t*report1,
enumdrm_i915_oa_formatformat,
-uint64_t*delta)
+uint64_t*delta)Here too
Quoted 89 lines
{
uint64_tvalue0 =gen8_read_40bit_a_counter(report0, format, a_index), value1 =gen8_read_40bit_a_counter(report1, format, a_index);tests/i915/perf.c +13
-0@@ -692,6 +703,19 @@ accumulate_uint40(int a_index, *delta += gen8_40bit_a_delta(value0, value1); } +static void +accumulate_uint64 (int a_index, + const uint32_t *report0, + const uint32_t *report1, + enum drm_i915_oa_format format, + uint64_t *delta) +{ + uint64_t value0 = gen12_read_64bit_a_counter(report0, format, a_index), + value1 = gen12_read_64bit_a_counter(report1, format, a_index); + + *delta += (value1 - value0); +} +static void
accumulate_reports(struct accumulator *accumulator,uint32_t*start,tests/i915/perf.c +34
-1@@ -717,6 +741,11 @@ accumulate_reports(struct accumulator *accumulator, deltas + idx++); } + for (int i = 0; i < format.n_a64; i++) { + accumulate_uint64(i, start, end, accumulator->format, + deltas + idx++); + } + for (int i = 0; i < format.n_a; i++) { accumulate_uint32(format.a_off + 4 * i, start, end, deltas + idx++);@@ -747,6 +776,9 @@ accumulator_print(struct accumulator *accumulator, const char *title) for (int i = 0; i < format.n_a40; i++) igt_debug("\tA%u = %"PRIu64"\n", i, deltas[idx++]); + + for (int i = 0; i < format.n_a64; i++) + igt_debug("\tA64_%u = %"PRIu64"\n", i, deltas[idx++]); } else { igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]); }@@ -803,7 +835,19 @@ gen8_sanity_check_test_oa_reports(constuint32_t *oa_report0, if (undefined_a_counters[j]) continue; - igt_debug("A%d: delta = %"PRIu64"\n", j, delta); + igt_debug("A40_%d: delta = %"PRIu64"\n", j, delta); + igt_assert(delta <= max_delta); + } + + for (int j = 0; j < format.n_a64; j++) { + uint64_t delta = 0; + + accumulate_uint64(j, oa_report0, oa_report1, fmt, &delta); + + if (undefined_a_counters[j]) + continue; + + igt_debug("A64_%d: delta = %"PRIu64"\n", format.first_a + j, delta); igt_assert(delta <= max_delta); }@@ -1368,6 +1412,18 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) j, value0, value1, delta); } + for (int j = 0; j < format.n_a64; j++) { + uint64_t value0 =gen12_read_64bit_a_counter (oa_report0, fmt, j); + uint64_t value1 =gen12_read_64bit_a_counter (oa_report1, fmt, j); + uint64_t delta = value1 - value0; + + if (undefined_a_counters[j]) + continue; + + igt_debug("A_64%d: 1st = %"PRIu64", 2nd = %"PRIu64", delta = %"PRIu64"\n", + format.first_a + j, value0, value1, delta); + } +for (int j = 0; j < format.n_a; j++) {
uint32_t*a0 = (uint32_t*)(((uint8_t *)oa_report0) + format.a_off);
PATCH 8/23 i915/perf: Define OA report types
In reply to Umesh Nerlige RamappaDifferentiate between OAG and OAR format types for tests like oa-formats.
--- tests/i915/perf.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tests/i915/perf.c +11 -0
@@ -95,6 +95,13 @@ struct accumulator {uint64_t deltas[MAX_RAW_OA_COUNTERS ]; }; +enum { +OAG , +OAR , + +MAX_OA_TYPE , +}; +struct oa_format {const char *name;size_t size;
@@ -110,6 +117,7 @@ struct oa_format {int n_b;int c_off;int n_c; +int oa_type; };static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX ] = {
@@ -1539,6 +1547,9 @@ test_oa_formats(void)if (!format.name)/* sparse, indexed by ID */ continue ; +if (format.oa_type !=OAG )/* sparse, indexed by ID */ +continue ; +igt_debug ("Checking OA format %s\n" , format.name); open_and_read_2_oa_reports(i,
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 08/23] i915/perf: Define OA report types
Quoted 35 lines · Umesh Nerlige Ramappa
Differentiate between OAG and OAR format types for tests like oa-formats.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- tests/i915/perf.c | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/i915/perf.c +8
-0@@ -95,6 +95,13 @@ struct accumulator {uint64_t deltas[MAX_RAW_OA_COUNTERS ]; }; +enum { +OAG , +OAR , + +MAX_OA_TYPE , +}; +struct oa_format {const char *name;size_t size;@@ -110,6 +117,7 @@ struct oa_format {int n_b;int c_off;int n_c; +int oa_type; };static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX ] = {
tests/i915/perf.c test_oa_formats(void) · line 1552
Quoted 6 lines
tests/i915/perf.c +3
-0@@ -1539,6 +1547,9 @@ test_oa_formats(void)if (!format.name)/* sparse, indexed by ID */ continue ; +if (format.oa_type !=OAG )/* sparse, indexed by ID */ +continue ; +
I can't make sense of this comment.
Also you're not going to test OAR reports?
Quoted 3 lines
tests/i915/perf.c +0
-0igt_debug ("Checking OA format %s\n" , format.name); open_and_read_2_oa_reports(i,
Re: [igt-dev] [PATCH i-g-t 08/23] i915/perf: Define OA report types
Quoted 33 lines · Lionel Landwerlin
Quoted 32 lines · Umesh Nerlige Ramappa
Differentiate between OAG and OAR format types for tests like oa-formats.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- tests/i915/perf.c | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/i915/perf.c +8
-0@@ -95,6 +95,13 @@ struct accumulator {uint64_t deltas[MAX_RAW_OA_COUNTERS ]; }; +enum { +OAG , +OAR , + +MAX_OA_TYPE , +}; +struct oa_format {const char *name;size_t size;@@ -110,6 +117,7 @@ struct oa_format {int n_b;int c_off;int n_c; +int oa_type; };static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX ] = {
Quoted 8 lines
tests/i915/perf.c test_oa_formats(void) · line 1551
Quoted 6 lines
tests/i915/perf.c +3
-0@@ -1539,6 +1547,9 @@ test_oa_formats(void)if (!format.name)/* sparse, indexed by ID */ continue ; +if (format.oa_type !=OAG )/* sparse, indexed by ID */ +continue ; +I can't make sense of this comment.
sorry, now that I read the commit msg, it lacks details. The idea is to only test OAG reports in oa-formats test. OAR reports must be tested with the MI RPC command. This was not an issue up until TGL. In later platforms the OAR and OAG formats have subtle differences that would break the sanity check.
Quoted 3 lines
Also you're not going to test OAR reports?
MI RPC should ideally loop over all OAR formats. Currently it uses only one OAR report. Test needs to be updated.
Thanks,
Umesh
Quoted 5 lines
Quoted 3 lines
tests/i915/perf.c +0
-0igt_debug ("Checking OA format %s\n" , format.name); open_and_read_2_oa_reports(i,
PATCH 9/23 i915/perf: Use ARRAY_SIZE consistently for num_properties
In reply to Umesh Nerlige RamappaReplace all variations of calculating the num_properties with ARRAY_SIZE.
--- tests/i915/perf.c | 62 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 32 deletions(-)
tests/i915/perf.c +30 -32
@@ -86,8 +86,6 @@ IGT_TEST_DESCRIPTION("Test the i915 perf metrics streaming interface");#define MAX_OA_BUF_SIZE (16 * 1024 * 1024) -#define NUM_PROPERTIES (p) (sizeof(p) / (2 * sizeof(uint64_t))) -struct accumulator {#define MAX_RAW_OA_COUNTERS 62enum drm_i915_oa_format format;
@@ -1069,7 +1067,7 @@ test_system_wide_paranoid(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1095,7 +1093,7 @@ test_system_wide_paranoid(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };write_u64_file ("/proc/sys/dev/i915/perf_stream_paranoid" ,0 );
@@ -1126,7 +1124,7 @@ test_invalid_open_flags(void) };struct drm_i915_perf_open_param param = { .flags = ~0 ,/* Undefined flag bits set! */ - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1148,7 +1146,7 @@ test_invalid_oa_metric_set_id(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1182,7 +1180,7 @@ test_invalid_oa_format_id(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1214,7 +1212,7 @@ test_missing_sample_flags(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1354,7 +1352,7 @@ open_and_read_2_oa_reports(int format_id, };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1833,7 +1831,7 @@ test_invalid_oa_exponent(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -1868,7 +1866,7 @@ test_low_oa_exponent_permissions(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };uint64_t oa_period, oa_freq;
@@ -1931,7 +1929,7 @@ test_per_context_mode_unprivileged(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -2007,8 +2005,8 @@ test_blocking(uint64_t requested_oa_period, bool set_kernel_hrtimer, uint64_t ke .flags = I915_PERF_FLAG_FD_CLOEXEC | I915_PERF_FLAG_DISABLED, .num_properties = set_kernel_hrtimer ? -NUM_PROPERTIES (properties) : - NUM_PROPERTIES(properties) - 1, +ARRAY_SIZE (properties) /2 : + (ARRAY_SIZE(properties) / 2) - 1, .properties_ptr = to_user_pointer(properties), };uint8_t buf[1024 *1024 ];
@@ -2167,8 +2165,8 @@ test_polling(uint64_t requested_oa_period, bool set_kernel_hrtimer, uint64_t kerI915_PERF_FLAG_DISABLED | I915_PERF_FLAG_FD_NONBLOCK, .num_properties = set_kernel_hrtimer ? -NUM_PROPERTIES (properties) : - NUM_PROPERTIES(properties) - 1, +ARRAY_SIZE (properties) /2 : + (ARRAY_SIZE(properties) / 2) - 1, .properties_ptr = to_user_pointer(properties), };uint8_t buf[1024 *1024 ];
@@ -2358,7 +2356,7 @@ static void test_polling_small_buf(void) .flags = I915_PERF_FLAG_FD_CLOEXEC | I915_PERF_FLAG_DISABLED | I915_PERF_FLAG_FD_NONBLOCK, - .num_properties = NUM_PROPERTIES(properties), + .num_properties = ARRAY_SIZE(properties) / 2, .properties_ptr = to_user_pointer(properties), };uint32_t test_duration =80 *1000 *1000 ;
@@ -2458,7 +2456,7 @@ gen12_test_oa_tlb_invalidate(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };int num_reports1, num_reports2, num_expected_reports;
@@ -2649,7 +2647,7 @@ test_non_zero_reason(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };struct drm_i915_perf_record_header *header;
@@ -2734,7 +2732,7 @@ test_enable_disable(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* Verify we start disabled */ - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };int buf_size =65536 * (256 +sizeof (struct drm_i915_perf_record_header ));
@@ -2883,7 +2881,7 @@ test_short_reads(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };size_t record_size =256 +sizeof (struct drm_i915_perf_record_header );
@@ -2975,7 +2973,7 @@ test_non_sampling_read_error(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };int ret;
@@ -3011,7 +3009,7 @@ test_disabled_read_error(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };uint32_t oa_report0[64 ];
@@ -3168,7 +3166,7 @@ test_mi_rpc(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };struct buf_ops *bops =buf_ops_create (drm_fd);
@@ -3271,7 +3269,7 @@ hsw_test_single_ctx_counters(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -4253,7 +4251,7 @@ test_rc6_disable(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };unsigned long rc6_start, rc6_end, rc6_enabled;
@@ -4309,7 +4307,7 @@ test_stress_open_close(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =NUM_PROPERTIES (properties), + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };
@@ -4405,8 +4403,8 @@ test_global_sseu_config_invalid(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =NUM_PROPERTIES (properties), - .properties_ptr =to_user_pointer (properties), + .num_properties =ARRAY_SIZE (properties) /2 , + .properties_ptr =to_user_pointer (properties), };memset (&default_sseu,0 ,sizeof (default_sseu));
@@ -4480,8 +4478,8 @@ test_global_sseu_config(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =NUM_PROPERTIES (properties), - .properties_ptr =to_user_pointer (properties), + .num_properties =ARRAY_SIZE (properties) /2 , + .properties_ptr =to_user_pointer (properties), };memset (&default_sseu,0 ,sizeof (default_sseu));
@@ -4913,7 +4911,7 @@ test_i915_ref_count(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };unsigned baseline, ref_count0, ref_count1;
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 09/23] i915/perf: Use ARRAY_SIZE consistently for num_properties
Quoted 4 lines · Umesh Nerlige Ramappa
Replace all variations of calculating the
num_propertieswithARRAY_SIZE.Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 259 lines
--- tests/i915/perf.c | 62 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 32 deletions(-)tests/i915/perf.c +30
-32@@ -86,8 +86,6 @@ IGT_TEST_DESCRIPTION("Test the i915 perf metrics streaming interface");#define MAX_OA_BUF_SIZE (16 * 1024 * 1024) -#define NUM_PROPERTIES (p) (sizeof(p) / (2 * sizeof(uint64_t))) -struct accumulator {#define MAX_RAW_OA_COUNTERS 62enum drm_i915_oa_format format;@@ -1069,7 +1067,7 @@ test_system_wide_paranoid(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1095,7 +1093,7 @@ test_system_wide_paranoid(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };write_u64_file ("/proc/sys/dev/i915/perf_stream_paranoid" ,0 );@@ -1126,7 +1124,7 @@ test_invalid_open_flags(void) };struct drm_i915_perf_open_param param = { .flags = ~0 ,/* Undefined flag bits set! */ - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1148,7 +1146,7 @@ test_invalid_oa_metric_set_id(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1182,7 +1180,7 @@ test_invalid_oa_format_id(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_FD_NONBLOCK , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1214,7 +1212,7 @@ test_missing_sample_flags(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1354,7 +1352,7 @@ open_and_read_2_oa_reports(int format_id, };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1833,7 +1831,7 @@ test_invalid_oa_exponent(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -1868,7 +1866,7 @@ test_low_oa_exponent_permissions(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };uint64_t oa_period, oa_freq;@@ -1931,7 +1929,7 @@ test_per_context_mode_unprivileged(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -2007,8 +2005,8 @@ test_blocking(uint64_t requested_oa_period, bool set_kernel_hrtimer, uint64_t ke .flags = I915_PERF_FLAG_FD_CLOEXEC | I915_PERF_FLAG_DISABLED, .num_properties = set_kernel_hrtimer ? -NUM_PROPERTIES (properties) : - NUM_PROPERTIES(properties) - 1, +ARRAY_SIZE (properties) /2 : + (ARRAY_SIZE(properties) / 2) - 1, .properties_ptr = to_user_pointer(properties), };uint8_t buf[1024 *1024 ];@@ -2167,8 +2165,8 @@ test_polling(uint64_t requested_oa_period, bool set_kernel_hrtimer, uint64_t kerI915_PERF_FLAG_DISABLED | I915_PERF_FLAG_FD_NONBLOCK, .num_properties = set_kernel_hrtimer ? -NUM_PROPERTIES (properties) : - NUM_PROPERTIES(properties) - 1, +ARRAY_SIZE (properties) /2 : + (ARRAY_SIZE(properties) / 2) - 1, .properties_ptr = to_user_pointer(properties), };uint8_t buf[1024 *1024 ];@@ -2358,7 +2356,7 @@ static void test_polling_small_buf(void) .flags = I915_PERF_FLAG_FD_CLOEXEC | I915_PERF_FLAG_DISABLED | I915_PERF_FLAG_FD_NONBLOCK, - .num_properties = NUM_PROPERTIES(properties), + .num_properties = ARRAY_SIZE(properties) / 2, .properties_ptr = to_user_pointer(properties), };uint32_t test_duration =80 *1000 *1000 ;@@ -2458,7 +2456,7 @@ gen12_test_oa_tlb_invalidate(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };int num_reports1, num_reports2, num_expected_reports;@@ -2649,7 +2647,7 @@ test_non_zero_reason(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };struct drm_i915_perf_record_header *header;@@ -2734,7 +2732,7 @@ test_enable_disable(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* Verify we start disabled */ - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };int buf_size =65536 * (256 +sizeof (struct drm_i915_perf_record_header ));@@ -2883,7 +2881,7 @@ test_short_reads(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };size_t record_size =256 +sizeof (struct drm_i915_perf_record_header );@@ -2975,7 +2973,7 @@ test_non_sampling_read_error(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };int ret;@@ -3011,7 +3009,7 @@ test_disabled_read_error(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };uint32_t oa_report0[64 ];@@ -3168,7 +3166,7 @@ test_mi_rpc(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };struct buf_ops *bops =buf_ops_create (drm_fd);@@ -3271,7 +3269,7 @@ hsw_test_single_ctx_counters(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -4253,7 +4251,7 @@ test_rc6_disable(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };unsigned long rc6_start, rc6_end, rc6_enabled;@@ -4309,7 +4307,7 @@ test_stress_open_close(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =NUM_PROPERTIES (properties), + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };@@ -4405,8 +4403,8 @@ test_global_sseu_config_invalid(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =NUM_PROPERTIES (properties), - .properties_ptr =to_user_pointer (properties), + .num_properties =ARRAY_SIZE (properties) /2 , + .properties_ptr =to_user_pointer (properties), };memset (&default_sseu,0 ,sizeof (default_sseu));@@ -4480,8 +4478,8 @@ test_global_sseu_config(void)struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC |I915_PERF_FLAG_DISABLED ,/* XXX: open disabled */ - .num_properties =NUM_PROPERTIES (properties), - .properties_ptr =to_user_pointer (properties), + .num_properties =ARRAY_SIZE (properties) /2 , + .properties_ptr =to_user_pointer (properties), };memset (&default_sseu,0 ,sizeof (default_sseu));@@ -4913,7 +4911,7 @@ test_i915_ref_count(void) };struct drm_i915_perf_open_param param = { .flags =I915_PERF_FLAG_FD_CLOEXEC , - .num_properties =sizeof (properties) /16 , + .num_properties =ARRAY_SIZE (properties) /2 , .properties_ptr =to_user_pointer (properties), };unsigned baseline, ref_count0, ref_count1;
PATCH 10/23 i915/perf: Use gt in perf tests and lib
In reply to Umesh Nerlige RamappaEnable perf tests to use gt information for sysfs attributes.
--- lib/i915/perf.c | 36 ++++++++++++++++++++++++++++++++++-- tests/i915/perf.c | 27 ++++++++++++++++++++------- 2 files changed, 54 insertions(+), 9 deletions(-)
lib/i915/perf.c +34 -2
@@ -409,6 +409,35 @@ open_master_sysfs_dir(int drm_fd)return sysfs; } +typedef enum { +RPS_MIN_FREQ_MHZ , +RPS_MAX_FREQ_MHZ , + +RPS_MAX_ATTR , +}intel_sysfs_attr_id ; + +static const char *intel_sysfs_attr_name[2 ][RPS_MAX_ATTR ] = +{ + { +"gt_min_freq_mhz" , +"gt_max_freq_mhz" , + }, + { +"gt/gt0/rps_min_freq_mhz" , +"gt/gt0/rps_max_freq_mhz" , + }, +}; + +static const char * +intel_sysfs_attr_id_to_name (int sysfs_dirfd,intel_sysfs_attr_id id) +{ +assert (id <RPS_MAX_ATTR ); + +return !faccessat (sysfs_dirfd,"gt" ,O_RDONLY ,0 ) ? + intel_sysfs_attr_name[1 ][id] : + intel_sysfs_attr_name[0 ][id]; +} +struct intel_perf *intel_perf_for_fd (int drm_fd) {
@@ -424,8 +453,11 @@ intel_perf_for_fd(int drm_fd)if (sysfs_dir_fd <0 )return NULL ; -if (!read_sysfs (sysfs_dir_fd,"gt_min_freq_mhz" , >_min_freq) || - !read_sysfs (sysfs_dir_fd,"gt_max_freq_mhz" , >_max_freq)) { +#define read_sysfs_rps (fd, id, value) \ + read_sysfs(fd, intel_sysfs_attr_id_to_name(fd, id), value) + +if (!read_sysfs_rps (sysfs_dir_fd,RPS_MIN_FREQ_MHZ , >_min_freq) || + !read_sysfs_rps (sysfs_dir_fd,RPS_MAX_FREQ_MHZ , >_max_freq)) {close (sysfs_dir_fd);return NULL ; }
tests/i915/perf.c +20 -7
@@ -347,11 +347,11 @@ try_sysfs_read_u64(const char *path, uint64_t *val) }static unsigned long -sysfs_read (const char *path) +sysfs_read (enum i915_attr_id id) {unsigned long value; -igt_assert (igt_sysfs_scanf (sysfs, path,"%lu" , &value) ==1 ); +igt_assert (igt_sysfs_rps_scanf (sysfs, id,"%lu" , &value) ==1 );return value; }
@@ -4234,7 +4234,7 @@ gen12_test_single_ctx_render_target_writes_a_counter(void)static unsigned long rc6_residency_ms (void ) { -return sysfs_read ("power/rc6_residency_ms" ); +return sysfs_read (RC6_RESIDENCY_MS ); } static void
@@ -4257,7 +4257,7 @@ test_rc6_disable(void)unsigned long rc6_start, rc6_end, rc6_enabled; rc6_enabled =0 ; -igt_sysfs_scanf (sysfs,"power/rc6_enable" ,"%lu" , &rc6_enabled); +igt_sysfs_rps_scanf (sysfs,RC6_ENABLE ,"%lu" , &rc6_enabled);igt_require (rc6_enabled);/* Verify rc6 is functional by measuring residency while idle */
@@ -4894,6 +4894,19 @@ done:return ref_count; } +static int perf_sysfs_open (int i915) +{ +int dirfd, gt; + +/* use the first available sysfs interface */ +for_each_sysfs_gt_dirfd (i915, dirfd, gt) +break ; + +igt_assert (dirfd !=-1 ); + +return dirfd; +} +/* check that an open i915 perf stream holds a reference on the drm i915 module * including in the corner case where the original drm fd has been closed. */
@@ -4929,7 +4942,7 @@ test_i915_ref_count(void) drm_fd =__drm_open_driver (DRIVER_INTEL );igt_require_intel (drm_fd); devid =intel_get_drm_devid (drm_fd); - sysfs =igt_sysfs_open (drm_fd); + sysfs =perf_sysfs_open (drm_fd);/* Note: these global variables are only initialized after calling * init_sys_info()...
@@ -5031,14 +5044,14 @@ igt_mainigt_require_gem (drm_fd); devid =intel_get_drm_devid (drm_fd); - sysfs =igt_sysfs_open (drm_fd); + sysfs =perf_sysfs_open (drm_fd);igt_require (init_sys_info ());write_u64_file ("/proc/sys/dev/i915/perf_stream_paranoid" ,1 );write_u64_file ("/proc/sys/dev/i915/oa_max_sample_rate" ,100000 ); - gt_max_freq_mhz =sysfs_read ("gt_boost_freq_mhz" ); + gt_max_freq_mhz =sysfs_read (RPS_RP0_FREQ_MHZ ); render_copy =igt_get_render_copyfunc (devid);igt_require_f (render_copy,"no render-copy function\n" );
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 10/23] i915/perf: Use gt in perf tests and lib
Quoted 3 lines · Umesh Nerlige Ramappa
Enable perf tests to use gt information for sysfs attributes.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 141 lines
--- lib/i915/perf.c | 36 ++++++++++++++++++++++++++++++++++-- tests/i915/perf.c | 27 ++++++++++++++++++++------- 2 files changed, 54 insertions(+), 9 deletions(-)lib/i915/perf.c +34
-2@@ -409,6 +409,35 @@ open_master_sysfs_dir(int drm_fd)return sysfs; } +typedef enum { +RPS_MIN_FREQ_MHZ , +RPS_MAX_FREQ_MHZ , + +RPS_MAX_ATTR , +}intel_sysfs_attr_id ; + +static const char *intel_sysfs_attr_name[2 ][RPS_MAX_ATTR ] = +{ + { +"gt_min_freq_mhz" , +"gt_max_freq_mhz" , + }, + { +"gt/gt0/rps_min_freq_mhz" , +"gt/gt0/rps_max_freq_mhz" , + }, +}; + +static const char * +intel_sysfs_attr_id_to_name (int sysfs_dirfd,intel_sysfs_attr_id id) +{ +assert (id <RPS_MAX_ATTR ); + +return !faccessat (sysfs_dirfd,"gt" ,O_RDONLY ,0 ) ? + intel_sysfs_attr_name[1 ][id] : + intel_sysfs_attr_name[0 ][id]; +} +struct intel_perf *intel_perf_for_fd (int drm_fd) {@@ -424,8 +453,11 @@ intel_perf_for_fd(int drm_fd)if (sysfs_dir_fd <0 )return NULL ; -if (!read_sysfs (sysfs_dir_fd,"gt_min_freq_mhz" , >_min_freq) || - !read_sysfs (sysfs_dir_fd,"gt_max_freq_mhz" , >_max_freq)) { +#define read_sysfs_rps (fd, id, value) \ + read_sysfs(fd, intel_sysfs_attr_id_to_name(fd, id), value) + +if (!read_sysfs_rps (sysfs_dir_fd,RPS_MIN_FREQ_MHZ , >_min_freq) || + !read_sysfs_rps (sysfs_dir_fd,RPS_MAX_FREQ_MHZ , >_max_freq)) {close (sysfs_dir_fd);return NULL ; }tests/i915/perf.c +20
-7@@ -347,11 +347,11 @@ try_sysfs_read_u64(const char *path, uint64_t *val) }static unsigned long -sysfs_read (const char *path) +sysfs_read (enum i915_attr_id id) {unsigned long value; -igt_assert (igt_sysfs_scanf (sysfs, path,"%lu" , &value) ==1 ); +igt_assert (igt_sysfs_rps_scanf (sysfs, id,"%lu" , &value) ==1 );return value; }@@ -4234,7 +4234,7 @@ gen12_test_single_ctx_render_target_writes_a_counter(void)static unsigned long rc6_residency_ms (void ) { -return sysfs_read ("power/rc6_residency_ms" ); +return sysfs_read (RC6_RESIDENCY_MS ); } static void@@ -4257,7 +4257,7 @@ test_rc6_disable(void)unsigned long rc6_start, rc6_end, rc6_enabled; rc6_enabled =0 ; -igt_sysfs_scanf (sysfs,"power/rc6_enable" ,"%lu" , &rc6_enabled); +igt_sysfs_rps_scanf (sysfs,RC6_ENABLE ,"%lu" , &rc6_enabled);igt_require (rc6_enabled);/* Verify rc6 is functional by measuring residency while idle */ @@ -4894,6 +4894,19 @@ done:return ref_count; } +static int perf_sysfs_open (int i915) +{ +int dirfd, gt; + +/* use the first available sysfs interface */ +for_each_sysfs_gt_dirfd (i915, dirfd, gt) +break ; + +igt_assert (dirfd !=-1 ); + +return dirfd; +} +/* check that an open i915 perf stream holds a reference on the drm i915 module * including in the corner case where the original drm fd has been closed. */ @@ -4929,7 +4942,7 @@ test_i915_ref_count(void) drm_fd =__drm_open_driver (DRIVER_INTEL );igt_require_intel (drm_fd); devid =intel_get_drm_devid (drm_fd); - sysfs =igt_sysfs_open (drm_fd); + sysfs =perf_sysfs_open (drm_fd);/* Note: these global variables are only initialized after calling * init_sys_info()... @@ -5031,14 +5044,14 @@ igt_mainigt_require_gem (drm_fd); devid =intel_get_drm_devid (drm_fd); - sysfs =igt_sysfs_open (drm_fd); + sysfs =perf_sysfs_open (drm_fd);igt_require (init_sys_info ());write_u64_file ("/proc/sys/dev/i915/perf_stream_paranoid" ,1 );write_u64_file ("/proc/sys/dev/i915/oa_max_sample_rate" ,100000 ); - gt_max_freq_mhz =sysfs_read ("gt_boost_freq_mhz" ); + gt_max_freq_mhz =sysfs_read (RPS_RP0_FREQ_MHZ ); render_copy =igt_get_render_copyfunc (devid);igt_require_f (render_copy,"no render-copy function\n" );
PATCH 11/23 i915/perf: Explicitly state rendercopy needs for a test
In reply to Umesh Nerlige RamappaLet tests explicitly require rendercopy before running. This helps in temporarily blocking these tests until rendercopy is available on new platforms.
--- tests/i915/perf.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
tests/i915/perf.c +22 -3
@@ -1601,6 +1601,9 @@ static void load_helper_set_load(enum load load)static void load_helper_run (enum load load) { +if (!render_copy) +return ; +/* * FIXME fork helpers won't get cleaned up when started from within a * subtest, so handle the case where it sticks around a bit too long.
@@ -1633,12 +1636,20 @@ static void load_helper_run(enum load load)static void load_helper_stop (void ) { +if (!render_copy) +return ; +kill (lh.igt_proc.pid,SIGUSR1 );igt_assert (igt_wait_helper (&lh.igt_proc) ==0 ); }static void load_helper_init (void ) { +if (!render_copy) { +igt_info ("Running test without render_copy\n" ); +return ; + } + lh.devid =intel_get_drm_devid (drm_fd);/* MI_STORE_DATA can only use GTT address on gen4+/g33 and needs
@@ -1659,7 +1670,12 @@ static void load_helper_init(void)static void load_helper_fini (void ) { -int i915 =buf_ops_get_fd (lh.bops); +int i915; + +if (!render_copy) +return ; + + i915 =buf_ops_get_fd (lh.bops);if (lh.igt_proc.running)load_helper_stop ();
@@ -5054,7 +5070,6 @@ igt_main gt_max_freq_mhz =sysfs_read (RPS_RP0_FREQ_MHZ ); render_copy =igt_get_render_copyfunc (devid); -igt_require_f (render_copy,"no render-copy function\n" ); }igt_subtest ("non-system-wide-paranoid" )
@@ -5157,6 +5172,7 @@ igt_main igt_subtest("unprivileged-single-ctx-counters") {igt_require (IS_HASWELL (devid)); +igt_require_f (render_copy,"no render-copy function\n" );hsw_test_single_ctx_counters (); }
@@ -5170,6 +5186,7 @@ igt_main* For gen12 implement a separate test that uses only OAR */ igt_require (intel_gen (devid) >=8 &&intel_gen (devid) <12 ); +igt_require_f (render_copy,"no render-copy function\n" );gen8_test_single_ctx_render_target_writes_a_counter (); }
@@ -5185,8 +5202,10 @@ igt_maingen12_test_oa_tlb_invalidate ();igt_describe ("Measure performance for a specific context using OAR in Gen 12" ); - igt_subtest("gen12-unprivileged-single-ctx-counters") + igt_subtest("gen12-unprivileged-single-ctx-counters") { +igt_require_f (render_copy,"no render-copy function\n" );gen12_test_single_ctx_render_target_writes_a_counter (); + } }igt_subtest ("rc6-disable" )
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 11/23] i915/perf: Explicitly state rendercopy needs for a test
Quoted 5 lines · Umesh Nerlige Ramappa
Let tests explicitly require rendercopy before running. This helps in temporarily blocking these tests until rendercopy is available on new platforms.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 89 lines
--- tests/i915/perf.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)tests/i915/perf.c +22
-3@@ -1601,6 +1601,9 @@ static void load_helper_set_load(enum load load)static void load_helper_run (enum load load) { +if (!render_copy) +return ; +/* * FIXME fork helpers won't get cleaned up when started from within a * subtest, so handle the case where it sticks around a bit too long. @@ -1633,12 +1636,20 @@ static void load_helper_run(enum load load)static void load_helper_stop (void ) { +if (!render_copy) +return ; +kill (lh.igt_proc.pid,SIGUSR1 );igt_assert (igt_wait_helper (&lh.igt_proc) ==0 ); }static void load_helper_init (void ) { +if (!render_copy) { +igt_info ("Running test without render_copy\n" ); +return ; + } + lh.devid =intel_get_drm_devid (drm_fd);/* MI_STORE_DATA can only use GTT address on gen4+/g33 and needs @@ -1659,7 +1670,12 @@ static void load_helper_init(void)static void load_helper_fini (void ) { -int i915 =buf_ops_get_fd (lh.bops); +int i915; + +if (!render_copy) +return ; + + i915 =buf_ops_get_fd (lh.bops);if (lh.igt_proc.running)load_helper_stop ();@@ -5054,7 +5070,6 @@ igt_main gt_max_freq_mhz =sysfs_read (RPS_RP0_FREQ_MHZ ); render_copy =igt_get_render_copyfunc (devid); -igt_require_f (render_copy,"no render-copy function\n" ); }igt_subtest ("non-system-wide-paranoid" )@@ -5157,6 +5172,7 @@ igt_main igt_subtest("unprivileged-single-ctx-counters") {igt_require (IS_HASWELL (devid)); +igt_require_f (render_copy,"no render-copy function\n" );hsw_test_single_ctx_counters (); }@@ -5170,6 +5186,7 @@ igt_main* For gen12 implement a separate test that uses only OAR */ igt_require (intel_gen (devid) >=8 &&intel_gen (devid) <12 ); +igt_require_f (render_copy,"no render-copy function\n" );gen8_test_single_ctx_render_target_writes_a_counter (); }@@ -5185,8 +5202,10 @@ igt_maingen12_test_oa_tlb_invalidate ();igt_describe ("Measure performance for a specific context using OAR in Gen 12" ); - igt_subtest("gen12-unprivileged-single-ctx-counters") + igt_subtest("gen12-unprivileged-single-ctx-counters") { +igt_require_f (render_copy,"no render-copy function\n" );gen12_test_single_ctx_render_target_writes_a_counter (); + } }igt_subtest ("rc6-disable" )
PATCH 12/23 i915/perf: Skip tests that use rendercopy
In reply to Umesh Nerlige RamappaRunning tests that require rendercopy sometimes leaves the DUT in an unsusable state. Further tests fail to run and DUT requires reboot. Since it affects CI efficiency, skip tests is rendercopy is missing.
--- tests/i915/perf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tests/i915/perf.c +16 -1
@@ -41,6 +41,7 @@#include "i915/gem.h" #include "i915/perf.h" #include "igt.h" +#include "igt_perf.h" #include "igt_sysfs.h" #include "drm.h"
@@ -5025,6 +5026,19 @@ static int i915_perf_revision(int fd)return value; } +static bool has_class_instance (int i915,uint16_t class,uint16_t instance) +{ +int fd; + + fd =perf_i915_open (i915,I915_PMU_ENGINE_BUSY (class, instance)); +if (fd >=0 ) { +close (fd); +return true; + } + +return false; +} +igt_main { igt_fixture {
@@ -5069,7 +5083,8 @@ igt_main gt_max_freq_mhz =sysfs_read (RPS_RP0_FREQ_MHZ ); - render_copy =igt_get_render_copyfunc (devid); +if (has_class_instance (drm_fd,I915_ENGINE_CLASS_RENDER ,0 )) + render_copy =igt_get_render_copyfunc (devid); }igt_subtest ("non-system-wide-paranoid" )
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 12/23] i915/perf: Skip tests that use rendercopy
Quoted 5 lines · Umesh Nerlige Ramappa
Running tests that require rendercopy sometimes leaves the DUT in an unsusable state. Further tests fail to run and DUT requires reboot. Since it affects CI efficiency, skip tests is rendercopy is missing.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Kind of awkward that igt_get_render_copyfunc() returns something when it doesn't seem to be have an engine able to run the copy function...
Quoted 46 lines
--- tests/i915/perf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)tests/i915/perf.c +16
-1@@ -41,6 +41,7 @@#include "i915/gem.h" #include "i915/perf.h" #include "igt.h" +#include "igt_perf.h" #include "igt_sysfs.h" #include "drm.h" @@ -5025,6 +5026,19 @@ static int i915_perf_revision(int fd)return value; } +static bool has_class_instance (int i915,uint16_t class,uint16_t instance) +{ +int fd; + + fd =perf_i915_open (i915,I915_PMU_ENGINE_BUSY (class, instance)); +if (fd >=0 ) { +close (fd); +return true; + } + +return false; +} +igt_main { igt_fixture {@@ -5069,7 +5083,8 @@ igt_main gt_max_freq_mhz =sysfs_read (RPS_RP0_FREQ_MHZ ); - render_copy =igt_get_render_copyfunc (devid); +if (has_class_instance (drm_fd,I915_ENGINE_CLASS_RENDER ,0 )) + render_copy =igt_get_render_copyfunc (devid); }igt_subtest ("non-system-wide-paranoid" )
PATCH 13/23 i915/perf: Add OA formats for DG2
In reply to Umesh Nerlige RamappaAdd OA formats for DG2.
--- include/drm-uapi/i915_drm.h | 6 ++++++ tests/i915/perf.c | 38 ++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-)
include/drm-uapi/i915_drm.h +6 -0
@@ -2535,6 +2535,12 @@ enum drm_i915_oa_format {I915_OA_FORMAT_A12_B8_C8 , I915_OA_FORMAT_A32u40_A4u32_B8_C8, +/* DG2 */ + I915_OAR_FORMAT_A32u40_A4u32_B8_C8, + I915_OA_FORMAT_A24u40_A14u32_B8_C8, + I915_OAR_FORMAT_A36u64_B8_C8, + I915_OA_FORMAT_A38u64_R2u64_B8_C8, + I915_OA_FORMAT_MAX /* non-ABI */ };
tests/i915/perf.c +35 -3
@@ -181,6 +181,36 @@ static struct oa_format gen12_oa_formats[I915_OA_FORMAT_MAX] = { .c_off = 224, .n_c = 8, }, }; +static struct oa_format dg2_oa_formats[I915_OA_FORMAT_MAX ] = { + [I915_OAR_FORMAT_A32u40_A4u32_B8_C8] = { +"A32u40_A4u32_B8_C8" , .size =256 , + .a40_high_off =160 , .a40_low_off =16 , .n_a40 =32 , + .a_off =144 , .n_a =4 , .first_a =32 , + .b_off =192 , .n_b =8 , + .c_off =224 , .n_c =8 , .oa_type =OAR , }, +/* This format has A36 and A37 interleaved with high bytes of some A +* counters, so we will accumulate only subset of counters. +*/ + [I915_OA_FORMAT_A24u40_A14u32_B8_C8] = { +"A24u40_A14u32_B8_C8" , .size =256 , +/* u40: A4 - A23 */ + .a40_high_off =164 , .a40_low_off =32 , .n_a40 =20 , +/* u32: A24 - A27 */ + .a_off =144 , .n_a =4 , .first_a =24 , + .b_off =192 , .n_b =8 , + .c_off =224 , .n_c =8 , .oa_type =OAG , }, + [I915_OA_FORMAT_A38u64_R2u64_B8_C8] = { +"A38u64_R2u64_B8_C8" , .size =448 , + .a64_off =32 , .n_a64 =38 , + .b_off =352 , .n_b =8 , + .c_off =384 , .n_c =8 , .oa_type =OAG , }, + [I915_OAR_FORMAT_A36u64_B8_C8] = { +"A36u64_B8_C8" , .size =384 , + .a64_off =32 , .n_a64 =36 , + .b_off =320 , .n_b =8 , + .c_off =352 , .n_c =8 , .oa_type =OAR , }, +}; +static bool hsw_undefined_a_counters[45 ] = { [4 ] = true, [6] = true,
@@ -239,6 +269,8 @@ get_oa_format(enum drm_i915_oa_format format) {if (IS_HASWELL (devid))return hsw_oa_formats[format]; +else if (IS_DG2 (devid)) +return dg2_oa_formats[format];else if (IS_GEN12 (devid))return gen12_oa_formats[format];else
@@ -1304,7 +1336,7 @@ read_2_oa_reports(int format_id,igt_assert_eq (header->size, sample_size); report = (const void *)(header +1 ); -dump_report (report,64 ,"oa-formats" ); +dump_report (report, format_size /4 ,"oa-formats" );igt_debug ("read report: reason = %x, timestamp = %x, exponent mask=%x\n" , report[0 ], report[1 ], exponent_mask);
@@ -1540,8 +1572,8 @@ test_oa_formats(void) {for (int i =0 ; i <I915_OA_FORMAT_MAX ; i++) {struct oa_format format =get_oa_format (i); -uint32_t oa_report0[64 ]; -uint32_t oa_report1[64 ]; +uint32_t oa_report0[format.size /4 ]; +uint32_t oa_report1[format.size /4 ];if (!format.name)/* sparse, indexed by ID */ continue ;
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 13/23] i915/perf: Add OA formats for DG2
Quoted 3 lines · Umesh Nerlige Ramappa
Add OA formats for DG2.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 92 lines
--- include/drm-uapi/i915_drm.h | 6 ++++++ tests/i915/perf.c | 38 ++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-)include/drm-uapi/i915_drm.h +6
-0@@ -2535,6 +2535,12 @@ enum drm_i915_oa_format {I915_OA_FORMAT_A12_B8_C8 , I915_OA_FORMAT_A32u40_A4u32_B8_C8, +/* DG2 */ + I915_OAR_FORMAT_A32u40_A4u32_B8_C8, + I915_OA_FORMAT_A24u40_A14u32_B8_C8, + I915_OAR_FORMAT_A36u64_B8_C8, + I915_OA_FORMAT_A38u64_R2u64_B8_C8, + I915_OA_FORMAT_MAX /* non-ABI */ };tests/i915/perf.c +35
-3@@ -181,6 +181,36 @@ static struct oa_format gen12_oa_formats[I915_OA_FORMAT_MAX] = { .c_off = 224, .n_c = 8, }, }; +static struct oa_format dg2_oa_formats[I915_OA_FORMAT_MAX ] = { + [I915_OAR_FORMAT_A32u40_A4u32_B8_C8] = { +"A32u40_A4u32_B8_C8" , .size =256 , + .a40_high_off =160 , .a40_low_off =16 , .n_a40 =32 , + .a_off =144 , .n_a =4 , .first_a =32 , + .b_off =192 , .n_b =8 , + .c_off =224 , .n_c =8 , .oa_type =OAR , }, +/* This format has A36 and A37 interleaved with high bytes of some A +* counters, so we will accumulate only subset of counters. +*/ + [I915_OA_FORMAT_A24u40_A14u32_B8_C8] = { +"A24u40_A14u32_B8_C8" , .size =256 , +/* u40: A4 - A23 */ + .a40_high_off =164 , .a40_low_off =32 , .n_a40 =20 , +/* u32: A24 - A27 */ + .a_off =144 , .n_a =4 , .first_a =24 , + .b_off =192 , .n_b =8 , + .c_off =224 , .n_c =8 , .oa_type =OAG , }, + [I915_OA_FORMAT_A38u64_R2u64_B8_C8] = { +"A38u64_R2u64_B8_C8" , .size =448 , + .a64_off =32 , .n_a64 =38 , + .b_off =352 , .n_b =8 , + .c_off =384 , .n_c =8 , .oa_type =OAG , }, + [I915_OAR_FORMAT_A36u64_B8_C8] = { +"A36u64_B8_C8" , .size =384 , + .a64_off =32 , .n_a64 =36 , + .b_off =320 , .n_b =8 , + .c_off =352 , .n_c =8 , .oa_type =OAR , }, +}; +static bool hsw_undefined_a_counters[45 ] = { [4 ] = true, [6] = true,@@ -239,6 +269,8 @@ get_oa_format(enum drm_i915_oa_format format) {if (IS_HASWELL (devid))return hsw_oa_formats[format]; +else if (IS_DG2 (devid)) +return dg2_oa_formats[format];else if (IS_GEN12 (devid))return gen12_oa_formats[format];else @@ -1304,7 +1336,7 @@ read_2_oa_reports(int format_id,igt_assert_eq (header->size, sample_size); report = (const void *)(header +1 ); -dump_report (report,64 ,"oa-formats" ); +dump_report (report, format_size /4 ,"oa-formats" );igt_debug ("read report: reason = %x, timestamp = %x, exponent mask=%x\n" , report[0 ], report[1 ], exponent_mask);@@ -1540,8 +1572,8 @@ test_oa_formats(void) {for (int i =0 ; i <I915_OA_FORMAT_MAX ; i++) {struct oa_format format =get_oa_format (i); -uint32_t oa_report0[64 ]; -uint32_t oa_report1[64 ]; +uint32_t oa_report0[format.size /4 ]; +uint32_t oa_report1[format.size /4 ];if (!format.name)/* sparse, indexed by ID */ continue ;
PATCH 14/23 i915/perf: Add a test for non-power-of-2 oa reports
In reply to Umesh Nerlige RamappaSome OA report sizes are no longer a power of 2. Verify that such reports can be correctly read across the OA buffer boundaries.
--- tests/i915/perf.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
tests/i915/perf.c +25 -9
@@ -2681,7 +2681,7 @@ test_buffer_fill(void) }static void -test_non_zero_reason (void ) +test_multi_buffer_fills (uint64_t format,uint64_t oa_buf_size,bool load) {/* ~20 micro second period */ int oa_exponent =max_oa_exponent_for_period_lte (20000 );
@@ -2691,7 +2691,7 @@ test_non_zero_reason(void)/* OA unit configuration */ DRM_I915_PERF_PROP_OA_METRICS_SET , test_set->perf_oa_metrics_set, -DRM_I915_PERF_PROP_OA_FORMAT , test_set->perf_oa_format, +DRM_I915_PERF_PROP_OA_FORMAT , format, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; struct drm_i915_perf_open_param param = {
@@ -2700,7 +2700,9 @@ test_non_zero_reason(void) .properties_ptr = to_user_pointer(properties), };struct drm_i915_perf_record_header *header; -uint32_t buf_size =3 *65536 * (256 +sizeof (struct drm_i915_perf_record_header )); +size_t report_size =get_oa_format (format).size; +uint32_t buf_size =3 * (oa_buf_size / report_size) * + (report_size +sizeof (struct drm_i915_perf_record_header ));uint8_t *buf =malloc (buf_size);uint32_t total_len =0 , reports_lost;const uint32_t *last_report;
@@ -2710,8 +2712,10 @@ test_non_zero_reason(void)igt_debug ("Ready to read about %u bytes\n" , buf_size); -load_helper_init (); -load_helper_run (HIGH ); +if (load) { +load_helper_init (); +load_helper_run (HIGH ); + } stream_fd =__perf_open (drm_fd, ¶m, true/* prevent_pm */ );
@@ -2724,8 +2728,10 @@ test_non_zero_reason(void)__perf_close (stream_fd); -load_helper_stop (); -load_helper_fini (); +if (load) { +load_helper_stop (); +load_helper_fini (); + }igt_debug ("Got %u bytes\n" , total_len);
@@ -2747,7 +2753,7 @@ test_non_zero_reason(void)if (last_report) {sanity_check_reports (last_report, report, - test_set->perf_oa_format); + format); } last_report = report;break ;
@@ -5137,6 +5143,14 @@ igt_main igt_subtest("oa-formats")test_oa_formats (); +igt_describe ("Test OA buffer for non power of 2 report sizes" ); + igt_subtest("non-power-of-2-oa-formats") { +igt_require (IS_DG2 (devid)); +test_multi_buffer_fills (I915_OA_FORMAT_A38u64_R2u64_B8_C8, +MAX_OA_BUF_SIZE , + false); + } + igt_subtest("invalid-oa-exponent")test_invalid_oa_exponent ();igt_subtest ("low-oa-exponent-permissions" )
@@ -5156,7 +5170,9 @@ igt_main igt_subtest("non-zero-reason") {/* Reason field is only available on Gen8+ */ igt_require (intel_gen (devid) >=8 ); -test_non_zero_reason (); +test_multi_buffer_fills (test_set->perf_oa_format, +MAX_OA_BUF_SIZE , + true); }igt_subtest ("disabled-read-error" )
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 14/23] i915/perf: Add a test for non-power-of-2 oa reports
Quoted 4 lines · Umesh Nerlige Ramappa
Some OA report sizes are no longer a power of 2. Verify that such reports can be correctly read across the OA buffer boundaries.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
It seems you've disabled the load helper to avoid checking the content of the report?
I think the A counters should still be defined same as before and we could still check their value.
Quoted 73 lines
--- tests/i915/perf.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)tests/i915/perf.c +14
-8@@ -2681,7 +2681,7 @@ test_buffer_fill(void) }static void -test_non_zero_reason (void ) +test_multi_buffer_fills (uint64_t format,uint64_t oa_buf_size,bool load) {/* ~20 micro second period */ int oa_exponent =max_oa_exponent_for_period_lte (20000 );@@ -2691,7 +2691,7 @@ test_non_zero_reason(void)/* OA unit configuration */ DRM_I915_PERF_PROP_OA_METRICS_SET , test_set->perf_oa_metrics_set, -DRM_I915_PERF_PROP_OA_FORMAT , test_set->perf_oa_format, +DRM_I915_PERF_PROP_OA_FORMAT , format, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; struct drm_i915_perf_open_param param = {@@ -2700,7 +2700,9 @@ test_non_zero_reason(void) .properties_ptr = to_user_pointer(properties), };struct drm_i915_perf_record_header *header; -uint32_t buf_size =3 *65536 * (256 +sizeof (struct drm_i915_perf_record_header )); +size_t report_size =get_oa_format (format).size; +uint32_t buf_size =3 * (oa_buf_size / report_size) * + (report_size +sizeof (struct drm_i915_perf_record_header ));uint8_t *buf =malloc (buf_size);uint32_t total_len =0 , reports_lost;const uint32_t *last_report;@@ -2710,8 +2712,10 @@ test_non_zero_reason(void)igt_debug ("Ready to read about %u bytes\n" , buf_size); -load_helper_init (); -load_helper_run (HIGH ); +if (load) { +load_helper_init (); +load_helper_run (HIGH ); + } stream_fd =__perf_open (drm_fd, ¶m, true/* prevent_pm */ );@@ -2724,8 +2728,10 @@ test_non_zero_reason(void)__perf_close (stream_fd); -load_helper_stop (); -load_helper_fini (); +if (load) { +load_helper_stop (); +load_helper_fini (); + }igt_debug ("Got %u bytes\n" , total_len);@@ -2747,7 +2753,7 @@ test_non_zero_reason(void)if (last_report) {sanity_check_reports (last_report, report, - test_set->perf_oa_format); + format); } last_report = report;break ;
tests/i915/perf.c igt_main · line 5152
Quoted 10 lines
tests/i915/perf.c +7
-0@@ -5137,6 +5143,14 @@ igt_main igt_subtest("oa-formats")test_oa_formats (); +igt_describe ("Test OA buffer for non power of 2 report sizes" ); + igt_subtest("non-power-of-2-oa-formats") { +igt_require (IS_DG2 (devid)); +test_multi_buffer_fills (I915_OA_FORMAT_A38u64_R2u64_B8_C8, +MAX_OA_BUF_SIZE , + false); + }
We could actually iterator over non power of 2 report sizes :
for (unsigned r = 0; r < ARRAY_SIZE(gen12_oa_formats); r++) {
if (__builtin_popcount(gen12_oa_formats[r].size) == 1)
continue;
igt_describe("Test OA buffer for %s format", gen12_oa_formats[r].name);
igt_subtest_f("oa-format-%s", gen12_oa_formats[r].name) {
igt_require(intel_gen(devid) >= 12);
test_multi_buffer_fills(r, MAX_OA_BUF_SIZE, false);
}
}
Quoted 15 lines
tests/i915/perf.c +4
-1+ igt_subtest("invalid-oa-exponent")test_invalid_oa_exponent ();igt_subtest ("low-oa-exponent-permissions" )@@ -5156,7 +5170,9 @@ igt_main igt_subtest("non-zero-reason") {/* Reason field is only available on Gen8+ */ igt_require (intel_gen (devid) >=8 ); -test_non_zero_reason (); +test_multi_buffer_fills (test_set->perf_oa_format, +MAX_OA_BUF_SIZE , + true); }igt_subtest ("disabled-read-error" )
Re: [igt-dev] [PATCH i-g-t 14/23] i915/perf: Add a test for non-power-of-2 oa reports
Quoted 8 lines · Lionel Landwerlin
Quoted 4 lines · Umesh Nerlige Ramappa
Some OA report sizes are no longer a power of 2. Verify that such reports can be correctly read across the OA buffer boundaries.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>It seems you've disabled the load helper to avoid checking the content of the report?
yes, I think at the time this was added, there was only a media oa format with an odd size and I thought we don't want to run render copy with that. I think now we can enable the load since there are other formats that are applicable here.
Quoted 88 lines
I think the A counters should still be defined same as before and we could still check their value.
Quoted 62 lines
--- tests/i915/perf.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)tests/i915/perf.c +14
-8@@ -2681,7 +2681,7 @@ test_buffer_fill(void) }static void -test_non_zero_reason (void ) +test_multi_buffer_fills (uint64_t format,uint64_t oa_buf_size,bool load) {/* ~20 micro second period */ int oa_exponent =max_oa_exponent_for_period_lte (20000 );@@ -2691,7 +2691,7 @@ test_non_zero_reason(void)/* OA unit configuration */ DRM_I915_PERF_PROP_OA_METRICS_SET , test_set->perf_oa_metrics_set, -DRM_I915_PERF_PROP_OA_FORMAT , test_set->perf_oa_format, +DRM_I915_PERF_PROP_OA_FORMAT , format, DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent, }; struct drm_i915_perf_open_param param = {@@ -2700,7 +2700,9 @@ test_non_zero_reason(void) .properties_ptr = to_user_pointer(properties), };struct drm_i915_perf_record_header *header; -uint32_t buf_size =3 *65536 * (256 +sizeof (struct drm_i915_perf_record_header )); +size_t report_size =get_oa_format (format).size; +uint32_t buf_size =3 * (oa_buf_size / report_size) * + (report_size +sizeof (struct drm_i915_perf_record_header ));uint8_t *buf =malloc (buf_size);uint32_t total_len =0 , reports_lost;const uint32_t *last_report;@@ -2710,8 +2712,10 @@ test_non_zero_reason(void)igt_debug ("Ready to read about %u bytes\n" , buf_size); -load_helper_init (); -load_helper_run (HIGH ); +if (load) { +load_helper_init (); +load_helper_run (HIGH ); + } stream_fd =__perf_open (drm_fd, ¶m, true/* prevent_pm */ );@@ -2724,8 +2728,10 @@ test_non_zero_reason(void)__perf_close (stream_fd); -load_helper_stop (); -load_helper_fini (); +if (load) { +load_helper_stop (); +load_helper_fini (); + }igt_debug ("Got %u bytes\n" , total_len);@@ -2747,7 +2753,7 @@ test_non_zero_reason(void)if (last_report) {sanity_check_reports (last_report, report, - test_set->perf_oa_format); + format); } last_report = report;break ;tests/i915/perf.c igt_main · line 5151
Quoted 9 lines
tests/i915/perf.c +7
-0@@ -5137,6 +5143,14 @@ igt_main igt_subtest("oa-formats")test_oa_formats (); +igt_describe ("Test OA buffer for non power of 2 report sizes" ); + igt_subtest("non-power-of-2-oa-formats") { +igt_require (IS_DG2 (devid)); +test_multi_buffer_fills (I915_OA_FORMAT_A38u64_R2u64_B8_C8, +MAX_OA_BUF_SIZE , + false); + }We could actually iterator over non power of 2 report sizes :
for (unsigned r = 0; r <
ARRAY_SIZE(gen12_oa_formats); r++) {if (
__builtin_popcount(gen12_oa_formats[r].size)== 1)continue;
igt_describe("Test OA buffer for %s format", gen12_oa_formats[r].name);
Quoted 7 lines
igt_subtest_f("oa-format-%s", gen12_oa_formats[r].name){
igt_require(intel_gen(devid) >= 12);
test_multi_buffer_fills(r, MAX_OA_BUF_SIZE, false);}
will add,
Thanks,
Umesh
Quoted 20 lines
}
Quoted 14 lines
tests/i915/perf.c +4
-1+ igt_subtest("invalid-oa-exponent")test_invalid_oa_exponent ();igt_subtest ("low-oa-exponent-permissions" )@@ -5156,7 +5170,9 @@ igt_main igt_subtest("non-zero-reason") {/* Reason field is only available on Gen8+ */ igt_require (intel_gen (devid) >=8 ); -test_non_zero_reason (); +test_multi_buffer_fills (test_set->perf_oa_format, +MAX_OA_BUF_SIZE , + true); }igt_subtest ("disabled-read-error" )
PATCH 15/23 i915/perf: Fix CS timestamp vs OA timstamp mismatch
In reply to Umesh Nerlige RamappaCS timestamp can have an additional configuration that shifts the timestamp value by a specified number of bits. On DG2, this additional configuration is ignored by OA, so OA timestamps are missing the shift.
Add newly defined interface to get the exact OA timestamp frequency so that the deltas can be accurately calculated.
--- include/drm-uapi/i915_drm.h | 6 ++++++ lib/i915/perf.c | 6 +++++- tests/i915/perf.c | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-)
include/drm-uapi/i915_drm.h +6 -0
@@ -749,6 +749,12 @@ typedef struct drm_i915_irq_wait {/* Query if the kernel supports the I915_USERPTR_PROBE flag. */ #define I915_PARAM_HAS_USERPTR_PROBE 56 +/* +* Frequency of the timestamps in OA reports. This used to be the same as the CS +* timestamp frequency, but differs on some platforms. +*/ +#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57 +/* Must be kept compact -- no holes and well documented */ typedef struct drm_i915_getparam {
lib/i915/perf.c +5 -1
@@ -464,7 +464,11 @@ intel_perf_for_fd(int drm_fd)close (sysfs_dir_fd);if (getparam (drm_fd,I915_PARAM_CHIPSET_ID , &device_id) || -getparam (drm_fd,I915_PARAM_REVISION , &device_revision) || +getparam (drm_fd,I915_PARAM_REVISION , &device_revision)) +return NULL ; + +/* if OA_TIMESTAMP_FREQUENCY is not supported, fall back to CS_TIMESTAMP_FREQUENCY */ +if (getparam (drm_fd,I915_PARAM_OA_TIMESTAMP_FREQUENCY , ×tamp_frequency) &&getparam (drm_fd,I915_PARAM_CS_TIMESTAMP_FREQUENCY , ×tamp_frequency))return NULL ;
tests/i915/perf.c +35 -2
@@ -453,6 +453,29 @@ gen8_read_report_reason(const uint32_t *report)return "unknown" ; } +static uint32_t +cs_timestamp_frequency (int fd) +{ +struct drm_i915_getparam gp = {}; +static uint32_t value =0 ; + +if (value) +return value; + + gp.param =I915_PARAM_CS_TIMESTAMP_FREQUENCY ; + gp.value = (int *)(&value); + +igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_I915_GETPARAM , &gp),0 ); + +return value; +} + +static uint64_t +cs_timebase_scale (uint32_t u32_delta) +{ +return ((uint64_t )u32_delta *NSEC_PER_SEC ) /cs_timestamp_frequency (drm_fd); +} +static uint64_t timebase_scale (uint32_t u32_delta) {
@@ -543,6 +566,15 @@ oa_report_get_ctx_id(uint32_t *report)return report[2 ]; } +static int +oar_unit_default_format (void ) +{ +if (IS_DG2 (devid)) +return I915_OAR_FORMAT_A32u40_A4u32_B8_C8; + +return test_set->perf_oa_format; +} +/* * Temporary wrapper to distinguish mappings on !llc platforms, * where it seems cache over GEM_MMAP_OFFSET is not flushed before execution.
@@ -3959,6 +3991,7 @@ again:static void gen12_single_ctx_helper (void ) { +uint64_t fmt =oar_unit_default_format ();uint64_t properties[] = {/* Have a random value here for the context id, but initialize * it once you figure out the context ID for the work to be
@@ -3974,7 +4007,7 @@ static void gen12_single_ctx_helper(void)* values. */ DRM_I915_PERF_PROP_OA_METRICS_SET , test_set->perf_oa_metrics_set, - DRM_I915_PERF_PROP_OA_FORMAT, test_set->perf_oa_format, + DRM_I915_PERF_PROP_OA_FORMAT, fmt, };struct drm_i915_perf_open_param param = { .flags = I915_PERF_FLAG_FD_CLOEXEC,
@@ -4202,7 +4235,7 @@ static void gen12_single_ctx_helper(void)/* Sanity check that we can pass the delta to timebase_scale */ igt_assert (delta_ts64 <UINT32_MAX ); delta_oa32_ns =timebase_scale (delta_oa32); - delta_ts64_ns =timebase_scale (delta_ts64); + delta_ts64_ns =cs_timebase_scale (delta_ts64);igt_debug ("oa32 delta = %u, = %uns\n" , delta_oa32, (unsigned )delta_oa32_ns);
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 15/23] i915/perf: Fix CS timestamp vs OA timstamp mismatch
Quoted 8 lines · Umesh Nerlige Ramappa
CS timestamp can have an additional configuration that shifts the timestamp value by a specified number of bits. On DG2, this additional configuration is ignored by OA, so OA timestamps are missing the shift.
Add newly defined interface to get the exact OA timestamp frequency so that the deltas can be accurately calculated.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 116 lines
--- include/drm-uapi/i915_drm.h | 6 ++++++ lib/i915/perf.c | 6 +++++- tests/i915/perf.c | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-)include/drm-uapi/i915_drm.h +6
-0@@ -749,6 +749,12 @@ typedef struct drm_i915_irq_wait {/* Query if the kernel supports the I915_USERPTR_PROBE flag. */ #define I915_PARAM_HAS_USERPTR_PROBE 56 +/* +* Frequency of the timestamps in OA reports. This used to be the same as the CS +* timestamp frequency, but differs on some platforms. +*/ +#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57 +/* Must be kept compact -- no holes and well documented */ typedef struct drm_i915_getparam {lib/i915/perf.c +5
-1@@ -464,7 +464,11 @@ intel_perf_for_fd(int drm_fd)close (sysfs_dir_fd);if (getparam (drm_fd,I915_PARAM_CHIPSET_ID , &device_id) || -getparam (drm_fd,I915_PARAM_REVISION , &device_revision) || +getparam (drm_fd,I915_PARAM_REVISION , &device_revision)) +return NULL ; + +/* if OA_TIMESTAMP_FREQUENCY is not supported, fall back to CS_TIMESTAMP_FREQUENCY */ +if (getparam (drm_fd,I915_PARAM_OA_TIMESTAMP_FREQUENCY , ×tamp_frequency) &&getparam (drm_fd,I915_PARAM_CS_TIMESTAMP_FREQUENCY , ×tamp_frequency))return NULL ;tests/i915/perf.c +35
-2@@ -453,6 +453,29 @@ gen8_read_report_reason(const uint32_t *report)return "unknown" ; } +static uint32_t +cs_timestamp_frequency (int fd) +{ +struct drm_i915_getparam gp = {}; +static uint32_t value =0 ; + +if (value) +return value; + + gp.param =I915_PARAM_CS_TIMESTAMP_FREQUENCY ; + gp.value = (int *)(&value); + +igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_I915_GETPARAM , &gp),0 ); + +return value; +} + +static uint64_t +cs_timebase_scale (uint32_t u32_delta) +{ +return ((uint64_t )u32_delta *NSEC_PER_SEC ) /cs_timestamp_frequency (drm_fd); +} +static uint64_t timebase_scale (uint32_t u32_delta) {@@ -543,6 +566,15 @@ oa_report_get_ctx_id(uint32_t *report)return report[2 ]; } +static int +oar_unit_default_format (void ) +{ +if (IS_DG2 (devid)) +return I915_OAR_FORMAT_A32u40_A4u32_B8_C8; + +return test_set->perf_oa_format; +} +/* * Temporary wrapper to distinguish mappings on !llc platforms, * where it seems cache over GEM_MMAP_OFFSET is not flushed before execution. @@ -3959,6 +3991,7 @@ again:static void gen12_single_ctx_helper (void ) { +uint64_t fmt =oar_unit_default_format ();uint64_t properties[] = {/* Have a random value here for the context id, but initialize * it once you figure out the context ID for the work to be @@ -3974,7 +4007,7 @@ static void gen12_single_ctx_helper(void)* values. */ DRM_I915_PERF_PROP_OA_METRICS_SET , test_set->perf_oa_metrics_set, - DRM_I915_PERF_PROP_OA_FORMAT, test_set->perf_oa_format, + DRM_I915_PERF_PROP_OA_FORMAT, fmt, };struct drm_i915_perf_open_param param = { .flags = I915_PERF_FLAG_FD_CLOEXEC,@@ -4202,7 +4235,7 @@ static void gen12_single_ctx_helper(void)/* Sanity check that we can pass the delta to timebase_scale */ igt_assert (delta_ts64 <UINT32_MAX ); delta_oa32_ns =timebase_scale (delta_oa32); - delta_ts64_ns =timebase_scale (delta_ts64); + delta_ts64_ns =cs_timebase_scale (delta_ts64);igt_debug ("oa32 delta = %u, = %uns\n" , delta_oa32, (unsigned )delta_oa32_ns);
PATCH 16/23 i915/perf: Treat ticks as 64 bit
In reply to Umesh Nerlige RamappaDG2 A0 has a buggy header in the 64 bit OAG format. Except the ticks, all other fields are 32 bit. To resolve this, we will store ticks in 64 bit type.
--- tests/i915/perf.c | 82 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 26 deletions(-)
tests/i915/perf.c +56 -26
@@ -117,6 +117,7 @@ struct oa_format {int c_off;int n_c;int oa_type; +bool report_hdr_64bit; };static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX ] = {
@@ -203,7 +204,8 @@ static struct oa_format dg2_oa_formats[I915_OA_FORMAT_MAX] = { "A38u64_R2u64_B8_C8", .size = 448, .a64_off = 32, .n_a64 = 38, .b_off = 352, .n_b = 8, - .c_off = 384, .n_c = 8, .oa_type = OAG, }, + .c_off = 384, .n_c = 8, .oa_type = OAG, + .report_hdr_64bit = true, }, [I915_OAR_FORMAT_A36u64_B8_C8] = { "A36u64_B8_C8", .size = 384, .a64_off = 32, .n_a64 = 36,
@@ -245,7 +247,7 @@ static bool *undefined_a_counters;static uint64_t oa_exp_1_millisec;static igt_render_copyfunc_t render_copy =NULL ; -static uint32_t (*read_report_ticks)(const uint32_t *report, +static uint64_t (*read_report_ticks)(const uint32_t *report,enum drm_i915_oa_format format); static void (*sanity_check_reports)(const uint32_t *oa_report0, const uint32_t *oa_report1,
@@ -395,7 +397,7 @@ sysfs_read(enum i915_attr_id id)* C2 corresponds to a clock counter for the Haswell render basic metric set * but it's not included in all of the formats. */ -static uint32_t +static uint64_t hsw_read_report_ticks (const uint32_t *report,enum drm_i915_oa_format format) {uint32_t *c = (uint32_t *)(((uint8_t *)report) +get_oa_format (format).c_off);
@@ -405,10 +407,41 @@ hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format)return c[2 ]; } -static uint32_t +static uint64_t gen8_read_report_ticks (const uint32_t *report,enum drm_i915_oa_format format) { -return report[3 ]; + +struct oa_format fmt =get_oa_format (format); + +return fmt.report_hdr_64bit ? *(uint64_t *)&report[6 ] : report[3 ]; +} + +/* +* t0 is a value sampled before t1. width is number of bits used to represent +* t0/t1. Normally t1 is greater than t0. In cases where t1 < t0 use this +* helper. Since the size of t1/t0 is already 64 bits, no special handling is +* needed for width = 64. +*/ +static uint64_t +__elapsed_delta (uint64_t t1,uint64_t t0,uint32_t width) +{ +uint32_t max_bits =sizeof (t1) *8 ; + +igt_assert (width <= max_bits); + +if (t1 < t0 && width != max_bits) +return ((1ULL << width) - t0) + t1; + +return t1 - t0; +} + +static uint64_t +oa_tick_delta (const uint32_t *report1, +const uint32_t *report0, +enum drm_i915_oa_format format) +{ +return __elapsed_delta (read_report_ticks (report1, format), +read_report_ticks (report0, format),32 ); } static void
@@ -638,8 +671,8 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, enum drm_i915_oa_format fmt) {uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); -uint32_t clock_delta; -uint32_t max_delta; +uint64_t clock_delta; +uint64_t max_delta;struct oa_format format =get_oa_format (fmt);igt_assert_neq (time_delta,0 );
@@ -654,21 +687,19 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, clock_delta = (gt_max_freq_mhz * (uint64_t )time_delta) /1000 ; }else { -uint32_t ticks0 =read_report_ticks (oa_report0, fmt); -uint32_t ticks1 =read_report_ticks (oa_report1, fmt);uint64_t freq; - clock_delta = ticks1 - ticks0; + clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt); -igt_assert_neq (clock_delta,0 ); +igt_assert_neq_u64 (clock_delta,0 ); - freq = ((uint64_t )clock_delta *1000 ) / time_delta; + freq = (clock_delta *1000 ) / time_delta;igt_debug ("freq = %" PRIu64"\n" , freq);igt_assert (freq <= gt_max_freq_mhz); } -igt_debug ("clock delta = %" PRIu32"\n" , clock_delta); +igt_debug ("clock delta = %" PRIu64"\n" , clock_delta);/* The maximum rate for any HSW counter = * clock_delta * N EUs
@@ -801,7 +832,8 @@ accumulate_reports(struct accumulator *accumulator,accumulate_uint32 (4 , start, end, deltas + idx++);/* clock cycles */ -accumulate_uint32 (12 , start, end, deltas + idx++); + deltas[idx] +=oa_tick_delta (end, start, accumulator->format); + idx++; }else {/* timestamp */ accumulate_uint32 (4 , start, end, deltas + idx++);
@@ -874,10 +906,8 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, {struct oa_format format =get_oa_format (fmt);uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); -uint32_t ticks0 =read_report_ticks (oa_report0, fmt); -uint32_t ticks1 =read_report_ticks (oa_report1, fmt); -uint32_t clock_delta = ticks1 - ticks0; -uint32_t max_delta; +uint64_t clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt); +uint64_t max_delta;uint64_t freq;uint32_t *rpt0_b = (uint32_t *)(((uint8_t *)oa_report0) + format.b_off);
@@ -890,10 +920,10 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0,gen8_read_report_reason (oa_report0), gen8_read_report_reason(oa_report1)); - freq = time_delta ? ((uint64_t )clock_delta *1000 ) / time_delta :0 ; + freq = time_delta ? (clock_delta *1000 ) / time_delta :0 ;igt_debug ("freq = %" PRIu64"\n" , freq); -igt_debug ("clock delta = %" PRIu32"\n" , clock_delta); +igt_debug ("clock delta = %" PRIu64"\n" , clock_delta); max_delta = clock_delta * intel_perf->devinfo.n_eus;
@@ -994,7 +1024,7 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, format.c_off);uint32_t delta = c1[j] - c0[j]; -igt_debug ("C%d: delta = %" PRIu32", max_delta=%" PRIu32"\n" , +igt_debug ("C%d: delta = %" PRIu32", max_delta=%" PRIu64"\n" , j, delta, max_delta);igt_assert (delta <= max_delta); }
@@ -1440,10 +1470,10 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt)if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" ); }else { -uint32_t clock0 =read_report_ticks (oa_report0, fmt); -uint32_t clock1 =read_report_ticks (oa_report1, fmt); +uint64_t clock0 =read_report_ticks (oa_report0, fmt); +uint64_t clock1 =read_report_ticks (oa_report1, fmt); -igt_debug ("CLOCK: 1st = %" PRIu32", 2nd = %" PRIu32", delta = %" PRIu32"\n" , +igt_debug ("CLOCK: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , clock0, clock1, clock1 - clock0); }
@@ -1545,9 +1575,9 @@ print_report(uint32_t *report, int fmt)if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" ); }else { -uint32_t clock =read_report_ticks (report, fmt); +uint64_t clock =read_report_ticks (report, fmt); -igt_debug ("CLOCK: %" PRIu32"\n" , clock); +igt_debug ("CLOCK: %" PRIu64"\n" , clock); }if (intel_gen (devid) >=8 ) {
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 16/23] i915/perf: Treat ticks as 64 bit
Quoted 69 lines · Umesh Nerlige Ramappa
DG2 A0 has a buggy header in the 64 bit OAG format. Except the ticks, all other fields are 32 bit. To resolve this, we will store ticks in 64 bit type.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- tests/i915/perf.c | 82 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 26 deletions(-)tests/i915/perf.c +17
-5@@ -117,6 +117,7 @@ struct oa_format {int c_off;int n_c;int oa_type; +bool report_hdr_64bit; };static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX ] = {@@ -203,7 +204,8 @@ static struct oa_format dg2_oa_formats[I915_OA_FORMAT_MAX] = { "A38u64_R2u64_B8_C8", .size = 448, .a64_off = 32, .n_a64 = 38, .b_off = 352, .n_b = 8, - .c_off = 384, .n_c = 8, .oa_type = OAG, }, + .c_off = 384, .n_c = 8, .oa_type = OAG, + .report_hdr_64bit = true, }, [I915_OAR_FORMAT_A36u64_B8_C8] = { "A36u64_B8_C8", .size = 384, .a64_off = 32, .n_a64 = 36,@@ -245,7 +247,7 @@ static bool *undefined_a_counters;static uint64_t oa_exp_1_millisec;static igt_render_copyfunc_t render_copy =NULL ; -static uint32_t (*read_report_ticks)(const uint32_t *report, +static uint64_t (*read_report_ticks)(const uint32_t *report,enum drm_i915_oa_format format); static void (*sanity_check_reports)(const uint32_t *oa_report0, const uint32_t *oa_report1,@@ -395,7 +397,7 @@ sysfs_read(enum i915_attr_id id)* C2 corresponds to a clock counter for the Haswell render basic metric set * but it's not included in all of the formats. */ -static uint32_t +static uint64_t hsw_read_report_ticks (const uint32_t *report,enum drm_i915_oa_format format) {uint32_t *c = (uint32_t *)(((uint8_t *)report) +get_oa_format (format).c_off);@@ -405,10 +407,41 @@ hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format)return c[2 ]; } -static uint32_t +static uint64_t gen8_read_report_ticks (const uint32_t *report,enum drm_i915_oa_format format) { -return report[3 ]; + +struct oa_format fmt =get_oa_format (format); + +return fmt.report_hdr_64bit ? *(uint64_t *)&report[6 ] : report[3 ]; +} + +/* +* t0 is a value sampled before t1. width is number of bits used to represent +* t0/t1. Normally t1 is greater than t0. In cases where t1 < t0 use this +* helper. Since the size of t1/t0 is already 64 bits, no special handling is +* needed for width = 64.
tests/i915/perf.c hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format) · line 433
Quoted 10 lines
tests/i915/perf.c +10
-0+*/ +static uint64_t +__elapsed_delta (uint64_t t1,uint64_t t0,uint32_t width) +{ +uint32_t max_bits =sizeof (t1) *8 ; + +igt_assert (width <= max_bits); + +if (t1 < t0 && width != max_bits) +return ((1ULL << width) - t0) + t1;
Should this be : ((1ULL << width) + t1) - t0 ?
Since we know the t1 wrapped around the counter's max bit size, the actual difference is the max value + whatever is in the counter minus t0.
Quoted 122 lines
tests/i915/perf.c +29
-21+ +return t1 - t0; +} + +static uint64_t +oa_tick_delta (const uint32_t *report1, +const uint32_t *report0, +enum drm_i915_oa_format format) +{ +return __elapsed_delta (read_report_ticks (report1, format), +read_report_ticks (report0, format),32 ); } static void@@ -638,8 +671,8 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, enum drm_i915_oa_format fmt) {uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); -uint32_t clock_delta; -uint32_t max_delta; +uint64_t clock_delta; +uint64_t max_delta;struct oa_format format =get_oa_format (fmt);igt_assert_neq (time_delta,0 );@@ -654,21 +687,19 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, clock_delta = (gt_max_freq_mhz * (uint64_t )time_delta) /1000 ; }else { -uint32_t ticks0 =read_report_ticks (oa_report0, fmt); -uint32_t ticks1 =read_report_ticks (oa_report1, fmt);uint64_t freq; - clock_delta = ticks1 - ticks0; + clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt); -igt_assert_neq (clock_delta,0 ); +igt_assert_neq_u64 (clock_delta,0 ); - freq = ((uint64_t )clock_delta *1000 ) / time_delta; + freq = (clock_delta *1000 ) / time_delta;igt_debug ("freq = %" PRIu64"\n" , freq);igt_assert (freq <= gt_max_freq_mhz); } -igt_debug ("clock delta = %" PRIu32"\n" , clock_delta); +igt_debug ("clock delta = %" PRIu64"\n" , clock_delta);/* The maximum rate for any HSW counter = * clock_delta * N EUs @@ -801,7 +832,8 @@ accumulate_reports(struct accumulator *accumulator,accumulate_uint32 (4 , start, end, deltas + idx++);/* clock cycles */ -accumulate_uint32 (12 , start, end, deltas + idx++); + deltas[idx] +=oa_tick_delta (end, start, accumulator->format); + idx++; }else {/* timestamp */ accumulate_uint32 (4 , start, end, deltas + idx++);@@ -874,10 +906,8 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, {struct oa_format format =get_oa_format (fmt);uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); -uint32_t ticks0 =read_report_ticks (oa_report0, fmt); -uint32_t ticks1 =read_report_ticks (oa_report1, fmt); -uint32_t clock_delta = ticks1 - ticks0; -uint32_t max_delta; +uint64_t clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt); +uint64_t max_delta;uint64_t freq;uint32_t *rpt0_b = (uint32_t *)(((uint8_t *)oa_report0) + format.b_off);@@ -890,10 +920,10 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0,gen8_read_report_reason (oa_report0), gen8_read_report_reason(oa_report1)); - freq = time_delta ? ((uint64_t )clock_delta *1000 ) / time_delta :0 ; + freq = time_delta ? (clock_delta *1000 ) / time_delta :0 ;igt_debug ("freq = %" PRIu64"\n" , freq); -igt_debug ("clock delta = %" PRIu32"\n" , clock_delta); +igt_debug ("clock delta = %" PRIu64"\n" , clock_delta); max_delta = clock_delta * intel_perf->devinfo.n_eus;@@ -994,7 +1024,7 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, format.c_off);uint32_t delta = c1[j] - c0[j]; -igt_debug ("C%d: delta = %" PRIu32", max_delta=%" PRIu32"\n" , +igt_debug ("C%d: delta = %" PRIu32", max_delta=%" PRIu64"\n" , j, delta, max_delta);igt_assert (delta <= max_delta); }@@ -1440,10 +1470,10 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt)if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" ); }else { -uint32_t clock0 =read_report_ticks (oa_report0, fmt); -uint32_t clock1 =read_report_ticks (oa_report1, fmt); +uint64_t clock0 =read_report_ticks (oa_report0, fmt); +uint64_t clock1 =read_report_ticks (oa_report1, fmt); -igt_debug ("CLOCK: 1st = %" PRIu32", 2nd = %" PRIu32", delta = %" PRIu32"\n" , +igt_debug ("CLOCK: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , clock0, clock1, clock1 - clock0); }@@ -1545,9 +1575,9 @@ print_report(uint32_t *report, int fmt)if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" ); }else { -uint32_t clock =read_report_ticks (report, fmt); +uint64_t clock =read_report_ticks (report, fmt); -igt_debug ("CLOCK: %" PRIu32"\n" , clock); +igt_debug ("CLOCK: %" PRIu64"\n" , clock); }if (intel_gen (devid) >=8 ) {
Re: [igt-dev] [PATCH i-g-t 16/23] i915/perf: Treat ticks as 64 bit
Quoted 72 lines · Lionel Landwerlin
Quoted 71 lines · Umesh Nerlige Ramappa
DG2 A0 has a buggy header in the 64 bit OAG format. Except the ticks, all other fields are 32 bit. To resolve this, we will store ticks in 64 bit type.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- tests/i915/perf.c | 82 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 26 deletions(-)tests/i915/perf.c +22
-5@@ -117,6 +117,7 @@ struct oa_format {int c_off;int n_c;int oa_type; +bool report_hdr_64bit; };static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX ] = {@@ -203,7 +204,8 @@ static struct oa_format dg2_oa_formats[I915_OA_FORMAT_MAX] = { "A38u64_R2u64_B8_C8", .size = 448, .a64_off = 32, .n_a64 = 38, .b_off = 352, .n_b = 8, - .c_off = 384, .n_c = 8, .oa_type = OAG, }, + .c_off = 384, .n_c = 8, .oa_type = OAG, + .report_hdr_64bit = true, }, [I915_OAR_FORMAT_A36u64_B8_C8] = { "A36u64_B8_C8", .size = 384, .a64_off = 32, .n_a64 = 36,@@ -245,7 +247,7 @@ static bool *undefined_a_counters;static uint64_t oa_exp_1_millisec;static igt_render_copyfunc_t render_copy =NULL ; -static uint32_t (*read_report_ticks)(const uint32_t *report, +static uint64_t (*read_report_ticks)(const uint32_t *report,enum drm_i915_oa_format format); static void (*sanity_check_reports)(const uint32_t *oa_report0, const uint32_t *oa_report1,@@ -395,7 +397,7 @@ sysfs_read(enum i915_attr_id id)* C2 corresponds to a clock counter for the Haswell render basic metric set * but it's not included in all of the formats. */ -static uint32_t +static uint64_t hsw_read_report_ticks (const uint32_t *report,enum drm_i915_oa_format format) {uint32_t *c = (uint32_t *)(((uint8_t *)report) +get_oa_format (format).c_off);@@ -405,10 +407,41 @@ hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format)return c[2 ]; } -static uint32_t +static uint64_t gen8_read_report_ticks (const uint32_t *report,enum drm_i915_oa_format format) { -return report[3 ]; + +struct oa_format fmt =get_oa_format (format); + +return fmt.report_hdr_64bit ? *(uint64_t *)&report[6 ] : report[3 ]; +} + +/* +* t0 is a value sampled before t1. width is number of bits used to represent +* t0/t1. Normally t1 is greater than t0. In cases where t1 < t0 use this +* helper. Since the size of t1/t0 is already 64 bits, no special handling is +* needed for width = 64. +*/ +static uint64_t +__elapsed_delta (uint64_t t1,uint64_t t0,uint32_t width) +{ +uint32_t max_bits =sizeof (t1) *8 ;
Quoted 9 lines
tests/i915/perf.c hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format) · line 433
Quoted 5 lines
tests/i915/perf.c +5
-0+ +igt_assert (width <= max_bits); + +if (t1 < t0 && width != max_bits) +return ((1ULL << width) - t0) + t1;Should this be : ((1ULL << width) + t1) - t0 ?
Both ways should yield the same result.
Quoted 110 lines
Since we know the t1 wrapped around the counter's max bit size, the actual difference is the max value + whatever is in the counter minus t0.
Quoted 104 lines
tests/i915/perf.c +29
-21+ +return t1 - t0; +} + +static uint64_t +oa_tick_delta (const uint32_t *report1, +const uint32_t *report0, +enum drm_i915_oa_format format) +{ +return __elapsed_delta (read_report_ticks (report1, format), +read_report_ticks (report0, format),32 ); } static void@@ -638,8 +671,8 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, enum drm_i915_oa_format fmt) {uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); -uint32_t clock_delta; -uint32_t max_delta; +uint64_t clock_delta; +uint64_t max_delta;struct oa_format format =get_oa_format (fmt);igt_assert_neq (time_delta,0 );@@ -654,21 +687,19 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, clock_delta = (gt_max_freq_mhz * (uint64_t )time_delta) /1000 ; }else { -uint32_t ticks0 =read_report_ticks (oa_report0, fmt); -uint32_t ticks1 =read_report_ticks (oa_report1, fmt);uint64_t freq; - clock_delta = ticks1 - ticks0; + clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt); -igt_assert_neq (clock_delta,0 ); +igt_assert_neq_u64 (clock_delta,0 ); - freq = ((uint64_t )clock_delta *1000 ) / time_delta; + freq = (clock_delta *1000 ) / time_delta;igt_debug ("freq = %" PRIu64"\n" , freq);igt_assert (freq <= gt_max_freq_mhz); } -igt_debug ("clock delta = %" PRIu32"\n" , clock_delta); +igt_debug ("clock delta = %" PRIu64"\n" , clock_delta);/* The maximum rate for any HSW counter = * clock_delta * N EUs @@ -801,7 +832,8 @@ accumulate_reports(struct accumulator *accumulator,accumulate_uint32 (4 , start, end, deltas + idx++);/* clock cycles */ -accumulate_uint32 (12 , start, end, deltas + idx++); + deltas[idx] +=oa_tick_delta (end, start, accumulator->format); + idx++; }else {/* timestamp */ accumulate_uint32 (4 , start, end, deltas + idx++);@@ -874,10 +906,8 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, {struct oa_format format =get_oa_format (fmt);uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); -uint32_t ticks0 =read_report_ticks (oa_report0, fmt); -uint32_t ticks1 =read_report_ticks (oa_report1, fmt); -uint32_t clock_delta = ticks1 - ticks0; -uint32_t max_delta; +uint64_t clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt); +uint64_t max_delta;uint64_t freq;uint32_t *rpt0_b = (uint32_t *)(((uint8_t *)oa_report0) + format.b_off);@@ -890,10 +920,10 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0,gen8_read_report_reason (oa_report0), gen8_read_report_reason(oa_report1)); - freq = time_delta ? ((uint64_t )clock_delta *1000 ) / time_delta :0 ; + freq = time_delta ? (clock_delta *1000 ) / time_delta :0 ;igt_debug ("freq = %" PRIu64"\n" , freq); -igt_debug ("clock delta = %" PRIu32"\n" , clock_delta); +igt_debug ("clock delta = %" PRIu64"\n" , clock_delta); max_delta = clock_delta * intel_perf->devinfo.n_eus;@@ -994,7 +1024,7 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, format.c_off);uint32_t delta = c1[j] - c0[j]; -igt_debug ("C%d: delta = %" PRIu32", max_delta=%" PRIu32"\n" , +igt_debug ("C%d: delta = %" PRIu32", max_delta=%" PRIu64"\n" , j, delta, max_delta);igt_assert (delta <= max_delta); }@@ -1440,10 +1470,10 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt)if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" ); }else { -uint32_t clock0 =read_report_ticks (oa_report0, fmt); -uint32_t clock1 =read_report_ticks (oa_report1, fmt); +uint64_t clock0 =read_report_ticks (oa_report0, fmt); +uint64_t clock1 =read_report_ticks (oa_report1, fmt); -igt_debug ("CLOCK: 1st = %" PRIu32", 2nd = %" PRIu32", delta = %" PRIu32"\n" , +igt_debug ("CLOCK: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , clock0, clock1, clock1 - clock0); }@@ -1545,9 +1575,9 @@ print_report(uint32_t *report, int fmt)if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" ); }else { -uint32_t clock =read_report_ticks (report, fmt); +uint64_t clock =read_report_ticks (report, fmt); -igt_debug ("CLOCK: %" PRIu32"\n" , clock); +igt_debug ("CLOCK: %" PRIu64"\n" , clock); }if (intel_gen (devid) >=8 ) {
Lionel Landwerlin
Reviewed-byRe: [igt-dev] [PATCH i-g-t 16/23] i915/perf: Treat ticks as 64 bit
Quoted 88 lines · Umesh Nerlige Ramappa
Quoted 77 lines · Lionel Landwerlin
Quoted 76 lines · Umesh Nerlige Ramappa
DG2 A0 has a buggy header in the 64 bit OAG format. Except the ticks, all other fields are 32 bit. To resolve this, we will store ticks in 64 bit type.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>---
tests/i915/perf.c | 82 ++++++++++++++++++++++++++++++++---------------1 file changed, 56 insertions(+), 26 deletions(-)tests/i915/perf.c +3
-1@@ -117,6 +117,7 @@ struct oa_format { int c_off; int n_c; int oa_type; + bool report_hdr_64bit; }; static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX] = {@@ -203,7 +204,8 @@ static struct oa_format dg2_oa_formats[I915_OA_FORMAT_MAX] = { "A38u64_R2u64_B8_C8", .size = 448, .a64_off = 32, .n_a64 = 38, .b_off = 352, .n_b = 8, - .c_off = 384, .n_c = 8, .oa_type = OAG, }, + .c_off = 384, .n_c = 8, .oa_type = OAG, + .report_hdr_64bit = true, }, [I915_OAR_FORMAT_A36u64_B8_C8] = { "A36u64_B8_C8", .size = 384,.a64_off = 32, .n_a64 = 36,
tests/i915/perf.c +11
-4@@ -245,7 +247,7 @@ static bool *undefined_a_counters; static uint64_t oa_exp_1_millisec; static igt_render_copyfunc_t render_copy = NULL; -static uint32_t (*read_report_ticks)(const uint32_t *report, +static uint64_t (*read_report_ticks)(const uint32_t *report, enum drm_i915_oa_format format); static void (*sanity_check_reports)(const uint32_t *oa_report0, const uint32_t *oa_report1,@@ -395,7 +397,7 @@ sysfs_read(enum i915_attr_id id)* C2 corresponds to a clock counter for the Haswell render basic metric set * but it's not included in all of the formats. */ -static uint32_t +static uint64_t hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format) { uint32_t *c = (uint32_t *)(((uint8_t *)report) + get_oa_format(format).c_off);@@ -405,10 +407,41 @@ hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format) return c[2]; } -static uint32_t +static uint64_t gen8_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format) { - return report[3]; + + struct oa_format fmt = get_oa_format(format); + + return fmt.report_hdr_64bit ? *(uint64_t *)&report[6] : report[3]; +} + +/* +* t0 is a value sampled before t1. width is number of bits used to represent
+ * t0/t1. Normally t1 is greater than t0. In cases where t1 < t0 use this
+ * helper. Since the size of t1/t0 is already 64 bits, no special handling is
+ * needed for width = 64.
+ */tests/i915/perf.c +4
-0+static uint64_t +__elapsed_delta (uint64_t t1,uint64_t t0,uint32_t width) +{ + uint32_t max_bits = sizeof(t1) * 8;Quoted 9 lines
tests/i915/perf.c hsw_read_report_ticks(const uint32_t *report, enum drm_i915_oa_format format) · line 433
Quoted 5 lines
tests/i915/perf.c +5
-0+ + igt_assert(width <= max_bits); + + if (t1 < t0 && width != max_bits) + return ((1ULL << width) - t0) + t1;Should this be : ((1ULL << width) + t1) - t0 ?
Quoted 1 line
Both ways should yield the same result.
My bad :
Quoted 120 lines
Quoted 120 lines
Since we know the t1 wrapped around the counter's max bit size, the actual difference is the max value + whatever is in the counter minus t0.
Quoted 113 lines
tests/i915/perf.c +11
-0+ + return t1 - t0; +} + +static uint64_t +oa_tick_delta (const uint32_t *report1, + const uint32_t *report0, + enum drm_i915_oa_format format) +{ + return __elapsed_delta(read_report_ticks(report1, format), + read_report_ticks(report0, format), 32);}
static voidtests/i915/perf.c +2
-2@@ -638,8 +671,8 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0, enum drm_i915_oa_format fmt) { uint32_t time_delta = timebase_scale(oa_report1[1] - oa_report0[1]); - uint32_t clock_delta; - uint32_t max_delta; + uint64_t clock_delta; + uint64_t max_delta; struct oa_format format = get_oa_format(fmt); igt_assert_neq(time_delta, 0);@@ -654,21 +687,19 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0,
clock_delta= (gt_max_freq_mhz* (uint64_t)time_delta) / 1000;
} else {
-uint32_tticks0 =read_report_ticks(oa_report0, fmt); -uint32_tticks1 =read_report_ticks(oa_report1, fmt);uint64_tfreq;
-clock_delta= ticks1 - ticks0;
+clock_delta=oa_tick_delta(oa_report1, oa_report0, fmt); -igt_assert_neq(clock_delta, 0);
+igt_assert_neq_u64(clock_delta, 0);
- freq = ((uint64_t)clock_delta * 1000) /time_delta; + freq = (clock_delta* 1000) /time_delta;igt_debug("freq = %"PRIu64"\n", freq);igt_assert(freq <= gt_max_freq_mhz);
}
-igt_debug("clock delta = %"PRIu32"\n", clock_delta); +igt_debug("clock delta = %"PRIu64"\n", clock_delta); /* The maximum rate for any HSW counter =
*clock_delta* N EUstests/i915/perf.c +4
-5@@ -801,7 +832,8 @@ accumulate_reports(struct accumulator *accumulator, accumulate_uint32(4, start, end, deltas + idx++); /* clock cycles */ - accumulate_uint32(12, start, end, deltas + idx++); + deltas[idx] += oa_tick_delta(end, start, accumulator->format); + idx++; } else { /* timestamp */ accumulate_uint32(4, start, end, deltas + idx++);@@ -874,10 +906,8 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, { struct oa_format format = get_oa_format(fmt); uint32_t time_delta = timebase_scale(oa_report1[1] - oa_report0[1]); - uint32_t ticks0 = read_report_ticks(oa_report0, fmt); - uint32_t ticks1 = read_report_ticks(oa_report1, fmt); - uint32_t clock_delta = ticks1 - ticks0; - uint32_t max_delta; + uint64_t clock_delta = oa_tick_delta(oa_report1, oa_report0, fmt); + uint64_t max_delta; uint64_t freq;
uint32_t*rpt0_b= (uint32_t*)(((uint8_t *)oa_report0) + format.b_off);tests/i915/perf.c +6
-6@@ -890,10 +920,10 @@ gen8_sanity_check_test_oa_reports(constuint32_t *oa_report0, gen8_read_report_reason(oa_report0), gen8_read_report_reason(oa_report1)); - freq = time_delta ? ((uint64_t)clock_delta * 1000) / time_delta : 0; + freq = time_delta ? (clock_delta * 1000) / time_delta : 0; igt_debug("freq = %"PRIu64"\n", freq); - igt_debug("clock delta = %"PRIu32"\n", clock_delta); + igt_debug("clock delta = %"PRIu64"\n", clock_delta); max_delta = clock_delta * intel_perf->devinfo.n_eus;@@ -994,7 +1024,7 @@ gen8_sanity_check_test_oa_reports(constuint32_t *oa_report0, format.c_off); uint32_t delta = c1[j] - c0[j]; - igt_debug("C%d: delta = %"PRIu32", max_delta=%"PRIu32"\n", + igt_debug("C%d: delta = %"PRIu32", max_delta=%"PRIu64"\n", j, delta, max_delta); igt_assert(delta <= max_delta); }@@ -1440,10 +1470,10 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) if (IS_HASWELL(devid) && format.n_c == 0) { igt_debug("CLOCK = N/A\n"); } else { - uint32_t clock0 = read_report_ticks(oa_report0, fmt); - uint32_t clock1 = read_report_ticks(oa_report1, fmt); + uint64_t clock0 = read_report_ticks(oa_report0, fmt); + uint64_t clock1 = read_report_ticks(oa_report1, fmt); - igt_debug("CLOCK: 1st = %"PRIu32", 2nd = %"PRIu32", delta = %"PRIu32"\n", + igt_debug("CLOCK: 1st = %"PRIu64", 2nd = %"PRIu64", delta = %"PRIu64"\n", clock0, clock1, clock1 - clock0);}
tests/i915/perf.c +2
-2@@ -1545,9 +1575,9 @@ print_report(uint32_t *report, int fmt) if (IS_HASWELL(devid) && format.n_c == 0) { igt_debug("CLOCK = N/A\n"); } else { - uint32_t clock = read_report_ticks(report, fmt); + uint64_t clock = read_report_ticks(report, fmt); - igt_debug("CLOCK: %"PRIu32"\n", clock); + igt_debug("CLOCK: %"PRIu64"\n", clock); } if (intel_gen(devid) >= 8) {
PATCH 17/23 i915/perf: Treat timestamp as 64 bit value
In reply to Umesh Nerlige RamappaNew OA formats in DG2 have 64 bit OA report header. Update the timestamp in the tests to be dafault 64 bit.
--- tests/i915/perf.c | 133 +++++++++++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 54 deletions(-)
tests/i915/perf.c +79 -54
@@ -510,9 +510,28 @@ cs_timebase_scale(uint32_t u32_delta) }static uint64_t -timebase_scale (uint32_t u32_delta) +oa_timestamp (const uint32_t *report,enum drm_i915_oa_format format) { -return ((uint64_t )u32_delta *NSEC_PER_SEC ) / intel_perf->devinfo.timestamp_frequency; +struct oa_format fmt =get_oa_format (format); + +return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +} + +static uint64_t +oa_timestamp_delta (const uint32_t *report1, +const uint32_t *report0, +enum drm_i915_oa_format format) +{ +uint32_t width =intel_graphics_ver (devid) >=IP_VER (12 ,55 ) ?56 :32 ; + +return __elapsed_delta (oa_timestamp (report1, format), +oa_timestamp (report0, format), width); +} + +static uint64_t +timebase_scale (uint64_t delta) +{ +return (delta *NSEC_PER_SEC ) / intel_perf->devinfo.timestamp_frequency; }/* Returns: the largest OA exponent that will still result in a sampling period
@@ -521,7 +540,7 @@ timebase_scale(uint32_t u32_delta)static int max_oa_exponent_for_period_lte (uint64_t period) { -/* NB: timebase_scale() takes a uint32_t and an exponent of 30 +/* NB: timebase_scale() takes a uint64_t and an exponent of 30 * would already represent a period of ~3 minutes so there's * really no need to consider higher exponents. */
@@ -670,12 +689,14 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0,const uint32_t *oa_report1, enum drm_i915_oa_format fmt) { - uint32_t time_delta = timebase_scale(oa_report1[1] - oa_report0[1]); + uint64_t time_delta = timebase_scale(oa_timestamp_delta(oa_report1, + oa_report0, + fmt));uint64_t clock_delta;uint64_t max_delta;struct oa_format format =get_oa_format (fmt); -igt_assert_neq (time_delta,0 ); +igt_assert_neq_u64 (time_delta,0 );/* As a special case we have to consider that on Haswell we * can't explicitly derive a clock delta for all OA report
@@ -684,8 +705,7 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0,if (format.n_c ==0 ) {/* Assume running at max freq for sake of * below sanity check on counters... */ - clock_delta = (gt_max_freq_mhz * - (uint64_t )time_delta) /1000 ; + clock_delta = (gt_max_freq_mhz * time_delta) /1000 ; }else {uint64_t freq;
@@ -829,7 +849,8 @@ accumulate_reports(struct accumulator *accumulator,if (intel_gen (devid) >=8 ) {/* timestamp */ -accumulate_uint32 (4 , start, end, deltas + idx++); + deltas[idx] +=oa_timestamp_delta (end, start, accumulator->format); + idx++;/* clock cycles */ deltas[idx] +=oa_tick_delta (end, start, accumulator->format);
@@ -905,7 +926,9 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, enum drm_i915_oa_format fmt) {struct oa_format format =get_oa_format (fmt); -uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); +uint64_t time_delta =timebase_scale (oa_timestamp_delta (oa_report1, + oa_report0, + fmt));uint64_t clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt);uint64_t max_delta;uint64_t freq;
@@ -1093,11 +1116,11 @@ static int i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format, uint8_t *buf, uint32_t max_size, - uint32_t start_timestamp, - uint32_t end_timestamp) + uint64_t start_timestamp, + uint64_t end_timestamp) { size_t format_size = get_oa_format(oa_format).size; -uint32_t last_seen_timestamp = start_timestamp; +uint64_t last_seen_timestamp = start_timestamp;int total_len =0 ;while (last_seen_timestamp < end_timestamp) {
@@ -1106,7 +1129,7 @@ i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format,/* Running out of space. */ if ((max_size - total_len) < format_size) {igt_warn ("run out of space before reaching " -"end timestamp (%u/%u)\n" , +"end timestamp (%" PRIu64"/%" PRIu64")\n" , last_seen_timestamp, end_timestamp);return -1 ; }
@@ -1135,7 +1158,7 @@ i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format,uint32_t *report = (uint32_t *) (header +1 );if (header->type ==DRM_I915_PERF_RECORD_SAMPLE ) - last_seen_timestamp = report[1 ]; + last_seen_timestamp =oa_timestamp (report, oa_format); offset += header->size; }
@@ -1400,11 +1423,11 @@ read_2_oa_reports(int format_id, report = (const void *)(header +1 );dump_report (report, format_size /4 ,"oa-formats" ); -igt_debug ("read report: reason = %x, timestamp = %x, exponent mask=%x\n" , - report[0 ], report[1 ], exponent_mask); +igt_debug ("read report: reason = %x, timestamp = %" PRIx64", exponent mask=%x\n" , + report[0 ],oa_timestamp (report, format_id), exponent_mask);/* Don't expect zero for timestamps */ -igt_assert_neq (report[1 ],0 ); +igt_assert_neq_u64 (oa_timestamp (report, format_id),0 );if (timer_only) {if (!oa_report_is_periodic (exponent, report)) {
@@ -1463,9 +1486,11 @@ static void print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) {struct oa_format format =get_oa_format (fmt); +uint64_t ts0 =oa_timestamp (oa_report0, fmt); +uint64_t ts1 =oa_timestamp (oa_report1, fmt); -igt_debug ("TIMESTAMP: 1st = %" PRIu32", 2nd = %" PRIu32", delta = %" PRIu32"\n" , - oa_report0[1 ], oa_report1[1 ], oa_report1[1 ] - oa_report0[1 ]); +igt_debug ("TIMESTAMP: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , + ts0, ts1, ts1 - ts0);if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" );
@@ -1570,7 +1595,7 @@ print_report(uint32_t *report, int fmt) {struct oa_format format =get_oa_format (fmt); -igt_debug ("TIMESTAMP: %" PRIu32"\n" , report[1 ]); +igt_debug ("TIMESTAMP: %" PRIu64"\n" ,oa_timestamp (report, fmt));if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" );
@@ -1885,15 +1910,16 @@ test_oa_exponents(void)__perf_close (stream_fd); -igt_debug ("report%04i ts=%08x hw_id=0x%08x\n" ,0 , - timer_reports[0 ].report[1 ], +igt_debug ("report%04i ts=%" PRIx64" hw_id=0x%08x\n" ,0 , +oa_timestamp (timer_reports[0 ].report, test_set->perf_oa_format),oa_report_get_ctx_id (timer_reports[0 ].report));for (int i =1 ; i < n_timer_reports; i++) { -uint32_t delta = - timer_reports[i].report[1 ] - timer_reports[i -1 ].report[1 ]; +uint64_t delta =oa_timestamp_delta (timer_reports[i].report, + timer_reports[i -1 ].report, + test_set->perf_oa_format); -igt_debug ("report%04i ts=%08x hw_id=0x%08x delta=%u %s\n" , i, - timer_reports[i].report[1 ], +igt_debug ("report%04i ts=%" PRIx64" hw_id=0x%08x delta=%" PRIu64" %s\n" , i, +oa_timestamp (timer_reports[i].report, test_set->perf_oa_format),oa_report_get_ctx_id (timer_reports[i].report), delta,expected_report_timing_delta (delta, expected_timestamp_delta) ?"" :"******" );
@@ -2694,17 +2720,17 @@ test_buffer_fill(void)igt_debug ("report loss, trying again\n" );break ;case DRM_I915_PERF_RECORD_SAMPLE : -igt_debug (" > report ts=%u" -" ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x nb_periodic=%u\n" , - report[1 ], - n_periodic_reports >0 ? report[1 ] - last_periodic_report[1 ] :0 , +igt_debug (" > report ts=%" PRIu64"" +" ts_delta_last_periodic=%" PRIu64" is_timer=%i ctx_id=%8x nb_periodic=%u\n" , +oa_timestamp (report, test_set->perf_oa_format), + n_periodic_reports >0 ?oa_timestamp_delta (report, last_periodic_report, test_set->perf_oa_format) :0 ,oa_report_is_periodic (oa_exponent, report),oa_report_get_ctx_id (report), n_periodic_reports);if (first_timestamp ==0 ) - first_timestamp = report[1 ]; - last_timestamp = report[1 ]; + first_timestamp =oa_timestamp (report, test_set->perf_oa_format); + last_timestamp =oa_timestamp (report, test_set->perf_oa_format);if (((last_timestamp - first_timestamp) * oa_period) < (fill_duration /2 ))break ;
@@ -2918,12 +2944,12 @@ test_enable_disable(void) first_timestamp = report[1 ]; last_timestamp = report[1 ]; -igt_debug (" > report ts=%8x" -" ts_delta_last_periodic=%s%8u" +igt_debug (" > report ts=%" PRIx64"" +" ts_delta_last_periodic=%s%" PRIu64"" " is_timer=%i ctx_id=0x%8x\n" , - report[1 ], +oa_timestamp (report, test_set->perf_oa_format),oa_report_is_periodic (oa_exponent, report) ?" " :"*" , - n_periodic_reports >0 ? (report[1 ] - last_periodic_report[1 ]) :0 , + n_periodic_reports >0 ?oa_timestamp_delta (report, last_periodic_report, test_set->perf_oa_format) :0 ,oa_report_is_periodic (oa_exponent, report),oa_report_get_ctx_id (report));
@@ -3254,7 +3280,7 @@ gen12_test_mi_rpc(void)* size amount of data was written. */ igt_assert_eq (report32[0 ],REPORT_ID ); -igt_assert_neq (report32[1 ],0 ); +igt_assert (oa_timestamp (report32, test_set->perf_oa_format));igt_assert_neq (report32[format.b_off >>2 ],0x80808080 );igt_assert_eq (report32[format_size_32],0x80808080 );
@@ -3315,7 +3341,7 @@ test_mi_rpc(void) report32 = buf->ptr;dump_report (report32,64 ,"mi-rpc" );igt_assert_eq (report32[0 ],0xdeadbeef );/* report ID */ -igt_assert_neq (report32[1 ],0 );/* timestamp */ +igt_assert (oa_timestamp (report32, test_set->perf_oa_format));/* timestamp */ igt_assert_neq (report32[63 ],0x80808080 );/* end of report */ igt_assert_eq (report32[64 ],0x80808080 );/* after 256 byte report */
@@ -4050,9 +4076,9 @@ static void gen12_single_ctx_helper(void)uint32_t context0_id, context1_id;uint32_t *report0_32, *report1_32, *report2_32, *report3_32;uint64_t timestamp0_64, timestamp1_64; -uint32_t delta_ts64, delta_oa32; +uint64_t delta_ts64, delta_oa32;uint64_t delta_ts64_ns, delta_oa32_ns; -uint32_t delta_delta; +uint64_t delta_delta;int width =800 ;int height =600 ;#define INVALID_CTX_ID 0xffffffff
@@ -4060,7 +4086,7 @@ static void gen12_single_ctx_helper(void)uint32_t ctx1_id =INVALID_CTX_ID ;int ret;struct accumulator accumulator = { - .format = test_set->perf_oa_format + .format = fmt }; bops =buf_ops_create (drm_fd);
@@ -4207,14 +4233,14 @@ static void gen12_single_ctx_helper(void)*/ report0_32 = dst_buf->ptr;igt_assert_eq (report0_32[0 ],0xdeadbeef ); -igt_assert_neq (report0_32[1 ],0 ); +igt_assert (oa_timestamp (report0_32, fmt)); ctx0_id = report0_32[2 ];igt_debug ("MI_RPC(start) CTX ID: %u\n" , ctx0_id);dump_report (report0_32,64 ,"report0_32" ); report1_32 = report0_32 +64 ;igt_assert_eq (report1_32[0 ],0xbeefbeef ); -igt_assert_neq (report1_32[1 ],0 ); +igt_assert (oa_timestamp (report1_32, fmt)); ctx1_id = report1_32[2 ];igt_debug ("CTX ID1: %u\n" , ctx1_id);dump_report (report1_32,64 ,"report1_32" );
@@ -4222,7 +4248,7 @@ static void gen12_single_ctx_helper(void)/* Verify that counters in context1 are all zeroes */ report2_32 = report0_32 +128 ;igt_assert_eq (report2_32[0 ],0x00c0ffee ); -igt_assert_neq (report2_32[1 ],0 ); +igt_assert (oa_timestamp (report2_32, fmt));dump_report (report2_32,64 ,"report2_32" ); igt_assert_eq(0, memcmp(&report2_32[4], (uint8_t *) dst_buf->ptr + 2048,
@@ -4230,7 +4256,7 @@ static void gen12_single_ctx_helper(void) report3_32 = report0_32 +192 ;igt_assert_eq (report3_32[0 ],0x01c0ffee ); -igt_assert_neq (report3_32[1 ],0 ); +igt_assert (oa_timestamp (report3_32, fmt));dump_report (report3_32,64 ,"report3_32" ); igt_assert_eq(0, memcmp(&report3_32[4], (uint8_t *) dst_buf->ptr + 2048,
@@ -4244,8 +4270,8 @@ static void gen12_single_ctx_helper(void) accumulator.deltas[2 +21 ], accumulator.deltas[2 + 26]); -igt_debug ("oa_timestamp32 0 = %u\n" , report0_32[1 ]); -igt_debug ("oa_timestamp32 1 = %u\n" , report1_32[1 ]); +igt_debug ("oa_timestamp32 0 = %" PRIu64"\n" ,oa_timestamp (report0_32, fmt)); +igt_debug ("oa_timestamp32 1 = %" PRIu64"\n" ,oa_timestamp (report1_32, fmt));igt_debug ("ctx_id 0 = %u\n" , report0_32[2 ]);igt_debug ("ctx_id 1 = %u\n" , report1_32[2 ]);
@@ -4260,23 +4286,22 @@ static void gen12_single_ctx_helper(void)igt_debug ("ts_timestamp64 1 = %" PRIu64"\n" , timestamp1_64); delta_ts64 = timestamp1_64 - timestamp0_64; - delta_oa32 = report1_32[1 ] - report0_32[1 ]; + delta_oa32 =oa_timestamp_delta (report1_32, report0_32, fmt);/* Sanity check that we can pass the delta to timebase_scale */ -igt_assert (delta_ts64 <UINT32_MAX ); delta_oa32_ns =timebase_scale (delta_oa32); delta_ts64_ns =cs_timebase_scale (delta_ts64); -igt_debug ("oa32 delta = %u, = %uns\n" , - delta_oa32, (unsigned )delta_oa32_ns); -igt_debug ("ts64 delta = %u, = %uns\n" , - delta_ts64, (unsigned )delta_ts64_ns); +igt_debug ("oa32 delta = %" PRIu64", = %" PRIu64"ns\n" , + delta_oa32, delta_oa32_ns); +igt_debug ("ts64 delta = %" PRIu64", = %" PRIu64"ns\n" , + delta_ts64, delta_ts64_ns); delta_delta = delta_ts64_ns > delta_oa32_ns ? (delta_ts64_ns - delta_oa32_ns) : (delta_oa32_ns - delta_ts64_ns);if (delta_delta >5000 ) { -igt_debug ("delta_delta = %d. exceeds margin, skipping..\n" , +igt_debug ("delta_delta = %" PRIu64". exceeds margin, skipping..\n" , delta_delta);exit (EAGAIN ); }
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 17/23] i915/perf: Treat timestamp as 64 bit value
Quoted 4 lines · Umesh Nerlige Ramappa
New OA formats in DG2 have 64 bit OA report header. Update the timestamp in the tests to be dafault 64 bit.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 346 lines
--- tests/i915/perf.c | 133 +++++++++++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 54 deletions(-)tests/i915/perf.c +79
-54@@ -510,9 +510,28 @@ cs_timebase_scale(uint32_t u32_delta) }static uint64_t -timebase_scale (uint32_t u32_delta) +oa_timestamp (const uint32_t *report,enum drm_i915_oa_format format) { -return ((uint64_t )u32_delta *NSEC_PER_SEC ) / intel_perf->devinfo.timestamp_frequency; +struct oa_format fmt =get_oa_format (format); + +return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +} + +static uint64_t +oa_timestamp_delta (const uint32_t *report1, +const uint32_t *report0, +enum drm_i915_oa_format format) +{ +uint32_t width =intel_graphics_ver (devid) >=IP_VER (12 ,55 ) ?56 :32 ; + +return __elapsed_delta (oa_timestamp (report1, format), +oa_timestamp (report0, format), width); +} + +static uint64_t +timebase_scale (uint64_t delta) +{ +return (delta *NSEC_PER_SEC ) / intel_perf->devinfo.timestamp_frequency; }/* Returns: the largest OA exponent that will still result in a sampling period @@ -521,7 +540,7 @@ timebase_scale(uint32_t u32_delta)static int max_oa_exponent_for_period_lte (uint64_t period) { -/* NB: timebase_scale() takes a uint32_t and an exponent of 30 +/* NB: timebase_scale() takes a uint64_t and an exponent of 30 * would already represent a period of ~3 minutes so there's * really no need to consider higher exponents. */ @@ -670,12 +689,14 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0,const uint32_t *oa_report1, enum drm_i915_oa_format fmt) { - uint32_t time_delta = timebase_scale(oa_report1[1] - oa_report0[1]); + uint64_t time_delta = timebase_scale(oa_timestamp_delta(oa_report1, + oa_report0, + fmt));uint64_t clock_delta;uint64_t max_delta;struct oa_format format =get_oa_format (fmt); -igt_assert_neq (time_delta,0 ); +igt_assert_neq_u64 (time_delta,0 );/* As a special case we have to consider that on Haswell we * can't explicitly derive a clock delta for all OA report @@ -684,8 +705,7 @@ hsw_sanity_check_render_basic_reports(const uint32_t *oa_report0,if (format.n_c ==0 ) {/* Assume running at max freq for sake of * below sanity check on counters... */ - clock_delta = (gt_max_freq_mhz * - (uint64_t )time_delta) /1000 ; + clock_delta = (gt_max_freq_mhz * time_delta) /1000 ; }else {uint64_t freq;@@ -829,7 +849,8 @@ accumulate_reports(struct accumulator *accumulator,if (intel_gen (devid) >=8 ) {/* timestamp */ -accumulate_uint32 (4 , start, end, deltas + idx++); + deltas[idx] +=oa_timestamp_delta (end, start, accumulator->format); + idx++;/* clock cycles */ deltas[idx] +=oa_tick_delta (end, start, accumulator->format);@@ -905,7 +926,9 @@ gen8_sanity_check_test_oa_reports(const uint32_t *oa_report0, enum drm_i915_oa_format fmt) {struct oa_format format =get_oa_format (fmt); -uint32_t time_delta =timebase_scale (oa_report1[1 ] - oa_report0[1 ]); +uint64_t time_delta =timebase_scale (oa_timestamp_delta (oa_report1, + oa_report0, + fmt));uint64_t clock_delta =oa_tick_delta (oa_report1, oa_report0, fmt);uint64_t max_delta;uint64_t freq;@@ -1093,11 +1116,11 @@ static int i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format, uint8_t *buf, uint32_t max_size, - uint32_t start_timestamp, - uint32_t end_timestamp) + uint64_t start_timestamp, + uint64_t end_timestamp) { size_t format_size = get_oa_format(oa_format).size; -uint32_t last_seen_timestamp = start_timestamp; +uint64_t last_seen_timestamp = start_timestamp;int total_len =0 ;while (last_seen_timestamp < end_timestamp) {@@ -1106,7 +1129,7 @@ i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format,/* Running out of space. */ if ((max_size - total_len) < format_size) {igt_warn ("run out of space before reaching " -"end timestamp (%u/%u)\n" , +"end timestamp (%" PRIu64"/%" PRIu64")\n" , last_seen_timestamp, end_timestamp);return -1 ; }@@ -1135,7 +1158,7 @@ i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format,uint32_t *report = (uint32_t *) (header +1 );if (header->type ==DRM_I915_PERF_RECORD_SAMPLE ) - last_seen_timestamp = report[1 ]; + last_seen_timestamp =oa_timestamp (report, oa_format); offset += header->size; }@@ -1400,11 +1423,11 @@ read_2_oa_reports(int format_id, report = (const void *)(header +1 );dump_report (report, format_size /4 ,"oa-formats" ); -igt_debug ("read report: reason = %x, timestamp = %x, exponent mask=%x\n" , - report[0 ], report[1 ], exponent_mask); +igt_debug ("read report: reason = %x, timestamp = %" PRIx64", exponent mask=%x\n" , + report[0 ],oa_timestamp (report, format_id), exponent_mask);/* Don't expect zero for timestamps */ -igt_assert_neq (report[1 ],0 ); +igt_assert_neq_u64 (oa_timestamp (report, format_id),0 );if (timer_only) {if (!oa_report_is_periodic (exponent, report)) {@@ -1463,9 +1486,11 @@ static void print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt) {struct oa_format format =get_oa_format (fmt); +uint64_t ts0 =oa_timestamp (oa_report0, fmt); +uint64_t ts1 =oa_timestamp (oa_report1, fmt); -igt_debug ("TIMESTAMP: 1st = %" PRIu32", 2nd = %" PRIu32", delta = %" PRIu32"\n" , - oa_report0[1 ], oa_report1[1 ], oa_report1[1 ] - oa_report0[1 ]); +igt_debug ("TIMESTAMP: 1st = %" PRIu64", 2nd = %" PRIu64", delta = %" PRIu64"\n" , + ts0, ts1, ts1 - ts0);if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" );@@ -1570,7 +1595,7 @@ print_report(uint32_t *report, int fmt) {struct oa_format format =get_oa_format (fmt); -igt_debug ("TIMESTAMP: %" PRIu32"\n" , report[1 ]); +igt_debug ("TIMESTAMP: %" PRIu64"\n" ,oa_timestamp (report, fmt));if (IS_HASWELL (devid) && format.n_c ==0 ) {igt_debug ("CLOCK = N/A\n" );@@ -1885,15 +1910,16 @@ test_oa_exponents(void)__perf_close (stream_fd); -igt_debug ("report%04i ts=%08x hw_id=0x%08x\n" ,0 , - timer_reports[0 ].report[1 ], +igt_debug ("report%04i ts=%" PRIx64" hw_id=0x%08x\n" ,0 , +oa_timestamp (timer_reports[0 ].report, test_set->perf_oa_format),oa_report_get_ctx_id (timer_reports[0 ].report));for (int i =1 ; i < n_timer_reports; i++) { -uint32_t delta = - timer_reports[i].report[1 ] - timer_reports[i -1 ].report[1 ]; +uint64_t delta =oa_timestamp_delta (timer_reports[i].report, + timer_reports[i -1 ].report, + test_set->perf_oa_format); -igt_debug ("report%04i ts=%08x hw_id=0x%08x delta=%u %s\n" , i, - timer_reports[i].report[1 ], +igt_debug ("report%04i ts=%" PRIx64" hw_id=0x%08x delta=%" PRIu64" %s\n" , i, +oa_timestamp (timer_reports[i].report, test_set->perf_oa_format),oa_report_get_ctx_id (timer_reports[i].report), delta,expected_report_timing_delta (delta, expected_timestamp_delta) ?"" :"******" );@@ -2694,17 +2720,17 @@ test_buffer_fill(void)igt_debug ("report loss, trying again\n" );break ;case DRM_I915_PERF_RECORD_SAMPLE : -igt_debug (" > report ts=%u" -" ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x nb_periodic=%u\n" , - report[1 ], - n_periodic_reports >0 ? report[1 ] - last_periodic_report[1 ] :0 , +igt_debug (" > report ts=%" PRIu64"" +" ts_delta_last_periodic=%" PRIu64" is_timer=%i ctx_id=%8x nb_periodic=%u\n" , +oa_timestamp (report, test_set->perf_oa_format), + n_periodic_reports >0 ?oa_timestamp_delta (report, last_periodic_report, test_set->perf_oa_format) :0 ,oa_report_is_periodic (oa_exponent, report),oa_report_get_ctx_id (report), n_periodic_reports);if (first_timestamp ==0 ) - first_timestamp = report[1 ]; - last_timestamp = report[1 ]; + first_timestamp =oa_timestamp (report, test_set->perf_oa_format); + last_timestamp =oa_timestamp (report, test_set->perf_oa_format);if (((last_timestamp - first_timestamp) * oa_period) < (fill_duration /2 ))break ;@@ -2918,12 +2944,12 @@ test_enable_disable(void) first_timestamp = report[1 ]; last_timestamp = report[1 ]; -igt_debug (" > report ts=%8x" -" ts_delta_last_periodic=%s%8u" +igt_debug (" > report ts=%" PRIx64"" +" ts_delta_last_periodic=%s%" PRIu64"" " is_timer=%i ctx_id=0x%8x\n" , - report[1 ], +oa_timestamp (report, test_set->perf_oa_format),oa_report_is_periodic (oa_exponent, report) ?" " :"*" , - n_periodic_reports >0 ? (report[1 ] - last_periodic_report[1 ]) :0 , + n_periodic_reports >0 ?oa_timestamp_delta (report, last_periodic_report, test_set->perf_oa_format) :0 ,oa_report_is_periodic (oa_exponent, report),oa_report_get_ctx_id (report));@@ -3254,7 +3280,7 @@ gen12_test_mi_rpc(void)* size amount of data was written. */ igt_assert_eq (report32[0 ],REPORT_ID ); -igt_assert_neq (report32[1 ],0 ); +igt_assert (oa_timestamp (report32, test_set->perf_oa_format));igt_assert_neq (report32[format.b_off >>2 ],0x80808080 );igt_assert_eq (report32[format_size_32],0x80808080 );@@ -3315,7 +3341,7 @@ test_mi_rpc(void) report32 = buf->ptr;dump_report (report32,64 ,"mi-rpc" );igt_assert_eq (report32[0 ],0xdeadbeef );/* report ID */ -igt_assert_neq (report32[1 ],0 );/* timestamp */ +igt_assert (oa_timestamp (report32, test_set->perf_oa_format));/* timestamp */ igt_assert_neq (report32[63 ],0x80808080 );/* end of report */ igt_assert_eq (report32[64 ],0x80808080 );/* after 256 byte report */ @@ -4050,9 +4076,9 @@ static void gen12_single_ctx_helper(void)uint32_t context0_id, context1_id;uint32_t *report0_32, *report1_32, *report2_32, *report3_32;uint64_t timestamp0_64, timestamp1_64; -uint32_t delta_ts64, delta_oa32; +uint64_t delta_ts64, delta_oa32;uint64_t delta_ts64_ns, delta_oa32_ns; -uint32_t delta_delta; +uint64_t delta_delta;int width =800 ;int height =600 ;#define INVALID_CTX_ID 0xffffffff@@ -4060,7 +4086,7 @@ static void gen12_single_ctx_helper(void)uint32_t ctx1_id =INVALID_CTX_ID ;int ret;struct accumulator accumulator = { - .format = test_set->perf_oa_format + .format = fmt }; bops =buf_ops_create (drm_fd);@@ -4207,14 +4233,14 @@ static void gen12_single_ctx_helper(void)*/ report0_32 = dst_buf->ptr;igt_assert_eq (report0_32[0 ],0xdeadbeef ); -igt_assert_neq (report0_32[1 ],0 ); +igt_assert (oa_timestamp (report0_32, fmt)); ctx0_id = report0_32[2 ];igt_debug ("MI_RPC(start) CTX ID: %u\n" , ctx0_id);dump_report (report0_32,64 ,"report0_32" ); report1_32 = report0_32 +64 ;igt_assert_eq (report1_32[0 ],0xbeefbeef ); -igt_assert_neq (report1_32[1 ],0 ); +igt_assert (oa_timestamp (report1_32, fmt)); ctx1_id = report1_32[2 ];igt_debug ("CTX ID1: %u\n" , ctx1_id);dump_report (report1_32,64 ,"report1_32" );@@ -4222,7 +4248,7 @@ static void gen12_single_ctx_helper(void)/* Verify that counters in context1 are all zeroes */ report2_32 = report0_32 +128 ;igt_assert_eq (report2_32[0 ],0x00c0ffee ); -igt_assert_neq (report2_32[1 ],0 ); +igt_assert (oa_timestamp (report2_32, fmt));dump_report (report2_32,64 ,"report2_32" ); igt_assert_eq(0, memcmp(&report2_32[4], (uint8_t *) dst_buf->ptr + 2048,@@ -4230,7 +4256,7 @@ static void gen12_single_ctx_helper(void) report3_32 = report0_32 +192 ;igt_assert_eq (report3_32[0 ],0x01c0ffee ); -igt_assert_neq (report3_32[1 ],0 ); +igt_assert (oa_timestamp (report3_32, fmt));dump_report (report3_32,64 ,"report3_32" ); igt_assert_eq(0, memcmp(&report3_32[4], (uint8_t *) dst_buf->ptr + 2048,@@ -4244,8 +4270,8 @@ static void gen12_single_ctx_helper(void) accumulator.deltas[2 +21 ], accumulator.deltas[2 + 26]); -igt_debug ("oa_timestamp32 0 = %u\n" , report0_32[1 ]); -igt_debug ("oa_timestamp32 1 = %u\n" , report1_32[1 ]); +igt_debug ("oa_timestamp32 0 = %" PRIu64"\n" ,oa_timestamp (report0_32, fmt)); +igt_debug ("oa_timestamp32 1 = %" PRIu64"\n" ,oa_timestamp (report1_32, fmt));igt_debug ("ctx_id 0 = %u\n" , report0_32[2 ]);igt_debug ("ctx_id 1 = %u\n" , report1_32[2 ]);@@ -4260,23 +4286,22 @@ static void gen12_single_ctx_helper(void)igt_debug ("ts_timestamp64 1 = %" PRIu64"\n" , timestamp1_64); delta_ts64 = timestamp1_64 - timestamp0_64; - delta_oa32 = report1_32[1 ] - report0_32[1 ]; + delta_oa32 =oa_timestamp_delta (report1_32, report0_32, fmt);/* Sanity check that we can pass the delta to timebase_scale */ -igt_assert (delta_ts64 <UINT32_MAX ); delta_oa32_ns =timebase_scale (delta_oa32); delta_ts64_ns =cs_timebase_scale (delta_ts64); -igt_debug ("oa32 delta = %u, = %uns\n" , - delta_oa32, (unsigned )delta_oa32_ns); -igt_debug ("ts64 delta = %u, = %uns\n" , - delta_ts64, (unsigned )delta_ts64_ns); +igt_debug ("oa32 delta = %" PRIu64", = %" PRIu64"ns\n" , + delta_oa32, delta_oa32_ns); +igt_debug ("ts64 delta = %" PRIu64", = %" PRIu64"ns\n" , + delta_ts64, delta_ts64_ns); delta_delta = delta_ts64_ns > delta_oa32_ns ? (delta_ts64_ns - delta_oa32_ns) : (delta_oa32_ns - delta_ts64_ns);if (delta_delta >5000 ) { -igt_debug ("delta_delta = %d. exceeds margin, skipping..\n" , +igt_debug ("delta_delta = %" PRIu64". exceeds margin, skipping..\n" , delta_delta);exit (EAGAIN ); }
PATCH 18/23 i915/perf: Fix DG2 A0 report header
In reply to Umesh Nerlige RamappaTimestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
--- tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
tests/i915/perf.c +44 -1
@@ -40,6 +40,7 @@#include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h"
@@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd)return value; } +/* +* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards. +* Steps A0 and A1 correspond to 0 and 1 revid values. +*/ +struct perf_dev_info { +bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { +INTEL_DG2_G11_IDS (&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ +static const struct perf_dev_info *cache; +static int _iter; + +if (_iter) + goto out; + +for (_iter =0 ; _iter <ARRAY_SIZE (perf_dev_match); _iter++) +if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: +return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ? __dev_info(__d)->is_dg2_g11 : false) +#define IS_DG2_A0 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 0)) +#define IS_DG2_A1 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 1)) + +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static uint64_t cs_timebase_scale (uint32_t u32_delta) {
@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) {struct oa_format fmt =get_oa_format (format); -return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +return fmt.report_hdr_64bit && !HAS_OA_FORMAT_64BIT_HDR_BUG (devid) ? + *(uint64_t *)&report[2 ] : report[1 ]; } static uint64_t
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 18/23] i915/perf: Fix DG2 A0 report header
Quoted 21 lines · Umesh Nerlige Ramappa
Timestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)tests/i915/perf.c +1
-0@@ -40,6 +40,7 @@#include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h"
tests/i915/perf.c cs_timestamp_frequency(int fd) · line 511
Quoted 8 lines
tests/i915/perf.c +5
-0@@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd)return value; } +/* +* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards. +* Steps A0 and A1 correspond to 0 and 1 revid values.
Do you have the Wa number for reference?
Quoted 49 lines
tests/i915/perf.c +38
-1+*/ +struct perf_dev_info { +bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { +INTEL_DG2_G11_IDS (&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ +static const struct perf_dev_info *cache; +static int _iter; + +if (_iter) + goto out; + +for (_iter =0 ; _iter <ARRAY_SIZE (perf_dev_match); _iter++) +if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: +return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ? __dev_info(__d)->is_dg2_g11 : false) +#define IS_DG2_A0 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 0)) +#define IS_DG2_A1 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 1)) + +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static uint64_t cs_timebase_scale (uint32_t u32_delta) {@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) {struct oa_format fmt =get_oa_format (format); -return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +return fmt.report_hdr_64bit && !HAS_OA_FORMAT_64BIT_HDR_BUG (devid) ? + *(uint64_t *)&report[2 ] : report[1 ]; } static uint64_t
Re: [igt-dev] [PATCH i-g-t 18/23] i915/perf: Fix DG2 A0 report header
Quoted 23 lines · Lionel Landwerlin
Quoted 22 lines · Umesh Nerlige Ramappa
Timestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)tests/i915/perf.c +1
-0@@ -40,6 +40,7 @@#include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h" @@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd)return value; }
Quoted 8 lines
tests/i915/perf.c cs_timestamp_frequency(int fd) · line 511
Quoted 5 lines
tests/i915/perf.c +5
-0+/* +* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards. +* Steps A0 and A1 correspond to 0 and 1 revid values. Do you have the Wa number for reference?
Should be - 1608133521, the corresponding kernel patch is
https://patchwork.freedesktop.org/patch/498940/?series=107584&rev=2
Thanks,
Umesh
Quoted 51 lines
Quoted 49 lines
tests/i915/perf.c +38
-1+*/ +struct perf_dev_info { +bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { +INTEL_DG2_G11_IDS (&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ +static const struct perf_dev_info *cache; +static int _iter; + +if (_iter) + goto out; + +for (_iter =0 ; _iter <ARRAY_SIZE (perf_dev_match); _iter++) +if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: +return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ? __dev_info(__d)->is_dg2_g11 : false) +#define IS_DG2_A0 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 0)) +#define IS_DG2_A1 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 1)) + +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static uint64_t cs_timebase_scale (uint32_t u32_delta) {@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) {struct oa_format fmt =get_oa_format (format); -return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +return fmt.report_hdr_64bit && !HAS_OA_FORMAT_64BIT_HDR_BUG (devid) ? + *(uint64_t *)&report[2 ] : report[1 ]; } static uint64_t
Lionel Landwerlin
Reviewed-byRe: [igt-dev] [PATCH i-g-t 18/23] i915/perf: Fix DG2 A0 report header
Quoted 34 lines · Umesh Nerlige Ramappa
Quoted 24 lines · Lionel Landwerlin
Quoted 23 lines · Umesh Nerlige Ramappa
Timestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
Signed-off-by Umesh Nerlige Ramappa <[email protected]>---
tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-1 file changed, 44 insertions(+), 1 deletion(-)tests/i915/perf.c +2
-0@@ -40,6 +40,7 @@ #include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h"@@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd) return value; } +/* Quoted 8 lines
Quoted 5 lines
tests/i915/perf.c +3
-0+* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards.
+ * Steps A0 and A1 correspond to 0 and 1 revid values.Do you have the Wa number for reference?
Quoted 5 lines
Should be - 1608133521, the corresponding kernel patch is
https://patchwork.freedesktop.org/patch/498940/?series=107584&rev=2Thanks,
Umesh
If you can put it in the comment :
Thanks!
Quoted 56 lines
Quoted 56 lines
Quoted 54 lines
+ */
tests/i915/perf.c +29
-0+struct perf_dev_info { + bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { + INTEL_DG2_G11_IDS(&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ + static const struct perf_dev_info *cache; + static int _iter; + + if (_iter) + goto out; + + for (_iter = 0; _iter < ARRAY_SIZE(perf_dev_match); _iter++) + if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: + return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ?__dev_info(__d)->is_dg2_g11 : false)
+#defineIS_DG2_A0(__d)(IS_DG2(__d)&&
(intel_perf->devinfo.revision== 0))
+#defineIS_DG2_A1(__d)(IS_DG2(__d)&&
(intel_perf->devinfo.revision== 1))tests/i915/perf.c +4
-0+ +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static
uint64_t
cs_timebase_scale(uint32_tu32_delta)
{tests/i915/perf.c +1
-1@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) { struct oa_format fmt = get_oa_format(format); - return fmt.report_hdr_64bit ? *(uint64_t *)&report[2] : report[1]; + return fmt.report_hdr_64bit &&!HAS_OA_FORMAT_64BIT_HDR_BUG(devid) ?
+ *(uint64_t *)&report[2] : report[1];
}
staticuint64_t
PATCH 18/23 i915/perf: Fix DG2 A0 report header
In reply to Umesh Nerlige RamappaTimestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
--- tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
tests/i915/perf.c +44 -1
@@ -40,6 +40,7 @@#include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h"
@@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd)return value; } +/* +* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards. +* Steps A0 and A1 correspond to 0 and 1 revid values. +*/ +struct perf_dev_info { +bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { +INTEL_DG2_G11_IDS (&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ +static const struct perf_dev_info *cache; +static int _iter; + +if (_iter) + goto out; + +for (_iter =0 ; _iter <ARRAY_SIZE (perf_dev_match); _iter++) +if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: +return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ? __dev_info(__d)->is_dg2_g11 : false) +#define IS_DG2_A0 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 0)) +#define IS_DG2_A1 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 1)) + +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static uint64_t cs_timebase_scale (uint32_t u32_delta) {
@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) {struct oa_format fmt =get_oa_format (format); -return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +return fmt.report_hdr_64bit && !HAS_OA_FORMAT_64BIT_HDR_BUG (devid) ? + *(uint64_t *)&report[2 ] : report[1 ]; } static uint64_t
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 18/23] i915/perf: Fix DG2 A0 report header
Quoted 4 lines · Umesh Nerlige Ramappa
Timestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Are A0 chipsets available outside of Intel?
Maybe it's not worth bothering with this workaround?
Either way :
Quoted 74 lines
--- tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)tests/i915/perf.c +44
-1@@ -40,6 +40,7 @@#include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h" @@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd)return value; } +/* +* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards. +* Steps A0 and A1 correspond to 0 and 1 revid values. +*/ +struct perf_dev_info { +bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { +INTEL_DG2_G11_IDS (&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ +static const struct perf_dev_info *cache; +static int _iter; + +if (_iter) + goto out; + +for (_iter =0 ; _iter <ARRAY_SIZE (perf_dev_match); _iter++) +if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: +return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ? __dev_info(__d)->is_dg2_g11 : false) +#define IS_DG2_A0 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 0)) +#define IS_DG2_A1 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 1)) + +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static uint64_t cs_timebase_scale (uint32_t u32_delta) {@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) {struct oa_format fmt =get_oa_format (format); -return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +return fmt.report_hdr_64bit && !HAS_OA_FORMAT_64BIT_HDR_BUG (devid) ? + *(uint64_t *)&report[2 ] : report[1 ]; } static uint64_t
Re: [igt-dev] [PATCH i-g-t 18/23] i915/perf: Fix DG2 A0 report header
Quoted 8 lines · Lionel Landwerlin
Quoted 4 lines · Umesh Nerlige Ramappa
Timestamp is still 32 bits in DG2 A0. Fix that. Specify variants of DG2 that have the OA format header bug
Signed-off-by Umesh Nerlige Ramappa <[email protected]>Are A0 chipsets available outside of Intel?
No. I plan to remove A0 specific WAs in the follow up revisions.
Thanks,
Umesh
Quoted 82 lines
Maybe it's not worth bothering with this workaround?
Either way :
Reviewed-by Lionel Landwerlin <[email protected]>Quoted 70 lines
--- tests/i915/perf.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)tests/i915/perf.c +44
-1@@ -40,6 +40,7 @@#include "i915/gem.h" #include "i915/perf.h" +#include "i915_pciids.h" #include "igt.h" #include "igt_perf.h" #include "igt_sysfs.h" @@ -503,6 +504,47 @@ cs_timestamp_frequency(int fd)return value; } +/* +* Hacky ways until IGT is fully aware of steppings: +* +* WA is permanent for G11. For other DG2s, bug is fixed from B0 onwards. +* Steps A0 and A1 correspond to 0 and 1 revid values. +*/ +struct perf_dev_info { +bool is_dg2_g11; +}; + +static const struct perf_dev_info dg2_g11_info = { + .is_dg2_g11 = true, +}; + +static const struct pci_id_match perf_dev_match[] = { +INTEL_DG2_G11_IDS (&dg2_g11_info), +}; + +static const struct perf_dev_info *__dev_info (uint32_t device_id) +{ +static const struct perf_dev_info *cache; +static int _iter; + +if (_iter) + goto out; + +for (_iter =0 ; _iter <ARRAY_SIZE (perf_dev_match); _iter++) +if (device_id == perf_dev_match[_iter].device_id) + cache = (void *) perf_dev_match[_iter].match_data; + +out: +return cache; +} + +#define IS_DG2_G11 (__d) (__dev_info(__d) ? __dev_info(__d)->is_dg2_g11 : false) +#define IS_DG2_A0 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 0)) +#define IS_DG2_A1 (__d) (IS_DG2(__d) && (intel_perf->devinfo.revision == 1)) + +#define HAS_OA_FORMAT_64BIT_HDR_BUG (__d) \ + (IS_DG2_G11(__d) || IS_DG2_A0(__d) || IS_DG2_A1(__d)) +static uint64_t cs_timebase_scale (uint32_t u32_delta) {@@ -514,7 +556,8 @@ oa_timestamp(const uint32_t *report, enum drm_i915_oa_format format) {struct oa_format fmt =get_oa_format (format); -return fmt.report_hdr_64bit ? *(uint64_t *)&report[2 ] : report[1 ]; +return fmt.report_hdr_64bit && !HAS_OA_FORMAT_64BIT_HDR_BUG (devid) ? + *(uint64_t *)&report[2 ] : report[1 ]; } static uint64_t
PATCH 19/23 i915/perf: Wait longer for rc6 residency in DG2
In reply to Umesh Nerlige Ramappaigt@perf@rc6-disable waits for 50ms to check if we entered rc6. One some failures this seems to take longer to enter rc6, about 100ms. Tweak the test for DG2 to use a longer wait time.
--- tests/i915/perf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tests/i915/perf.c +6 -3
@@ -4441,7 +4441,10 @@ test_rc6_disable(void) .properties_ptr = to_user_pointer(properties), };unsigned long rc6_start, rc6_end, rc6_enabled; +uint32_t rc6_duration; +/* On DG2, we wait longer to enter rc6 */ + rc6_duration =IS_DG2 (devid) ?100000 :50000 ; rc6_enabled =0 ;igt_sysfs_rps_scanf (sysfs,RC6_ENABLE ,"%lu" , &rc6_enabled);igt_require (rc6_enabled);
@@ -4449,7 +4452,7 @@ test_rc6_disable(void)/* Verify rc6 is functional by measuring residency while idle */ gem_quiescent_gpu (drm_fd); rc6_start =rc6_residency_ms (); -usleep (50000 ); +usleep (rc6_duration); rc6_end =rc6_residency_ms ();igt_require (rc6_end != rc6_start);
@@ -4457,7 +4460,7 @@ test_rc6_disable(void) stream_fd =__perf_open (drm_fd, ¶m, false); rc6_start =rc6_residency_ms (); -usleep (50000 ); +usleep (rc6_duration); rc6_end =rc6_residency_ms ();igt_assert_eq (rc6_end - rc6_start,0 );
@@ -4466,7 +4469,7 @@ test_rc6_disable(void)/* But once OA is closed, we expect the device to sleep again */ rc6_start =rc6_residency_ms (); -usleep (50000 ); +usleep (rc6_duration); rc6_end =rc6_residency_ms ();igt_assert_neq (rc6_end - rc6_start,0 ); }
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 19/23] i915/perf: Wait longer for rc6 residency in DG2
Quoted 5 lines · Umesh Nerlige Ramappa
igt@perf@rc6-disable waits for 50ms to check if we entered rc6. One some failures this seems to take longer to enter rc6, about 100ms. Tweak the test for DG2 to use a longer wait time.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 46 lines
--- tests/i915/perf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)tests/i915/perf.c +6
-3@@ -4441,7 +4441,10 @@ test_rc6_disable(void) .properties_ptr = to_user_pointer(properties), };unsigned long rc6_start, rc6_end, rc6_enabled; +uint32_t rc6_duration; +/* On DG2, we wait longer to enter rc6 */ + rc6_duration =IS_DG2 (devid) ?100000 :50000 ; rc6_enabled =0 ;igt_sysfs_rps_scanf (sysfs,RC6_ENABLE ,"%lu" , &rc6_enabled);igt_require (rc6_enabled);@@ -4449,7 +4452,7 @@ test_rc6_disable(void)/* Verify rc6 is functional by measuring residency while idle */ gem_quiescent_gpu (drm_fd); rc6_start =rc6_residency_ms (); -usleep (50000 ); +usleep (rc6_duration); rc6_end =rc6_residency_ms ();igt_require (rc6_end != rc6_start);@@ -4457,7 +4460,7 @@ test_rc6_disable(void) stream_fd =__perf_open (drm_fd, ¶m, false); rc6_start =rc6_residency_ms (); -usleep (50000 ); +usleep (rc6_duration); rc6_end =rc6_residency_ms ();igt_assert_eq (rc6_end - rc6_start,0 );@@ -4466,7 +4469,7 @@ test_rc6_disable(void)/* But once OA is closed, we expect the device to sleep again */ rc6_start =rc6_residency_ms (); -usleep (50000 ); +usleep (rc6_duration); rc6_end =rc6_residency_ms ();igt_assert_neq (rc6_end - rc6_start,0 ); }
PATCH 20/23 lib/i915/perf: implement report accumulation for new format
In reply to Umesh Nerlige RamappaFrom: Lionel Landwerlin <[email protected]>
Available on XEHPSDV+.
--- lib/i915/perf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
lib/i915/perf.c +33 -0
@@ -676,6 +676,39 @@ void intel_perf_accumulate_reports(struct intel_perf_accumulator *acc,memset (acc,0 ,sizeof (*acc));switch (oa_format) { +case I915_OA_FORMAT_A24u40_A14u32_B8_C8: +accumulate_uint32 (start +1 , end +1 , deltas + idx++);/* timestamp */ +accumulate_uint32 (start +3 , end +3 , deltas + idx++);/* clock */ + +/* 4x 32bit A0-3 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint32 (start +4 + i, end +4 + i, deltas + idx++); + +/* 20x 40bit A4-23 counters... */ +for (i =0 ; i <20 ; i++) +accumulate_uint40 (i +4 , start, end, deltas + idx++); + +/* 4x 32bit A24-27 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint32 (start +28 + i, end +28 + i, deltas + idx++); + +/* 4x 40bit A28-31 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint40 (i +28 , start, end, deltas + idx++); + +/* 5x 32bit A32-36 counters... */ +for (i =0 ; i <5 ; i++) +accumulate_uint32 (start +36 + i, end +36 + i, deltas + idx++); + +/* 1x 32bit A37 counter... */ +accumulate_uint32 (start +46 , end +46 , deltas + idx++); + +/* 8x 32bit B counters + 8x 32bit C counters... */ +for (i =0 ; i <16 ; i++) +accumulate_uint32 (start +48 + i, end +48 + i, deltas + idx++); +break ; + +case I915_OAR_FORMAT_A32u40_A4u32_B8_C8:case I915_OA_FORMAT_A32u40_A4u32_B8_C8:accumulate_uint32 (start +1 , end +1 , deltas + idx++);/* timestamp */ accumulate_uint32 (start +3 , end +3 , deltas + idx++);/* clock */
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 20/23] lib/i915/perf: implement report accumulation for new format
Quoted 5 lines · Umesh Nerlige Ramappa
From: Lionel Landwerlin <[email protected]>
Available on XEHPSDV+.
Signed-off-by Lionel Landwerlin <[email protected]>
Quoted 48 lines
--- lib/i915/perf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)lib/i915/perf.c +33
-0@@ -676,6 +676,39 @@ void intel_perf_accumulate_reports(struct intel_perf_accumulator *acc,memset (acc,0 ,sizeof (*acc));switch (oa_format) { +case I915_OA_FORMAT_A24u40_A14u32_B8_C8: +accumulate_uint32 (start +1 , end +1 , deltas + idx++);/* timestamp */ +accumulate_uint32 (start +3 , end +3 , deltas + idx++);/* clock */ + +/* 4x 32bit A0-3 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint32 (start +4 + i, end +4 + i, deltas + idx++); + +/* 20x 40bit A4-23 counters... */ +for (i =0 ; i <20 ; i++) +accumulate_uint40 (i +4 , start, end, deltas + idx++); + +/* 4x 32bit A24-27 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint32 (start +28 + i, end +28 + i, deltas + idx++); + +/* 4x 40bit A28-31 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint40 (i +28 , start, end, deltas + idx++); + +/* 5x 32bit A32-36 counters... */ +for (i =0 ; i <5 ; i++) +accumulate_uint32 (start +36 + i, end +36 + i, deltas + idx++); + +/* 1x 32bit A37 counter... */ +accumulate_uint32 (start +46 , end +46 , deltas + idx++); + +/* 8x 32bit B counters + 8x 32bit C counters... */ +for (i =0 ; i <16 ; i++) +accumulate_uint32 (start +48 + i, end +48 + i, deltas + idx++); +break ; + +case I915_OAR_FORMAT_A32u40_A4u32_B8_C8:case I915_OA_FORMAT_A32u40_A4u32_B8_C8:accumulate_uint32 (start +1 , end +1 , deltas + idx++);/* timestamp */ accumulate_uint32 (start +3 , end +3 , deltas + idx++);/* clock */
Re: [igt-dev] [PATCH i-g-t 20/23] lib/i915/perf: implement report accumulation for new format
In reply to Umesh Nerlige RamappaQuoted 5 lines · Umesh Nerlige Ramappa
From: Lionel Landwerlin <[email protected]>
Available on XEHPSDV+.
Signed-off-by Lionel Landwerlin <[email protected]>
Thanks,
Umesh
Quoted 51 lines
---
lib/i915/perf.c| 33 +++++++++++++++++++++++++++++++++1 file changed, 33 insertions(+)lib/i915/perf.c +33
-0@@ -676,6 +676,39 @@ void intel_perf_accumulate_reports(struct intel_perf_accumulator *acc,memset (acc,0 ,sizeof (*acc));switch (oa_format) { +case I915_OA_FORMAT_A24u40_A14u32_B8_C8: +accumulate_uint32 (start +1 , end +1 , deltas + idx++);/* timestamp */ +accumulate_uint32 (start +3 , end +3 , deltas + idx++);/* clock */ + +/* 4x 32bit A0-3 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint32 (start +4 + i, end +4 + i, deltas + idx++); + +/* 20x 40bit A4-23 counters... */ +for (i =0 ; i <20 ; i++) +accumulate_uint40 (i +4 , start, end, deltas + idx++); + +/* 4x 32bit A24-27 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint32 (start +28 + i, end +28 + i, deltas + idx++); + +/* 4x 40bit A28-31 counters... */ +for (i =0 ; i <4 ; i++) +accumulate_uint40 (i +28 , start, end, deltas + idx++); + +/* 5x 32bit A32-36 counters... */ +for (i =0 ; i <5 ; i++) +accumulate_uint32 (start +36 + i, end +36 + i, deltas + idx++); + +/* 1x 32bit A37 counter... */ +accumulate_uint32 (start +46 , end +46 , deltas + idx++); + +/* 8x 32bit B counters + 8x 32bit C counters... */ +for (i =0 ; i <16 ; i++) +accumulate_uint32 (start +48 + i, end +48 + i, deltas + idx++); +break ; + +case I915_OAR_FORMAT_A32u40_A4u32_B8_C8:case I915_OA_FORMAT_A32u40_A4u32_B8_C8:accumulate_uint32 (start +1 , end +1 , deltas + idx++);/* timestamp */ accumulate_uint32 (start +3 , end +3 , deltas + idx++);/* clock */ Signature · 1 line
2.25.1
PATCH 21/23 lib/i915/perf: fixup conversion script for XEHPSDV
In reply to Umesh Nerlige RamappaFrom: Lionel Landwerlin <[email protected]>
--- lib/i915/perf-configs/mdapi-xml-convert.py | 56 ++++++++++++++++++---- 1 file changed, 48 insertions(+), 8 deletions(-)
lib/i915/perf-configs/mdapi-xml-convert.py +48 -8
@@ -62,6 +62,24 @@ gen8_11_chipset_params = { 'config_reg_blacklist': { 0x2364, # OACTXID }, + 'register_offsets': { + 0x1f0: 'PERFCNT 0', + 0x1f8: 'PERFCNT 1', + } +} + +xehpsdv_chipset_params = { + 'a_offset': 16, + 'b_offset': 192, + 'c_offset': 224, + 'oa_report_size': 256, + 'config_reg_blacklist': { + 0x2364, # OACTXID + }, + 'register_offsets': { + 0x1b0: 'PERFCNT 0', + 0x1b8: 'PERFCNT 1', + } } chipsets = {
@@ -161,14 +179,9 @@ def underscore(name): def print_err(*args): sys.stderr.write(' '.join(map(str,args)) + '\n') -read_register_offsets = { - 0x1f0: 'PERFCNT 0', - 0x1f8: 'PERFCNT 1', -} - def read_value(chipset, offset): - if offset in read_register_offsets: - return read_register_offsets[offset] + if offset in chipsets[chipset]['register_offsets']: + return chipsets[chipset]['register_offsets'][offset] print_err("Unknown offset register at offset {0}".format(offset)) assert 0
@@ -185,6 +198,7 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): offset = int(offset_str, 16) if raw_offsets: + # Location in the HW reports a_offset = chipsets[chipset]['a_offset'] b_offset = chipsets[chipset]['b_offset'] c_offset = chipsets[chipset]['c_offset']
@@ -199,7 +213,15 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): else: assert 0 elif offset < b_offset: - return "A " + str(int((offset - a_offset) / 4)) + " READ" + a_cnt_offset = int((offset - a_offset) / 4) + if chipset == "XEHPSDV": + # Most A counters are in a contiguous array, except + # this A37. + if a_cnt_offset == 42: + return "A 37 READ" + return "A " + str(a_cnt_offset) + " READ" + else: + return "A " + str(a_cnt_offset) + " READ" elif offset < c_offset: return "B " + str(int((offset - b_offset) / 4)) + " READ" elif offset < report_size:
@@ -207,6 +229,7 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): else: return "{0} READ".format(read_value(chipset, offset)) else: + # Location in the accumulated deltas idx = int(offset / 8) if chipset == "HSW": # On Haswell accumulated counters are assumed to start
@@ -222,6 +245,23 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): return "C " + str(idx - 54) + " READ" else: return "{0} READ".format(read_value(chipset, offset)) + elif chipset == "XEHPSDV": + # For XEHPSDV the array of accumulated counters is + # assumed to start with a GPU_TIME then GPU_CLOCK, + # then 38 A counters, then 8 B counters and finally + # 8 C counters. + if idx == 0: + return "GPU_TIME 0 READ" + elif idx == 1: + return "GPU_CLOCK 0 READ" + elif idx < 40: + return "A " + str(idx - 2) + " READ" + elif idx < 48: + return "B " + str(idx - 40) + " READ" + elif idx < 56: + return "C " + str(idx - 48) + " READ" + else: + return "{0} READ".format(read_value(chipset, offset)) else: # For Gen8+ the array of accumulated counters is # assumed to start with a GPU_TIME then GPU_CLOCK,
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 21/23] lib/i915/perf: fixup conversion script for XEHPSDV
Quoted 3 lines · Umesh Nerlige Ramappa
From: Lionel Landwerlin <[email protected]>
Signed-off-by Lionel Landwerlin <[email protected]>
Umesh
Quoted 110 lines
---
lib/i915/perf-configs/mdapi-xml-convert.py| 56 ++++++++++++++++++----1 file changed, 48 insertions(+), 8 deletions(-)lib/i915/perf-configs/mdapi-xml-convert.py +18
-0@@ -62,6 +62,24 @@ gen8_11_chipset_params = { 'config_reg_blacklist': { 0x2364, # OACTXID }, + 'register_offsets': { + 0x1f0: 'PERFCNT 0', + 0x1f8: 'PERFCNT 1', + } +} + +xehpsdv_chipset_params = { + 'a_offset': 16, + 'b_offset': 192, + 'c_offset': 224, + 'oa_report_size': 256, + 'config_reg_blacklist': { + 0x2364, # OACTXID + }, + 'register_offsets': { + 0x1b0: 'PERFCNT 0', + 0x1b8: 'PERFCNT 1', + } } chipsets = {@@ -161,14 +179,9 @@ def underscore(name):def
print_err(*args):sys.stderr.write(' '.join(map(str,args)) + '\n')lib/i915/perf-configs/mdapi-xml-convert.py +0
-5-read_register_offsets = { - 0x1f0: 'PERFCNT 0', - 0x1f8: 'PERFCNT 1', -} -def
read_value(chipset, offset):lib/i915/perf-configs/mdapi-xml-convert.py +30
-3- if offset in read_register_offsets: - return read_register_offsets[offset] + if offset in chipsets[chipset]['register_offsets']: + return chipsets[chipset]['register_offsets'][offset] print_err("Unknown offset register at offset {0}".format(offset)) assert 0@@ -185,6 +198,7 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): offset = int(offset_str, 16) if raw_offsets: + # Location in the HW reports a_offset = chipsets[chipset]['a_offset'] b_offset = chipsets[chipset]['b_offset'] c_offset = chipsets[chipset]['c_offset']@@ -199,7 +213,15 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): else: assert 0 elif offset < b_offset: - return "A " + str(int((offset - a_offset) / 4)) + " READ" + a_cnt_offset = int((offset - a_offset) / 4) + if chipset == "XEHPSDV": + # Most A counters are in a contiguous array, except + # this A37. + if a_cnt_offset == 42: + return "A 37 READ" + return "A " + str(a_cnt_offset) + " READ" + else: + return "A " + str(a_cnt_offset) + " READ" elif offset < c_offset: return "B " + str(int((offset - b_offset) / 4)) + " READ" elif offset < report_size:@@ -207,6 +229,7 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): else: return "{0} READ".format(read_value(chipset, offset)) else: + # Location in the accumulated deltas idx = int(offset / 8) if chipset == "HSW": # On Haswell accumulated counters are assumed to start@@ -222,6 +245,23 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): return "C " + str(idx - 54) + " READ" else: return "{0} READ".format(read_value(chipset, offset)) + elif chipset == "XEHPSDV": + # For XEHPSDV the array of accumulated counters is + # assumed to start with a GPU_TIME then GPU_CLOCK, + # then 38 A counters, then 8 B counters and finally + # 8 C counters. + if idx == 0: + return "GPU_TIME 0 READ" + elif idx == 1: + return "GPU_CLOCK 0 READ" + elif idx < 40: + return "A " + str(idx - 2) + " READ" + elif idx < 48: + return "B " + str(idx - 40) + " READ" + elif idx < 56: + return "C " + str(idx - 48) + " READ" + else: + return "{0} READ".format(read_value(chipset, offset)) else: # For Gen8+ the array of accumulated counters is # assumed to start with a GPU_TIME then GPU_CLOCK,Signature · 1 line
2.25.1
PATCH 22/23 lib/i915/perf: make warning message more helpful
In reply to Umesh Nerlige RamappaFrom: Lionel Landwerlin <[email protected]>
This helped debugging some XEHPSDV stuff but is also more readable.
--- lib/i915/perf-configs/mdapi-xml-convert.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
lib/i915/perf-configs/mdapi-xml-convert.py +9 -4
@@ -884,10 +884,15 @@ for arg in args.xml: # delta equations are expected to be identical so warn if that's # not true... if bool(raw_read_eq) ^ bool(delta_read_eq) or raw_read_eq != delta_read_eq: - print_err("WARNING: Inconsistent raw and delta report equations for " + \ - mdapi_set.get('ShortName') + " :: " + mdapi_counter.get('SymbolName') + \ - "(" + mdapi_counter.get('ShortName') + ")" + ": raw=\"" + str(raw_read_eq) + \ - "\" delta=\"" + str(delta_read_eq) + "\" (SKIPPING)") + print_err(("WARNING: Inconsistent raw and delta report equations for {0} :: {1} ({2}): " + + "raw=\"{3}\" / \"{4}\" delta=\"{5}\" / \"{6}\" (SKIPPING)") + .format(mdapi_set.get('ShortName'), + mdapi_counter.get('SymbolName'), + mdapi_counter.get('ShortName'), + str(raw_read_eq), + mdapi_counter.get('SnapshotReportReadEquation'), + str(delta_read_eq), + mdapi_counter.get('DeltaReportReadEquation'))) set.remove(counter) continue
Signature · 1 line
2.25.1
Re: [igt-dev] [PATCH i-g-t 22/23] lib/i915/perf: make warning message more helpful
Quoted 5 lines · Umesh Nerlige Ramappa
From: Lionel Landwerlin <[email protected]>
This helped debugging some XEHPSDV stuff but is also more readable.
Signed-off-by Lionel Landwerlin <[email protected]>
Umesh
Quoted 31 lines
---
lib/i915/perf-configs/mdapi-xml-convert.py| 13 +++++++++----1 file changed, 9 insertions(+), 4 deletions(-)lib/i915/perf-configs/mdapi-xml-convert.py +9
-4@@ -884,10 +884,15 @@ for arg in args.xml: # delta equations are expected to be identical so warn if that's # not true... if bool(raw_read_eq) ^ bool(delta_read_eq) or raw_read_eq != delta_read_eq: - print_err("WARNING: Inconsistent raw and delta report equations for " + \ - mdapi_set.get('ShortName') + " :: " + mdapi_counter.get('SymbolName') + \ - "(" + mdapi_counter.get('ShortName') + ")" + ": raw=\"" + str(raw_read_eq) + \ - "\" delta=\"" + str(delta_read_eq) + "\" (SKIPPING)") + print_err(("WARNING: Inconsistent raw and delta report equations for {0} :: {1} ({2}): " + + "raw=\"{3}\" / \"{4}\" delta=\"{5}\" / \"{6}\" (SKIPPING)") + .format(mdapi_set.get('ShortName'), + mdapi_counter.get('SymbolName'), + mdapi_counter.get('ShortName'), + str(raw_read_eq), + mdapi_counter.get('SnapshotReportReadEquation'), + str(delta_read_eq), + mdapi_counter.get('DeltaReportReadEquation'))) set.remove(counter) continueSignature · 1 line
2.25.1
PATCH 23/23 lib/i915/perf: Add DG2 metrics
In reply to Umesh Nerlige RamappaFrom: Lionel Landwerlin <[email protected]>
Add DG2 metrics XML files for perf OA tests.
--- lib/i915/perf-configs/guids.xml | 24 + lib/i915/perf-configs/mdapi-xml-convert.py | 5 +- lib/i915/perf-configs/oa-dg2.xml | 9920 +++++++++++++++++ .../perf-configs/perf-metricset-codegen.py | 13 + lib/i915/perf-configs/update-guids.py | 2 +- lib/i915/perf.c | 3 + lib/meson.build | 2 +- 7 files changed, 9965 insertions(+), 4 deletions(-) create mode 100644 lib/i915/perf-configs/oa-dg2.xml
lib/i915/perf-configs/guids.xml +24 -0
@@ -431,4 +431,28 @@ <guid config_hash="b420d7b956fb1b097a7bb812b6c87dc0" mdapi_config_hash="d81f15a77d18a099782c18acaa3132f7" id="c3ea2a23-f1c7-4a19-9da2-b569226fb6de" chipset="adl" name="EuActivity7" /> <guid config_hash="5face026dac6a0549f8a28cf226dfbc8" mdapi_config_hash="de7326838bcc8abf024bac9c771e22e4" id="a5e2f79b-cecb-4eff-8f29-cda8e2a58749" chipset="adl" name="EuActivity8" /> <guid config_hash="1affe7abeb3739d2c845cc6fa9aacf88" mdapi_config_hash="d071f4933574945979595246be61d3f0" id="89173c19-fcfe-48da-ac26-fb64425f141b" chipset="adl" name="TestOa" /> + <guid config_hash="9091b7d8f1627a3dda5d6d996eadd033" mdapi_config_hash="4a3cf9efdf4fd581b69308368b986500" id="8b20a2e7-04db-4196-a5ca-26b53cbf9a12" chipset="dg2" name="RenderBasic" /> + <guid config_hash="a0afa17cc8f442e6eabb3b1782cbca44" mdapi_config_hash="2a23a2f9f1bcf91a9b038b2cc6c9c911" id="f66d7204-54f5-4663-9d68-5213f70165ba" chipset="dg2" name="ComputeBasic" /> + <guid config_hash="34875baa1a12dda6dcf6d40e33a8d5ef" mdapi_config_hash="31dfc8c6ef9a79789bbe0b991c94112f" id="3b06d2f4-f594-49b5-b399-98550fa2d7b1" chipset="dg2" name="RenderPipeProfile" /> + <guid config_hash="5f0f4b7c1e4cae4d04ab60a66f1d98a8" mdapi_config_hash="58ec2ac3713bd8e21112f8fddbe28c48" id="1afb0edc-585c-4be9-8c0c-bc72325106b0" chipset="dg2" name="HDCAndSF1" /> + <guid config_hash="69dbeb5aba00131465b68f20c910421b" mdapi_config_hash="cf8e3757a118ffffb76db95917cae040" id="a3b35902-f293-41fe-97d0-3d895bc5fab3" chipset="dg2" name="HDCAndSF2" /> + <guid config_hash="e563f102f8b3046e8deaea0eb81b8784" mdapi_config_hash="81d17bd3ab0a18f4491c2d0a11037c7a" id="b04e9460-630f-4682-b0ed-ebb0e74a6c9d" chipset="dg2" name="RasterizerAndPixelBackend1" /> + <guid config_hash="b574d106f1f71eae1e8a0908cad2c010" mdapi_config_hash="d9c0a07f470d2a9bf7bbf20f79488abf" id="57a0abf4-8d81-4856-ab86-01f15f92c81c" chipset="dg2" name="RasterizerAndPixelBackend2" /> + <guid config_hash="3316babac928063b799008fc324812b1" mdapi_config_hash="c9cd0a76400e340b0ffdb129fff205c7" id="2314eaa3-164f-4004-9684-3f1d16e875f9" chipset="dg2" name="Sampler_1" /> + <guid config_hash="31c5ffa0c3508fb166ace213356edbaf" mdapi_config_hash="e2bce131c17fa27ab826a05ed65cad5a" id="c60dea82-db13-4882-8d31-a02bce151ef7" chipset="dg2" name="Sampler_2" /> + <guid config_hash="b3460c2d0d4e7bcbcc46a3f1c9df7e8f" mdapi_config_hash="ee6821f6954a10562b6314c5ef394b50" id="7f5cb8ec-38bb-48c9-9ad2-60075eba2833" chipset="dg2" name="TDL_1" /> + <guid config_hash="9ff61984b39a3d19a2abf3a0fd4c2285" mdapi_config_hash="013fa392a5c8b3bb93a776146d31bc95" id="141ce507-de6c-428c-95b2-076194d650db" chipset="dg2" name="TDL_2" /> + <guid config_hash="11b056437f6c491c2a44e4ca029dd57b" mdapi_config_hash="c4a4c4cec33f45576af76022e6f634ae" id="54a85b07-9ff2-4a12-bfb6-6bcdd9d4019c" chipset="dg2" name="TDL_3" /> + <guid config_hash="5cf268036a3ae548ddd918fdbd67a64b" mdapi_config_hash="4744760a7ff39c509ecab43f3f715790" id="651c40e5-195c-49da-b232-a9a0f753d899" chipset="dg2" name="TDL_4" /> + <guid config_hash="f43033715b8153ccb51147452de5bf99" mdapi_config_hash="e77513bc5aa341b061701d6d973b1b4c" id="9a1a14ad-ab92-4204-8a91-c4159a54f712" chipset="dg2" name="L3_1" /> + <guid config_hash="1c4da3e296779bdbef2262460f3f0fcb" mdapi_config_hash="27c652b5bcd6e800c23a3cacc103c2cb" id="85de4c29-76b8-42a6-b6ef-8a2bed008fcf" chipset="dg2" name="GpuBusyness" /> + <guid config_hash="a1c8aac6e58018ff3bf78169e5d7cf00" mdapi_config_hash="3d1142aa73a474eccef2bd23027e71b9" id="8dc7142a-df10-41f2-acaa-9faea547ce73" chipset="dg2" name="EuActivity1" /> + <guid config_hash="880a408e8bc0c0a82df014cbbe0a1a9e" mdapi_config_hash="d998d2f096753140dc92ed9421414ae1" id="d3c05cce-4ae7-4291-82ab-b0bcade6cf7a" chipset="dg2" name="EuActivity2" /> + <guid config_hash="6687d4c4e45e62d0d28792b04882edae" mdapi_config_hash="c5b1271909b4d72ad1503d5d8a50d30a" id="4fd009c5-6eae-4ecb-a2d1-41edf211cd06" chipset="dg2" name="EuActivity3" /> + <guid config_hash="f770062c29026a186485a2190b7ce3fb" mdapi_config_hash="7a83985438139dcfdf7d653be1e665b0" id="5226090d-b636-4845-9f76-545cb5db7867" chipset="dg2" name="EuActivity4" /> + <guid config_hash="4e13b511b35757cc97602aae22b7d2d3" mdapi_config_hash="5405e0eff1e1b0af86f45e832c604fcd" id="c8d33b8f-3152-4c81-99bf-d3cb45d7e1ac" chipset="dg2" name="EuActivity5" /> + <guid config_hash="243a5047b39033bca9a16db6bf2aca3f" mdapi_config_hash="2bc02385284ccdbbd0d233a428861e59" id="708d01ed-bc9b-420e-8048-9060abcbb1f0" chipset="dg2" name="EuActivity6" /> + <guid config_hash="d0f2a1c661860e4aa94e25e9f4a6f8eb" mdapi_config_hash="75694dd6a99c38e9446d7bf68f2269a3" id="72262d5b-a9e6-4742-820b-2a7bef9a7e61" chipset="dg2" name="EuActivity7" /> + <guid config_hash="5e7354b4cbe7b9b03acb504ef00aa8ce" mdapi_config_hash="299c68337c46a2483c1254fdead4cdcc" id="11c685de-1445-41b8-acb5-8e79c75c4fd8" chipset="dg2" name="EuActivity8" /> + <guid config_hash="24977eb13d34b0da58c0b33f6d7f841a" mdapi_config_hash="48715fb10d2ada8c23f7108303b7c343" id="2db1e1d4-8c48-4bb7-b248-0f40b70433ff" chipset="dg2" name="TestOa" /> </guids>
lib/i915/perf-configs/mdapi-xml-convert.py +3 -2
@@ -141,6 +141,7 @@ chipsets = { 'RKL': gen8_11_chipset_params, 'DG1': gen8_11_chipset_params, 'ADL': gen8_11_chipset_params, + 'DG2': xehpsdv_chipset_params, } register_types = { 'OA', 'NOA', 'FLEX', 'PM' }
@@ -214,7 +215,7 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): assert 0 elif offset < b_offset: a_cnt_offset = int((offset - a_offset) / 4) - if chipset == "XEHPSDV": + if chipset == "XEHPSDV" or chipset == "DG2": # Most A counters are in a contiguous array, except # this A37. if a_cnt_offset == 42:
@@ -245,7 +246,7 @@ def read_token_to_rpn_read(chipset, token, raw_offsets): return "C " + str(idx - 54) + " READ" else: return "{0} READ".format(read_value(chipset, offset)) - elif chipset == "XEHPSDV": + elif chipset == "XEHPSDV" or chipset == "DG2": # For XEHPSDV the array of accumulated counters is # assumed to start with a GPU_TIME then GPU_CLOCK, # then 38 A counters, then 8 B counters and finally
lib/i915/perf-configs/oa-dg2.xml new file +9920 -0
2,949 lines not on this page · raw message
lib/i915/perf-configs/perf-metricset-codegen.py +13 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.