Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility
@ 2020-01-17  7:54 Zbigniew Kempczyński
  2020-01-17  8:46 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Zbigniew Kempczyński @ 2020-01-17  7:54 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Dynamic tests gives us new method to create tests depending on the
hardware/software capabilities. To check coverage some tests require
verification over some set of objects/data. To make life easier
with combinatorics this patch introduces igt_set. Currently it supports
iterating over set to get subsets, combinations and multicombinations.
Code has some limitation (set/subset cannot be larger than 16 elements,
what is enough for most cases).

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/Makefile.sources |   2 +
 lib/igt_set.c        | 250 +++++++++++++++++++++++++++++++++++++++++++
 lib/igt_set.h        |  62 +++++++++++
 lib/meson.build      |   1 +
 4 files changed, 315 insertions(+)
 create mode 100644 lib/igt_set.c
 create mode 100644 lib/igt_set.h

diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index 5dd3962e..7852d52a 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -52,6 +52,8 @@ lib_source_list =	 	\
 	igt_rapl.c		\
 	igt_rapl.h		\
 	igt_rc.h		\
+	igt_set.c		\
+	igt_set.h		\
 	igt_stats.c		\
 	igt_stats.h		\
 	igt_sysfs.c		\
diff --git a/lib/igt_set.c b/lib/igt_set.c
new file mode 100644
index 00000000..797c51ad
--- /dev/null
+++ b/lib/igt_set.c
@@ -0,0 +1,250 @@
+#include "igt.h"
+#include "igt_set.h"
+
+/**
+ * Generic combinatorics library.
+ *
+ * Supports: subsets, combinations and multicombinations.
+ *
+ * Usage example:
+ *
+ * struct igt_set *set;
+ * struct igt_set *subset;
+ * struct igt_set_iterator *iter;
+ *
+ * int i;
+ * set = igt_set_init(4);
+ * iter = igt_set_iterator_init(set, 2, IGT_SET_SUBSETS);
+ * //iter = igt_set_iterator_init(set, 2, IGT_SET_MULTICOMBINATION);
+ * //iter = igt_set_iterator_init(set, 2, IGT_SET_COMBINATION);
+ *
+ * for (i = 0; i < set->size; i++) {
+ *      igt_set_setvalue(set, i, i * 2);
+ *      igt_set_setptr(set, i, &i + i);
+ * }
+ *
+ * while ((subset = igt_set_iterate_next(iter))) {
+ *      // --- do sth with subset ---
+ *      // --- subset is a part of iterator, so don't free it! ---
+ * }
+ *
+ * igt_set_iterator_free(iter);
+ * igt_set_free(set);
+ */
+
+/* Taken from Hacker's Delight */
+static inline int num_bits_set(uint32_t x)
+{
+	x = x - ((x >> 1) & 0x55555555);
+	x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+	x = (x + (x >> 4)) & 0x0F0F0F0F;
+	x = x + (x >> 8);
+	x = x + (x >> 16);
+	return x & 0x0000003F;
+}
+
+struct igt_set_iterator {
+	struct igt_set *set;
+	enum igt_set_iteration_algorithm algorithm;
+	bool init;
+	int result_size;
+	struct igt_set result;
+
+	/* Algorithms state, to be used by iterators */
+	struct {
+		uint32_t result_bits;
+		int current_result_size;
+		int idxs[IGT_SET_MAXSIZE];
+	} data;
+};
+
+struct igt_set *igt_set_init(int size)
+{
+	struct igt_set *set;
+	int i;
+
+	igt_assert(size > 0 && size <= IGT_SET_MAXSIZE);
+
+	set = calloc(1, sizeof(*set));
+	igt_assert(set);
+
+	set->size = size;
+	for (i = 0; i < size; i++)
+		set->set[i].value = i; /* set to index as default */
+
+	return set;
+}
+
+void igt_set_free(struct igt_set *set)
+{
+	free(set);
+}
+
+void igt_set_setvalue(struct igt_set *set, int index, int value)
+{
+	set->set[index].value = value;
+}
+
+int igt_set_getvalue(struct igt_set *set, int index)
+{
+	return set->set[index].value;
+}
+
+void igt_set_setptr(struct igt_set *set, int index, void *ptr)
+{
+	set->set[index].ptr = ptr;
+}
+
+void *igt_set_getptr(struct igt_set *set, int index)
+{
+	return set->set[index].ptr;
+}
+
+struct igt_set_iterator *igt_set_iterator_init(struct igt_set *set,
+					       int result_size,
+					       enum igt_set_iteration_algorithm algorithm)
+{
+	struct igt_set_iterator *iter;
+
+	igt_assert(result_size > 0 && result_size <= IGT_SET_MAXSIZE);
+	if (algorithm != IGT_SET_MULTICOMBINATION)
+		igt_assert(result_size <= set->size);
+
+	iter = calloc(1, sizeof(*iter));
+	igt_assert(iter);
+
+	iter->set = set;
+	iter->result_size = result_size;
+	iter->algorithm = algorithm;
+	iter->init = true;
+
+	return iter;
+}
+
+void igt_set_iterator_free(struct igt_set_iterator *iter)
+{
+	free(iter);
+}
+
+static struct igt_set *igt_set_iter_subsets(struct igt_set_iterator *iter)
+{
+	struct igt_set *set = iter->set;
+	struct igt_set *curr = &iter->result;
+	int i, pos = 0;
+
+	if (iter->init) {
+		iter->init = false;
+		iter->data.result_bits = 0;
+		iter->data.current_result_size = 0;
+		curr->size = 0;
+	} else {
+		iter->data.result_bits++;
+		if (iter->data.result_bits & (1 << iter->set->size)) {
+			iter->data.current_result_size++;
+			iter->data.result_bits = 0;
+		}
+		if (iter->data.current_result_size > iter->result_size)
+			return NULL;
+	}
+
+	while (num_bits_set(iter->data.result_bits) != iter->data.current_result_size) {
+		iter->data.result_bits++;
+		if (iter->data.result_bits & (1 << iter->set->size)) {
+			iter->data.current_result_size++;
+			iter->data.result_bits = 0;
+		}
+	}
+
+	if (iter->data.current_result_size > iter->result_size)
+		return NULL;
+
+	for (i = 0; i < set->size; i++) {
+		if (!(iter->data.result_bits & (1 << i)))
+			continue;
+		curr->set[pos++] = set->set[i];
+		curr->size = pos;
+	}
+
+	return curr;
+}
+
+static struct igt_set *igt_set_iter_combination(struct igt_set_iterator *iter)
+{
+	struct igt_set *set = iter->set;
+	struct igt_set *curr = &iter->result;
+	int i, pos = 0;
+
+	if (iter->init) {
+		iter->init = false;
+		iter->data.result_bits = 0;
+		iter->result.size = iter->result_size;
+	} else {
+		iter->data.result_bits++;
+	}
+
+	while (num_bits_set(iter->data.result_bits) != iter->result_size)
+		iter->data.result_bits++;
+
+	if (iter->data.result_bits & (1 << set->size))
+		return NULL;
+
+	for (i = 0; i < set->size; i++) {
+		if (!(iter->data.result_bits & (1 << i)))
+			continue;
+		curr->set[pos++] = set->set[i];
+		curr->size = pos;
+	}
+
+	return curr;
+}
+
+static struct igt_set *igt_set_iter_multicombination(struct igt_set_iterator *iter)
+{
+	struct igt_set *set = iter->set;
+	struct igt_set *curr = &iter->result;
+	int i;
+
+	if (iter->init) {
+		iter->init = false;
+		iter->result.size = iter->result_size;
+		for (i = 0; i < iter->result_size; i++)
+			iter->data.idxs[i] = 0;
+	}
+
+	if (iter->data.idxs[0] == iter->set->size)
+		return NULL;
+
+	for (i = 0; i < iter->result_size; i++)
+		curr->set[i] = set->set[iter->data.idxs[i]];
+
+	for (i = iter->result_size-1; i >= 0; i--) {
+		if (++iter->data.idxs[i] == iter->set->size && i > 0) {
+			iter->data.idxs[i] %= iter->set->size;
+		} else {
+			break;
+		}
+	}
+
+	return curr;
+}
+
+struct igt_set *igt_set_iterate_next(struct igt_set_iterator *iter)
+{
+	struct igt_set *ret_set = NULL;
+
+	switch(iter->algorithm) {
+	case IGT_SET_SUBSETS:
+		ret_set = igt_set_iter_subsets(iter);
+		break;
+	case IGT_SET_COMBINATION:
+		ret_set = igt_set_iter_combination(iter);
+		break;
+	case IGT_SET_MULTICOMBINATION:
+		ret_set = igt_set_iter_multicombination(iter);
+		break;
+	default:
+		igt_assert_f(false, "Unknown algorithm\n");
+	}
+
+	return ret_set;
+}
diff --git a/lib/igt_set.h b/lib/igt_set.h
new file mode 100644
index 00000000..238c226a
--- /dev/null
+++ b/lib/igt_set.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __IGT_SET_H__
+#define __IGT_SET_H__
+
+/* Maximum set size we support, don't change unless you understand
+ * the implementation */
+#define IGT_SET_MAXSIZE 16
+
+enum igt_set_iteration_algorithm {
+	IGT_SET_SUBSETS,
+	IGT_SET_COMBINATION,
+	IGT_SET_MULTICOMBINATION,
+};
+
+struct igt_set_data {
+	int value;
+	void *ptr;
+};
+
+struct igt_set {
+	int size;
+	struct igt_set_data set[IGT_SET_MAXSIZE];
+};
+
+struct igt_set_iterator;
+
+struct igt_set *igt_set_init(int size);
+void igt_set_free(struct igt_set *set);
+void igt_set_setvalue(struct igt_set *set, int index, int value);
+int igt_set_getvalue(struct igt_set *set, int index);
+void igt_set_setptr(struct igt_set *set, int index, void *ptr);
+void *igt_set_getptr(struct igt_set *set, int index);
+
+struct igt_set_iterator *igt_set_iterator_init(struct igt_set *set,
+					       int subset_size,
+					       enum igt_set_iteration_algorithm algorithm);
+void igt_set_iterator_free(struct igt_set_iterator *iter);
+struct igt_set *igt_set_iterate_next(struct igt_set_iterator *iter);
+
+#endif /* __IGT_SET_H__ */
diff --git a/lib/meson.build b/lib/meson.build
index 57eb7d93..98806914 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -19,6 +19,7 @@ lib_sources = [
 	'igt_primes.c',
 	'igt_rand.c',
 	'igt_rapl.c',
+	'igt_set.c',
 	'igt_stats.c',
 	'igt_syncobj.c',
 	'igt_sysfs.c',
-- 
2.23.0

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

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

* [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_set: Adding combinatorics facility
  2020-01-17  7:54 [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility Zbigniew Kempczyński
@ 2020-01-17  8:46 ` Patchwork
  2020-01-17 10:58 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2020-01-17  8:46 UTC (permalink / raw)
  To: Zbigniew Kempczyński; +Cc: igt-dev

== Series Details ==

Series: lib/igt_set: Adding combinatorics facility
URL   : https://patchwork.freedesktop.org/series/72163/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7758 -> IGTPW_3931
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/index.html

Known issues
------------

  Here are the changes found in IGTPW_3931 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload-with-fault-injection:
    - fi-cfl-8700k:       [PASS][1] -> [DMESG-WARN][2] ([i915#889])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-cfl-8700k/igt@i915_module_load@reload-with-fault-injection.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-cfl-8700k/igt@i915_module_load@reload-with-fault-injection.html
    - fi-skl-6700k2:      [PASS][3] -> [INCOMPLETE][4] ([i915#671])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-skl-6700k2/igt@i915_module_load@reload-with-fault-injection.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-skl-6700k2/igt@i915_module_load@reload-with-fault-injection.html

  * igt@i915_selftest@live_active:
    - fi-skl-lmem:        [PASS][5] -> [DMESG-FAIL][6] ([i915#666])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-skl-lmem/igt@i915_selftest@live_active.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-skl-lmem/igt@i915_selftest@live_active.html

  * igt@i915_selftest@live_blt:
    - fi-ivb-3770:        [PASS][7] -> [DMESG-FAIL][8] ([i915#725])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-ivb-3770/igt@i915_selftest@live_blt.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-ivb-3770/igt@i915_selftest@live_blt.html

  * igt@i915_selftest@live_gem_contexts:
    - fi-cfl-guc:         [PASS][9] -> [INCOMPLETE][10] ([fdo#106070] / [i915#424])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-cfl-guc/igt@i915_selftest@live_gem_contexts.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-cfl-guc/igt@i915_selftest@live_gem_contexts.html

  
#### Possible fixes ####

  * igt@gem_exec_create@basic:
    - fi-icl-dsi:         [DMESG-WARN][11] ([i915#109]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-icl-dsi/igt@gem_exec_create@basic.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-icl-dsi/igt@gem_exec_create@basic.html

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-6770hq:      [FAIL][13] ([i915#178]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live_blt:
    - fi-hsw-4770:        [DMESG-FAIL][15] ([i915#553] / [i915#725]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/fi-hsw-4770/igt@i915_selftest@live_blt.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/fi-hsw-4770/igt@i915_selftest@live_blt.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#106070]: https://bugs.freedesktop.org/show_bug.cgi?id=106070
  [i915#109]: https://gitlab.freedesktop.org/drm/intel/issues/109
  [i915#178]: https://gitlab.freedesktop.org/drm/intel/issues/178
  [i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
  [i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
  [i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666
  [i915#671]: https://gitlab.freedesktop.org/drm/intel/issues/671
  [i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
  [i915#889]: https://gitlab.freedesktop.org/drm/intel/issues/889
  [i915#937]: https://gitlab.freedesktop.org/drm/intel/issues/937


Participating hosts (47 -> 41)
------------------------------

  Additional (3): fi-kbl-soraka fi-byt-j1900 fi-byt-n2820 
  Missing    (9): fi-ilk-m540 fi-hsw-4200u fi-glk-dsi fi-byt-squawks fi-bwr-2160 fi-bsw-cyan fi-kbl-x1275 fi-gdg-551 fi-elk-e7500 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_5371 -> IGTPW_3931

  CI-20190529: 20190529
  CI_DRM_7758: d19270ce1f367fbfc1ff3b539bcb50e11ded181f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_3931: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/index.html
  IGT_5371: 1b2816124ec3dbd53b81725d39292f45d41d895b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility
  2020-01-17  7:54 [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility Zbigniew Kempczyński
  2020-01-17  8:46 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2020-01-17 10:58 ` Chris Wilson
  2020-01-17 13:52 ` Chris Wilson
  2020-01-20 11:20 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
  3 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2020-01-17 10:58 UTC (permalink / raw)
  To: Zbigniew Kempczyński, igt-dev; +Cc: Petri Latvala

Quoting Zbigniew Kempczyński (2020-01-17 07:54:49)
> Dynamic tests gives us new method to create tests depending on the
> hardware/software capabilities. To check coverage some tests require
> verification over some set of objects/data. To make life easier
> with combinatorics this patch introduces igt_set. Currently it supports
> iterating over set to get subsets, combinations and multicombinations.
> Code has some limitation (set/subset cannot be larger than 16 elements,
> what is enough for most cases).
> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  lib/Makefile.sources |   2 +
>  lib/igt_set.c        | 250 +++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_set.h        |  62 +++++++++++
>  lib/meson.build      |   1 +
>  4 files changed, 315 insertions(+)
>  create mode 100644 lib/igt_set.c
>  create mode 100644 lib/igt_set.h
> 
> diff --git a/lib/Makefile.sources b/lib/Makefile.sources
> index 5dd3962e..7852d52a 100644
> --- a/lib/Makefile.sources
> +++ b/lib/Makefile.sources
> @@ -52,6 +52,8 @@ lib_source_list =             \
>         igt_rapl.c              \
>         igt_rapl.h              \
>         igt_rc.h                \
> +       igt_set.c               \
> +       igt_set.h               \
>         igt_stats.c             \
>         igt_stats.h             \
>         igt_sysfs.c             \
> diff --git a/lib/igt_set.c b/lib/igt_set.c
> new file mode 100644
> index 00000000..797c51ad
> --- /dev/null
> +++ b/lib/igt_set.c
> @@ -0,0 +1,250 @@
> +#include "igt.h"
> +#include "igt_set.h"
> +
> +/**
> + * Generic combinatorics library.
> + *
> + * Supports: subsets, combinations and multicombinations.
> + *
> + * Usage example:
> + *
> + * struct igt_set *set;
> + * struct igt_set *subset;
> + * struct igt_set_iterator *iter;
> + *
> + * int i;
> + * set = igt_set_init(4);
> + * iter = igt_set_iterator_init(set, 2, IGT_SET_SUBSETS);
> + * //iter = igt_set_iterator_init(set, 2, IGT_SET_MULTICOMBINATION);
> + * //iter = igt_set_iterator_init(set, 2, IGT_SET_COMBINATION);
> + *
> + * for (i = 0; i < set->size; i++) {
> + *      igt_set_setvalue(set, i, i * 2);
> + *      igt_set_setptr(set, i, &i + i);

set_setX, meh.

igt_collection_set_value()
igt_collection_set_pointer()

iter = igt_collection_iter();
[it's not an init as it allocates ;]

> + * }
> + *
> + * while ((subset = igt_set_iterate_next(iter))) {
> + *      // --- do sth with subset ---
> + *      // --- subset is a part of iterator, so don't free it! ---
> + * }
> + *
> + * igt_set_iterator_free(iter);
> + * igt_set_free(set);
> + */
> +
> +/* Taken from Hacker's Delight */
> +static inline int num_bits_set(uint32_t x)
> +{
> +       x = x - ((x >> 1) & 0x55555555);
> +       x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
> +       x = (x + (x >> 4)) & 0x0F0F0F0F;
> +       x = x + (x >> 8);
> +       x = x + (x >> 16);
> +       return x & 0x0000003F;
> +}

-> __builtin_popcount()

> +
> +struct igt_set_iterator {
> +       struct igt_set *set;
> +       enum igt_set_iteration_algorithm algorithm;
> +       bool init;
> +       int result_size;
> +       struct igt_set result;
> +
> +       /* Algorithms state, to be used by iterators */
> +       struct {
> +               uint32_t result_bits;
> +               int current_result_size;
> +               int idxs[IGT_SET_MAXSIZE];
> +       } data;
> +};
> +
> +struct igt_set *igt_set_init(int size)
> +{
> +       struct igt_set *set;
> +       int i;
> +
> +       igt_assert(size > 0 && size <= IGT_SET_MAXSIZE);
> +
> +       set = calloc(1, sizeof(*set));
> +       igt_assert(set);
> +
> +       set->size = size;
> +       for (i = 0; i < size; i++)
> +               set->set[i].value = i; /* set to index as default */
> +
> +       return set;
> +}
> +
> +void igt_set_free(struct igt_set *set)
> +{
> +       free(set);
> +}
> +
> +void igt_set_setvalue(struct igt_set *set, int index, int value)
> +{
> +       set->set[index].value = value;
> +}
> +
> +int igt_set_getvalue(struct igt_set *set, int index)
> +{
> +       return set->set[index].value;
> +}
> +
> +void igt_set_setptr(struct igt_set *set, int index, void *ptr)
> +{
> +       set->set[index].ptr = ptr;
> +}
> +
> +void *igt_set_getptr(struct igt_set *set, int index)
> +{
> +       return set->set[index].ptr;
> +}
> +
> +struct igt_set_iterator *igt_set_iterator_init(struct igt_set *set,
> +                                              int result_size,
> +                                              enum igt_set_iteration_algorithm algorithm)
> +{
> +       struct igt_set_iterator *iter;
> +
> +       igt_assert(result_size > 0 && result_size <= IGT_SET_MAXSIZE);
> +       if (algorithm != IGT_SET_MULTICOMBINATION)
> +               igt_assert(result_size <= set->size);
> +
> +       iter = calloc(1, sizeof(*iter));
> +       igt_assert(iter);
> +
> +       iter->set = set;
> +       iter->result_size = result_size;
> +       iter->algorithm = algorithm;
> +       iter->init = true;
> +
> +       return iter;
> +}
> +
> +void igt_set_iterator_free(struct igt_set_iterator *iter)
> +{
> +       free(iter);
> +}
> +
> +static struct igt_set *igt_set_iter_subsets(struct igt_set_iterator *iter)
> +{
> +       struct igt_set *set = iter->set;
> +       struct igt_set *curr = &iter->result;
> +       int i, pos = 0;
> +
> +       if (iter->init) {
> +               iter->init = false;
> +               iter->data.result_bits = 0;
> +               iter->data.current_result_size = 0;
> +               curr->size = 0;
> +       } else {
> +               iter->data.result_bits++;
> +               if (iter->data.result_bits & (1 << iter->set->size)) {
> +                       iter->data.current_result_size++;
> +                       iter->data.result_bits = 0;
> +               }
> +               if (iter->data.current_result_size > iter->result_size)
> +                       return NULL;
> +       }
> +
> +       while (num_bits_set(iter->data.result_bits) != iter->data.current_result_size) {
> +               iter->data.result_bits++;
> +               if (iter->data.result_bits & (1 << iter->set->size)) {
> +                       iter->data.current_result_size++;
> +                       iter->data.result_bits = 0;
> +               }
> +       }
> +
> +       if (iter->data.current_result_size > iter->result_size)
> +               return NULL;
> +
> +       for (i = 0; i < set->size; i++) {
> +               if (!(iter->data.result_bits & (1 << i)))
> +                       continue;
> +               curr->set[pos++] = set->set[i];
> +               curr->size = pos;
> +       }
> +
> +       return curr;
> +}
> +
> +static struct igt_set *igt_set_iter_combination(struct igt_set_iterator *iter)
> +{
> +       struct igt_set *set = iter->set;
> +       struct igt_set *curr = &iter->result;
> +       int i, pos = 0;
> +
> +       if (iter->init) {
> +               iter->init = false;
> +               iter->data.result_bits = 0;
> +               iter->result.size = iter->result_size;
> +       } else {
> +               iter->data.result_bits++;
> +       }
> +
> +       while (num_bits_set(iter->data.result_bits) != iter->result_size)
> +               iter->data.result_bits++;
> +
> +       if (iter->data.result_bits & (1 << set->size))
> +               return NULL;
> +
> +       for (i = 0; i < set->size; i++) {
> +               if (!(iter->data.result_bits & (1 << i)))
> +                       continue;
> +               curr->set[pos++] = set->set[i];
> +               curr->size = pos;
> +       }
> +
> +       return curr;
> +}
> +
> +static struct igt_set *igt_set_iter_multicombination(struct igt_set_iterator *iter)
> +{
> +       struct igt_set *set = iter->set;
> +       struct igt_set *curr = &iter->result;
> +       int i;
> +
> +       if (iter->init) {
> +               iter->init = false;
> +               iter->result.size = iter->result_size;
> +               for (i = 0; i < iter->result_size; i++)
> +                       iter->data.idxs[i] = 0;
> +       }
> +
> +       if (iter->data.idxs[0] == iter->set->size)
> +               return NULL;
> +
> +       for (i = 0; i < iter->result_size; i++)
> +               curr->set[i] = set->set[iter->data.idxs[i]];
> +
> +       for (i = iter->result_size-1; i >= 0; i--) {
> +               if (++iter->data.idxs[i] == iter->set->size && i > 0) {
> +                       iter->data.idxs[i] %= iter->set->size;
> +               } else {
> +                       break;
> +               }
> +       }
> +
> +       return curr;
> +}
> +
> +struct igt_set *igt_set_iterate_next(struct igt_set_iterator *iter)
> +{
> +       struct igt_set *ret_set = NULL;
> +
> +       switch(iter->algorithm) {
> +       case IGT_SET_SUBSETS:
> +               ret_set = igt_set_iter_subsets(iter);
> +               break;
> +       case IGT_SET_COMBINATION:
> +               ret_set = igt_set_iter_combination(iter);
> +               break;
> +       case IGT_SET_MULTICOMBINATION:
> +               ret_set = igt_set_iter_multicombination(iter);
> +               break;
> +       default:
> +               igt_assert_f(false, "Unknown algorithm\n");
> +       }
> +
> +       return ret_set;
> +}
> diff --git a/lib/igt_set.h b/lib/igt_set.h
> new file mode 100644
> index 00000000..238c226a
> --- /dev/null
> +++ b/lib/igt_set.h
> @@ -0,0 +1,62 @@
> +/*
> + * Copyright © 2020 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#ifndef __IGT_SET_H__
> +#define __IGT_SET_H__
> +
> +/* Maximum set size we support, don't change unless you understand
> + * the implementation */
> +#define IGT_SET_MAXSIZE 16

igt_bitmap awaits. ;)

> +enum igt_set_iteration_algorithm {
> +       IGT_SET_SUBSETS,
> +       IGT_SET_COMBINATION,
> +       IGT_SET_MULTICOMBINATION,
> +};
> +
> +struct igt_set_data {
> +       int value;
> +       void *ptr;
> +};
> +
> +struct igt_set {
> +       int size;
> +       struct igt_set_data set[IGT_SET_MAXSIZE];
> +};
> +
> +struct igt_set_iterator;
> +
> +struct igt_set *igt_set_init(int size);
> +void igt_set_free(struct igt_set *set);
> +void igt_set_setvalue(struct igt_set *set, int index, int value);
> +int igt_set_getvalue(struct igt_set *set, int index);
> +void igt_set_setptr(struct igt_set *set, int index, void *ptr);
> +void *igt_set_getptr(struct igt_set *set, int index);
> +
> +struct igt_set_iterator *igt_set_iterator_init(struct igt_set *set,
> +                                              int subset_size,
> +                                              enum igt_set_iteration_algorithm algorithm);
> +void igt_set_iterator_free(struct igt_set_iterator *iter);
> +struct igt_set *igt_set_iterate_next(struct igt_set_iterator *iter);

Bonus points for:
#define igt_collection_foreach_subset(it, set, size) \
	for (struct igt_set_iteration *it = iter(set, size, SUBSET); iter_next(it); )
(igt_collection_foreach_combo, foreach_multicombo ?)

and definitely a igt_collection_foreach(key, value, set), we we can
write something like

igt_collection_foreach_subset(it, &myset, 4) {
	igt_collection_foreach(key, value, it->set) {
	}
}

igt_collection_foreach_combination(it, &myset, 4) {
	igt_collection_foreach(key, value, it->set) {
	}
}

And they definitely need a short description of their different
permutations.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility
  2020-01-17  7:54 [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility Zbigniew Kempczyński
  2020-01-17  8:46 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2020-01-17 10:58 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
@ 2020-01-17 13:52 ` Chris Wilson
  2020-01-20 11:58   ` Petri Latvala
  2020-01-20 11:20 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
  3 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2020-01-17 13:52 UTC (permalink / raw)
  To: Zbigniew Kempczyński, igt-dev; +Cc: Petri Latvala

Quoting Zbigniew Kempczyński (2020-01-17 07:54:49)
> Dynamic tests gives us new method to create tests depending on the
> hardware/software capabilities. To check coverage some tests require
> verification over some set of objects/data. To make life easier
> with combinatorics this patch introduces igt_set. Currently it supports
> iterating over set to get subsets, combinations and multicombinations.
> Code has some limitation (set/subset cannot be larger than 16 elements,
> what is enough for most cases).

I have to say, this looks like it is going to be very, very useful. All
those times where I've used
	for_each_engine {
		for_each_engine {
		}
	}
can be reduced to a standard combinatorial set, with igt_dynamic
labelling thrown on top.

Petri, can you suggest how to write the selftests for igt? We definitely
need a few to verify it works as expected and provide a few simple
examples.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_set: Adding combinatorics facility
  2020-01-17  7:54 [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility Zbigniew Kempczyński
                   ` (2 preceding siblings ...)
  2020-01-17 13:52 ` Chris Wilson
@ 2020-01-20 11:20 ` Patchwork
  3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2020-01-20 11:20 UTC (permalink / raw)
  To: Zbigniew Kempczyński; +Cc: igt-dev

== Series Details ==

Series: lib/igt_set: Adding combinatorics facility
URL   : https://patchwork.freedesktop.org/series/72163/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7758_full -> IGTPW_3931_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/index.html

Known issues
------------

  Here are the changes found in IGTPW_3931_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_isolation@vcs1-s3:
    - shard-iclb:         [PASS][1] -> [SKIP][2] ([fdo#109276] / [fdo#112080])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb2/igt@gem_ctx_isolation@vcs1-s3.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb8/igt@gem_ctx_isolation@vcs1-s3.html

  * igt@gem_exec_schedule@pi-distinct-iova-bsd:
    - shard-iclb:         [PASS][3] -> [SKIP][4] ([i915#677])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb5/igt@gem_exec_schedule@pi-distinct-iova-bsd.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb4/igt@gem_exec_schedule@pi-distinct-iova-bsd.html

  * igt@gem_exec_schedule@preempt-other-chain-bsd:
    - shard-iclb:         [PASS][5] -> [SKIP][6] ([fdo#112146]) +3 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb6/igt@gem_exec_schedule@preempt-other-chain-bsd.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@gem_exec_schedule@preempt-other-chain-bsd.html

  * igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrash-inactive:
    - shard-hsw:          [PASS][7] -> [TIMEOUT][8] ([fdo#112271] / [i915#530])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-hsw5/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrash-inactive.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-hsw2/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrash-inactive.html

  * igt@gem_persistent_relocs@forked-interruptible-thrashing:
    - shard-iclb:         [PASS][9] -> [FAIL][10] ([i915#520])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb1/igt@gem_persistent_relocs@forked-interruptible-thrashing.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb8/igt@gem_persistent_relocs@forked-interruptible-thrashing.html
    - shard-kbl:          [PASS][11] -> [TIMEOUT][12] ([fdo#112271])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl7/igt@gem_persistent_relocs@forked-interruptible-thrashing.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl7/igt@gem_persistent_relocs@forked-interruptible-thrashing.html

  * igt@gem_persistent_relocs@forked-thrashing:
    - shard-hsw:          [PASS][13] -> [INCOMPLETE][14] ([i915#530] / [i915#61])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-hsw5/igt@gem_persistent_relocs@forked-thrashing.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-hsw5/igt@gem_persistent_relocs@forked-thrashing.html
    - shard-iclb:         [PASS][15] -> [TIMEOUT][16] ([fdo#112271] / [i915#530])
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb2/igt@gem_persistent_relocs@forked-thrashing.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb4/igt@gem_persistent_relocs@forked-thrashing.html

  * igt@gem_ppgtt@flink-and-close-vma-leak:
    - shard-iclb:         [PASS][17] -> [FAIL][18] ([i915#644])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb1/igt@gem_ppgtt@flink-and-close-vma-leak.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb2/igt@gem_ppgtt@flink-and-close-vma-leak.html

  * igt@i915_pm_backlight@fade_with_suspend:
    - shard-iclb:         [PASS][19] -> [DMESG-WARN][20] ([fdo#111764])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb8/igt@i915_pm_backlight@fade_with_suspend.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb4/igt@i915_pm_backlight@fade_with_suspend.html

  * igt@i915_suspend@fence-restore-tiled2untiled:
    - shard-apl:          [PASS][21] -> [DMESG-WARN][22] ([i915#180]) +4 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-apl7/igt@i915_suspend@fence-restore-tiled2untiled.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-apl4/igt@i915_suspend@fence-restore-tiled2untiled.html

  * igt@kms_color@pipe-b-ctm-blue-to-red:
    - shard-apl:          [PASS][23] -> [FAIL][24] ([i915#129])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-apl3/igt@kms_color@pipe-b-ctm-blue-to-red.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-apl8/igt@kms_color@pipe-b-ctm-blue-to-red.html
    - shard-kbl:          [PASS][25] -> [FAIL][26] ([i915#129])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl7/igt@kms_color@pipe-b-ctm-blue-to-red.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl4/igt@kms_color@pipe-b-ctm-blue-to-red.html

  * igt@kms_flip@2x-modeset-vs-vblank-race-interruptible:
    - shard-glk:          [PASS][27] -> [FAIL][28] ([i915#407])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-glk5/igt@kms_flip@2x-modeset-vs-vblank-race-interruptible.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-glk9/igt@kms_flip@2x-modeset-vs-vblank-race-interruptible.html

  * igt@kms_frontbuffer_tracking@fbc-suspend:
    - shard-kbl:          [PASS][29] -> [FAIL][30] ([fdo#103375])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl7/igt@kms_frontbuffer_tracking@fbc-suspend.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl3/igt@kms_frontbuffer_tracking@fbc-suspend.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
    - shard-kbl:          [PASS][31] -> [INCOMPLETE][32] ([fdo#103665])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl2/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
    - shard-kbl:          [PASS][33] -> [DMESG-WARN][34] ([i915#180]) +3 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl3/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl2/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes.html

  * igt@kms_psr2_su@frontbuffer:
    - shard-iclb:         [PASS][35] -> [SKIP][36] ([fdo#109642] / [fdo#111068])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb2/igt@kms_psr2_su@frontbuffer.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb6/igt@kms_psr2_su@frontbuffer.html

  * igt@kms_psr@no_drrs:
    - shard-iclb:         [PASS][37] -> [FAIL][38] ([i915#173])
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb8/igt@kms_psr@no_drrs.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@kms_psr@no_drrs.html

  * igt@kms_psr@psr2_primary_page_flip:
    - shard-iclb:         [PASS][39] -> [SKIP][40] ([fdo#109441])
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb5/igt@kms_psr@psr2_primary_page_flip.html

  * igt@perf_pmu@busy-check-all-vcs1:
    - shard-iclb:         [PASS][41] -> [SKIP][42] ([fdo#112080]) +13 similar issues
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb1/igt@perf_pmu@busy-check-all-vcs1.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb5/igt@perf_pmu@busy-check-all-vcs1.html

  * igt@prime_busy@hang-bsd2:
    - shard-iclb:         [PASS][43] -> [SKIP][44] ([fdo#109276]) +14 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb2/igt@prime_busy@hang-bsd2.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb5/igt@prime_busy@hang-bsd2.html

  
#### Possible fixes ####

  * igt@gem_ctx_isolation@vcs1-none:
    - shard-iclb:         [SKIP][45] ([fdo#109276] / [fdo#112080]) -> [PASS][46] +2 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb6/igt@gem_ctx_isolation@vcs1-none.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@gem_ctx_isolation@vcs1-none.html

  * igt@gem_ctx_persistence@processes:
    - shard-iclb:         [FAIL][47] ([i915#570]) -> [PASS][48]
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb4/igt@gem_ctx_persistence@processes.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb6/igt@gem_ctx_persistence@processes.html

  * igt@gem_eio@kms:
    - shard-snb:          [INCOMPLETE][49] ([i915#82]) -> [PASS][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-snb6/igt@gem_eio@kms.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-snb2/igt@gem_eio@kms.html

  * igt@gem_exec_schedule@preempt-contexts-bsd2:
    - shard-iclb:         [SKIP][51] ([fdo#109276]) -> [PASS][52] +18 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb8/igt@gem_exec_schedule@preempt-contexts-bsd2.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@gem_exec_schedule@preempt-contexts-bsd2.html

  * igt@gem_exec_schedule@wide-bsd:
    - shard-iclb:         [SKIP][53] ([fdo#112146]) -> [PASS][54] +6 similar issues
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb2/igt@gem_exec_schedule@wide-bsd.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb6/igt@gem_exec_schedule@wide-bsd.html

  * igt@gem_persistent_relocs@forked-interruptible-thrash-inactive:
    - shard-kbl:          [TIMEOUT][55] ([fdo#112271] / [i915#530]) -> [PASS][56]
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl4/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl2/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html
    - shard-hsw:          [TIMEOUT][57] ([fdo#112271] / [i915#530]) -> [PASS][58]
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-hsw7/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-hsw2/igt@gem_persistent_relocs@forked-interruptible-thrash-inactive.html

  * igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy:
    - shard-snb:          [DMESG-WARN][59] ([fdo#111870] / [i915#478]) -> [PASS][60] +1 similar issue
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-snb4/igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-snb4/igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy.html

  * igt@i915_pm_dc@dc6-psr:
    - shard-iclb:         [FAIL][61] ([i915#454]) -> [PASS][62]
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb4/igt@i915_pm_dc@dc6-psr.html
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@i915_pm_dc@dc6-psr.html

  * {igt@i915_pm_rc6_residency@rc6-idle}:
    - shard-apl:          [FAIL][63] ([i915#973]) -> [PASS][64]
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-apl3/igt@i915_pm_rc6_residency@rc6-idle.html
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-apl7/igt@i915_pm_rc6_residency@rc6-idle.html

  * igt@i915_pm_rps@reset:
    - shard-iclb:         [FAIL][65] ([i915#413]) -> [PASS][66]
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb4/igt@i915_pm_rps@reset.html
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb2/igt@i915_pm_rps@reset.html

  * igt@i915_selftest@live_execlists:
    - shard-kbl:          [INCOMPLETE][67] ([fdo#103665] / [fdo#112175] / [fdo#112259]) -> [PASS][68]
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl6/igt@i915_selftest@live_execlists.html
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl7/igt@i915_selftest@live_execlists.html

  * igt@kms_cursor_crc@pipe-a-cursor-suspend:
    - shard-apl:          [DMESG-WARN][69] ([i915#180]) -> [PASS][70]
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-apl3/igt@kms_cursor_crc@pipe-a-cursor-suspend.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-apl7/igt@kms_cursor_crc@pipe-a-cursor-suspend.html

  * igt@kms_cursor_crc@pipe-c-cursor-suspend:
    - shard-kbl:          [DMESG-WARN][71] ([i915#180]) -> [PASS][72] +3 similar issues
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-kbl2/igt@kms_cursor_crc@pipe-c-cursor-suspend.html
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-kbl1/igt@kms_cursor_crc@pipe-c-cursor-suspend.html

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-shrfb-msflip-blt:
    - shard-glk:          [FAIL][73] ([i915#49]) -> [PASS][74]
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-glk8/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-shrfb-msflip-blt.html
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-glk1/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-shrfb-msflip-blt.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
    - shard-iclb:         [INCOMPLETE][75] ([i915#140] / [i915#250]) -> [PASS][76]
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb8/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes.html
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes.html

  * igt@kms_psr@psr2_sprite_plane_move:
    - shard-iclb:         [SKIP][77] ([fdo#109441]) -> [PASS][78] +3 similar issues
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb8/igt@kms_psr@psr2_sprite_plane_move.html
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html

  * igt@perf_pmu@init-busy-vcs1:
    - shard-iclb:         [SKIP][79] ([fdo#112080]) -> [PASS][80] +6 similar issues
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb5/igt@perf_pmu@init-busy-vcs1.html
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb1/igt@perf_pmu@init-busy-vcs1.html

  
#### Warnings ####

  * igt@gem_ctx_isolation@vcs1-nonpriv:
    - shard-iclb:         [FAIL][81] ([IGT#28]) -> [SKIP][82] ([fdo#109276] / [fdo#112080])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb4/igt@gem_ctx_isolation@vcs1-nonpriv.html
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb6/igt@gem_ctx_isolation@vcs1-nonpriv.html

  * igt@gem_ctx_isolation@vcs1-nonpriv-switch:
    - shard-iclb:         [SKIP][83] ([fdo#109276] / [fdo#112080]) -> [FAIL][84] ([IGT#28])
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-iclb6/igt@gem_ctx_isolation@vcs1-nonpriv-switch.html
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-iclb2/igt@gem_ctx_isolation@vcs1-nonpriv-switch.html

  * igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing:
    - shard-apl:          [TIMEOUT][85] ([fdo#112271] / [i915#530]) -> [INCOMPLETE][86] ([CI#80] / [fdo#103927] / [i915#530])
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-apl6/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-apl3/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html

  * igt@runner@aborted:
    - shard-glk:          ([FAIL][87], [FAIL][88]) ([k.org#202321]) -> ([FAIL][89], [FAIL][90]) ([i915#940] / [k.org#202321])
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-glk2/igt@runner@aborted.html
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7758/shard-glk9/igt@runner@aborted.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-glk9/igt@runner@aborted.html
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/shard-glk2/igt@runner@aborted.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [CI#80]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/80
  [IGT#28]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/28
  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111764]: https://bugs.freedesktop.org/show_bug.cgi?id=111764
  [fdo#111870]: https://bugs.freedesktop.org/show_bug.cgi?id=111870
  [fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
  [fdo#112146]: https://bugs.freedesktop.org/show_bug.cgi?id=112146
  [fdo#112175]: https://bugs.freedesktop.org/show_bug.cgi?id=112175
  [fdo#112259]: https://bugs.freedesktop.org/show_bug.cgi?id=112259
  [fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
  [i915#129]: https://gitlab.freedesktop.org/drm/intel/issues/129
  [i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140
  [i915#173]: https://gitlab.freedesktop.org/drm/intel/issues/173
  [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
  [i915#250]: https://gitlab.freedesktop.org/drm/intel/issues/250
  [i915#407]: https://gitlab.freedesktop.org/drm/intel/issues/407
  [i915#413]: https://gitlab.freedesktop.org/drm/intel/issues/413
  [i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
  [i915#478]: https://gitlab.freedesktop.org/drm/intel/issues/478
  [i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49
  [i915#520]: https://gitlab.freedesktop.org/drm/intel/issues/520
  [i915#530]: https://gitlab.freedesktop.org/drm/intel/issues/530
  [i915#570]: https://gitlab.freedesktop.org/drm/intel/issues/570
  [i915#61]: https://gitlab.freedesktop.org/drm/intel/issues/61
  [i915#644]: https://gitlab.freedesktop.org/drm/intel/issues/644
  [i915#677]: https://gitlab.freedesktop.org/drm/intel/issues/677
  [i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82
  [i915#940]: https://gitlab.freedesktop.org/drm/intel/issues/940
  [i915#973]: https://gitlab.freedesktop.org/drm/intel/issues/973
  [k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321


Participating hosts (10 -> 8)
------------------------------

  Missing    (2): pig-skl-6260u pig-glk-j5005 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_5371 -> IGTPW_3931
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_7758: d19270ce1f367fbfc1ff3b539bcb50e11ded181f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_3931: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/index.html
  IGT_5371: 1b2816124ec3dbd53b81725d39292f45d41d895b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3931/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility
  2020-01-17 13:52 ` Chris Wilson
@ 2020-01-20 11:58   ` Petri Latvala
  0 siblings, 0 replies; 6+ messages in thread
From: Petri Latvala @ 2020-01-20 11:58 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Fri, Jan 17, 2020 at 01:52:36PM +0000, Chris Wilson wrote:
> Quoting Zbigniew Kempczyński (2020-01-17 07:54:49)
> > Dynamic tests gives us new method to create tests depending on the
> > hardware/software capabilities. To check coverage some tests require
> > verification over some set of objects/data. To make life easier
> > with combinatorics this patch introduces igt_set. Currently it supports
> > iterating over set to get subsets, combinations and multicombinations.
> > Code has some limitation (set/subset cannot be larger than 16 elements,
> > what is enough for most cases).
> 
> I have to say, this looks like it is going to be very, very useful. All
> those times where I've used
> 	for_each_engine {
> 		for_each_engine {
> 		}
> 	}
> can be reduced to a standard combinatorial set, with igt_dynamic
> labelling thrown on top.
> 
> Petri, can you suggest how to write the selftests for igt? We definitely
> need a few to verify it works as expected and provide a few simple
> examples.


lib/tests/*.c

igt_audio.c and igt_edid.c are better examples than the ones testing
that the igt_magic_stuff macros works properly. They might also look a
bit familiar in structure...


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2020-01-20 11:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-17  7:54 [igt-dev] [PATCH i-g-t] lib/igt_set: Adding combinatorics facility Zbigniew Kempczyński
2020-01-17  8:46 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-01-17 10:58 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2020-01-17 13:52 ` Chris Wilson
2020-01-20 11:58   ` Petri Latvala
2020-01-20 11:20 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork

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