[PATCH i-g-t v9 3/7] lib/intel_multigpu: Introduce library for multi-GPU scenarios

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Feb 19 17:37:54 UTC 2024


Hi Zbigniew,
On 2024-02-19 at 12:11:04 +0100, Zbigniew Kempczyński wrote:
> On Thu, Feb 15, 2024 at 05:10:10PM +0100, Kamil Konieczny wrote:
> > From: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
> > 
> > Implemented gem_require_multigpu in order to replace
> > igt_require(gpu_count > 1), as well as printing available
> > PCI devices if requirement fails.
> > 
> > Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski at intel.com>
> > Cc: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> > Signed-off-by: "Dominik Karol Piątkowski" <dominik.karol.piatkowski at intel.com>
> > [Kamil: fixed whitespace and tabs, moved to lib/intel_multigpu.*]
> > Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> > ---
> >  lib/intel_multigpu.c | 28 ++++++++++++++++++++++++++++
> >  lib/intel_multigpu.h | 11 +++++++++++
> >  lib/meson.build      |  1 +
> >  3 files changed, 40 insertions(+)
> >  create mode 100644 lib/intel_multigpu.c
> >  create mode 100644 lib/intel_multigpu.h
> > 
> > diff --git a/lib/intel_multigpu.c b/lib/intel_multigpu.c
> > new file mode 100644
> > index 000000000..34c9f936d
> > --- /dev/null
> > +++ b/lib/intel_multigpu.c
> > @@ -0,0 +1,28 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > + * Copyright © 2023 Intel Corporation
> > + */
> > +
> > +#include "igt_core.h"
> > +#include "igt_device_scan.h"
> > +#include "intel_multigpu.h"
> > +
> > +void gem_require_multigpu(int count)
> > +{
> > +	struct igt_devices_print_format fmt = {
> > +		.type = IGT_PRINT_SIMPLE,
> > +		.option = IGT_PRINT_PCI,
> > +	};
> > +	int devices;
> > +
> > +	if (igt_device_filter_count() >= count)
> > +		return;
> 
> If we have 2 filters and count == 2 we return?
> 

For two or more GPUs one can write:

gem_require_multigpu(2);

Regards,
Kamil

> --
> Zbigniew
> 
> > +
> > +	igt_info("PCI devices available in the system:\n");
> > +
> > +	igt_devices_scan(true);
> > +	devices = igt_device_filter_pci();
> > +	igt_devices_print(&fmt);
> > +
> > +	igt_skip("Test requires at least %d GPUs, %d available.\n", count, devices);
> > +}
> > diff --git a/lib/intel_multigpu.h b/lib/intel_multigpu.h
> > new file mode 100644
> > index 000000000..98dc5a4ce
> > --- /dev/null
> > +++ b/lib/intel_multigpu.h
> > @@ -0,0 +1,11 @@
> > +/* SPDX-License-Identifier: MIT */
> > +/*
> > + * Copyright © 2023 Intel Corporation
> > + */
> > +
> > +#ifndef __INTEL_MULTIGPU_H
> > +#define __INTEL_MULTIGPU_H
> > +
> > +void gem_require_multigpu(int count);
> > +
> > +#endif /* __INTEL_MULTIGPU_H */
> > diff --git a/lib/meson.build b/lib/meson.build
> > index 6122861d8..8251695e1 100644
> > --- a/lib/meson.build
> > +++ b/lib/meson.build
> > @@ -65,6 +65,7 @@ lib_sources = [
> >  	'intel_device_info.c',
> >  	'intel_mmio.c',
> >  	'intel_mocs.c',
> > +	'intel_multigpu.c',
> >  	'intel_pat.c',
> >  	'ioctl_wrappers.c',
> >  	'media_spin.c',
> > -- 
> > 2.42.0
> > 


More information about the igt-dev mailing list