From: Matthew Brost <matthew.brost@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
<igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t v2 07/10] tests/intel/xe_drm_fdinfo: Add an iterator for virtual engines
Date: Fri, 12 Jul 2024 00:17:25 +0000 [thread overview]
Message-ID: <ZpB2Fb5WT2uLGZ9/@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <qjpe4ruaijnkvh4ljfo4khessxu42i5ndgwsrhnxzqgt3do2yh@e43ewitauzbx>
On Thu, Jul 11, 2024 at 05:30:14PM -0500, Lucas De Marchi wrote:
> On Thu, Jul 11, 2024 at 11:31:37AM GMT, Umesh Nerlige Ramappa wrote:
> > On Thu, Jul 11, 2024 at 08:34:03AM -0500, Lucas De Marchi wrote:
> > > On Tue, Jul 02, 2024 at 05:25:29PM GMT, Umesh Nerlige Ramappa wrote:
> > > > Add a helper iterator for virtual engines.
> > > >
> > > > Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> > > > ---
> > > > tests/intel/xe_drm_fdinfo.c | 29 +++++++++++++++++++++++++++++
> > > > 1 file changed, 29 insertions(+)
> > > >
> > > > diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
> > > > index f2051c422..9d3d1b285 100644
> > > > --- a/tests/intel/xe_drm_fdinfo.c
> > > > +++ b/tests/intel/xe_drm_fdinfo.c
> > > > @@ -90,6 +90,34 @@ static const uint64_t batch_addr[] = {
> > > > 0x1d0000,
> > > > 0x1e0000,
> > > > };
> > > > +
> > > > +#define MAX_GTS 2
> > > > +#define MAX_INSTANCE 9
> > > > +struct virtual_hwe {
> > > > + struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
> > > > + int count;
> > > > +} vhwe[MAX_GTS][DRM_XE_ENGINE_CLASS_COMPUTE + 1] = {};
> > >
> > > there's no concept of "virtual engine". I think this is something
> > > brought over from i915? Is it related to the width when submitting?
> > >
> > > Please add a comment for the confused reader and it's probably worth
> > > this abstraction to be outside this test. +Matt Brost
> >
> > width is for parallel submission and num_placements is for virtual.
>
> ok... let's also s/virtual engines/virtual exec_queues/ where
> appropriate. Like we have in xe_exec_balancer.c
>
> can we also use the helper in xe_exec_balancer?
I'm with Lucas that this looks overly complicated.
Perhaps this code from xe_exec_balancer.c can be moved to helper
somewhere?
194 xe_for_each_engine(fd, hwe) {
195 if (hwe->engine_class != class || hwe->gt_id != gt)
196 continue;
197
198 eci[num_placements++] = *hwe;
199 }
200 if (num_placements < 2)
201 return;
This code collects the hwe instances for a class / gt + calculates the
number of placements. Once you have that calling __xe_exec_queue_create
is pretty simple.
So something like this:
int
xe_exec_queue_virtaul_setup(int fd, struct drm_xe_engine_class_instance *eci,
int class, int gt)
{
struct drm_xe_engine_class_instance *hwe;
int num_placements = 0;
xe_for_each_engine(fd, hwe) {
if (hwe->engine_class != class || hwe->gt_id != gt)
continue;
eci[num_placements++] = *hwe;
}
return num_placements;
}
Then your test function is something like:
int foo_test(int fd, int class, int gt)
{
struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
int num_placement;
num_placement = xe_exec_queue_virtaul_setup(fd, eci, class, gt);
if (num_placement < 2)
return;
/* Do test */
}
Then your main IGT loop is:
igt_subtest("foo_test")
xe_for_each_gt(fd, gt)
xe_for_each_engine_class(class)
foo_test(fd, class, gt);
This is the pattern in xe_exec_balancer.c. I don't think we should
reinvent this (it is helpful if IGTs all look fairly similar so if you
unstand one, you probably understand most).
Matt
>
>
> Lucas De Marchi
>
> >
> > >
> > > > +
> > > > +static void list_virtual_engines(int fd)
> > >
> > > list? shouldn't it be virtual_engines_init()?
> >
> > Right, I will change that.
> >
> > Thanks,
> > Umesh
> >
> > >
> > > Lucas De Marchi
> > >
> > > > +{
> > > > + struct drm_xe_engine_class_instance *hwe;
> > > > +
> > > > + xe_for_each_engine(fd, hwe) {
> > > > + struct virtual_hwe *v;
> > > > +
> > > > + igt_assert(hwe->gt_id < MAX_GTS);
> > > > + igt_assert(hwe->engine_class < DRM_XE_ENGINE_CLASS_COMPUTE + 1);
> > > > + v = &vhwe[hwe->gt_id][hwe->engine_class];
> > > > +
> > > > + igt_assert(v->count < MAX_INSTANCE);
> > > > + v->eci[v->count++] = *hwe;
> > > > + }
> > > > +}
> > > > +#define xe_for_each_multi_engine(__fd, __hwe, __count) \
> > > > + for (int igt_unique(gt) = 0; igt_unique(gt) < MAX_GTS; igt_unique(gt)++) \
> > > > + for (int igt_unique(c) = 0; igt_unique(c) < DRM_XE_ENGINE_CLASS_COMPUTE + 1; igt_unique(c)++) \
> > > > + for_if((__hwe = &vhwe[igt_unique(gt)][igt_unique(c)].eci[0]) && ((__count = vhwe[igt_unique(gt)][igt_unique(c)].count) > 1))
> > > > +
> > > > static void read_engine_cycles(int xe, struct pceu_cycles *pceu)
> > > > {
> > > > struct drm_client_fdinfo info = { };
> > > > @@ -678,6 +706,7 @@ igt_main
> > > > xe = drm_open_driver(DRIVER_XE);
> > > > igt_require_xe(xe);
> > > > igt_require(igt_parse_drm_fdinfo(xe, &info, NULL, 0, NULL, 0));
> > > > + list_virtual_engines(xe);
> > > > }
> > > >
> > > > igt_describe("Check if basic fdinfo content is present for memory");
> > > > --
> > > > 2.38.1
> > > >
next prev parent reply other threads:[~2024-07-12 0:18 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 0:25 [PATCH i-g-t v2 00/10] Add per-client engine utilization tests Umesh Nerlige Ramappa
2024-07-03 0:25 ` [PATCH i-g-t v2 01/10] tests/intel/xe_drm_fdinfo: Rename basic to basic-memory test Umesh Nerlige Ramappa
2024-07-11 12:00 ` Lucas De Marchi
2024-07-11 17:39 ` Umesh Nerlige Ramappa
2024-07-11 20:36 ` Lucas De Marchi
2024-07-30 12:41 ` Kamil Konieczny
2024-07-03 0:25 ` [PATCH i-g-t v2 02/10] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test Umesh Nerlige Ramappa
2024-07-11 12:03 ` Lucas De Marchi
2024-07-31 3:40 ` Lucas De Marchi
2024-07-03 0:25 ` [PATCH i-g-t v2 03/10] tests/intel/xe_drm_fdinfo: Add helper to read utilization for all classes Umesh Nerlige Ramappa
2024-07-11 13:40 ` Lucas De Marchi
2024-07-11 19:54 ` Umesh Nerlige Ramappa
2024-07-30 0:23 ` Lucas De Marchi
2024-07-03 0:25 ` [PATCH i-g-t v2 04/10] tests/intel/xe_drm_fdinfo: Add helpers for spinning batches Umesh Nerlige Ramappa
2024-07-11 12:46 ` Lucas De Marchi
2024-07-11 18:29 ` Umesh Nerlige Ramappa
2024-07-12 0:04 ` Matthew Brost
2024-08-15 16:46 ` Lucas De Marchi
2024-07-03 0:25 ` [PATCH i-g-t v2 05/10] tests/intel/xe_drm_fdinfo: Add single engine tests Umesh Nerlige Ramappa
2024-07-11 13:20 ` Lucas De Marchi
2024-07-11 19:13 ` Umesh Nerlige Ramappa
2024-07-11 21:34 ` Lucas De Marchi
2024-07-11 22:45 ` Umesh Nerlige Ramappa
2024-07-03 0:25 ` [PATCH i-g-t v2 06/10] tests/intel/xe_drm_fdinfo: Add tests to verify all class utilization Umesh Nerlige Ramappa
2024-07-03 0:25 ` [PATCH i-g-t v2 07/10] tests/intel/xe_drm_fdinfo: Add an iterator for virtual engines Umesh Nerlige Ramappa
2024-07-11 13:34 ` Lucas De Marchi
2024-07-11 18:31 ` Umesh Nerlige Ramappa
2024-07-11 22:30 ` Lucas De Marchi
2024-07-12 0:17 ` Matthew Brost [this message]
2024-07-03 0:25 ` [PATCH i-g-t v2 08/10] tests/intel/xe_drm_fdinfo: Add tests " Umesh Nerlige Ramappa
2024-07-03 0:25 ` [PATCH i-g-t v2 09/10] tests/intel/xe_drm_fdinfo: Add tests for parallel engines Umesh Nerlige Ramappa
2024-07-03 0:25 ` [PATCH i-g-t v2 10/10] tests/intel/xe_drm_fdinfo: Ensure queue destroy records load correctly Umesh Nerlige Ramappa
2024-07-03 14:41 ` ✗ Fi.CI.BUILD: failure for Add per-client engine utilization tests (rev3) Patchwork
2024-07-04 17:14 ` ✓ CI.xeBAT: success for Add per-client engine utilization tests (rev4) Patchwork
2024-07-04 17:24 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-07-04 22:18 ` ✓ CI.xeFULL: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZpB2Fb5WT2uLGZ9/@DUT025-TGLU.fm.intel.com \
--to=matthew.brost@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=umesh.nerlige.ramappa@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox