drm/i915/selftests/perf: measure memcpy bw between regions
Subsystems (2)
PATCH 1/1 drm/i915/selftests/perf: measure memcpy bw between regions
Measure the memcpy bw between our CPU accessible regions, trying all supported mapping combinations(WC, WB) across various sizes.
--- .../drm/i915/selftests/i915_perf_selftests.h | 1 + .../drm/i915/selftests/intel_memory_region.c | 164 ++++++++++++++++++ 2 files changed, 165 insertions(+)
drivers/gpu/drm/i915/selftests/i915_perf_selftests.h +1 -0
@@ -17,3 +17,4 @@*/ selftest(engine_cs, intel_engine_cs_perf_selftests) selftest(blt, i915_gem_object_blt_perf_selftests) +selftest (region, intel_memory_region_perf_selftests)
drivers/gpu/drm/i915/selftests/intel_memory_region.c +164 -0
179 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Matthew Auld (2020-01-27 12:56:26)
Quoted 32 lines
Measure the memcpy bw between our CPU accessible regions, trying all supported mapping
combinations(WC, WB)across various sizes.Signed-off-by Matthew Auld <[email protected]>Cc Chris Wilson <[email protected]>--- .../drm/i915/selftests/i915_perf_selftests.h | 1 + .../drm/i915/selftests/intel_memory_region.c | 164 ++++++++++++++++++ 2 files changed, 165 insertions(+)drivers/gpu/drm/i915/selftests/i915_perf_selftests.h +1
-0@@ -17,3 +17,4 @@*/ selftest(engine_cs, intel_engine_cs_perf_selftests) selftest(blt, i915_gem_object_blt_perf_selftests) +selftest (region, intel_memory_region_perf_selftests)drivers/gpu/drm/i915/selftests/intel_memory_region.c +1
-0@@ -4,6 +4,7 @@*/ #include <linux/prime_numbers.h> +#include <linux/sort.h> #include "../i915_selftest.h"
drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_lmem_write_cpu(void *arg) · line 576
Quoted 4 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +1
-0@@ -572,6 +573,157 @@ static int igt_lmem_write_cpu(void *arg)return err; } +static const char *stringify_map_type (u32 type)
Fwiw, I've begun using repr_foo(foo). Which do we prefer?
Quoted 11 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +11
-0+{ +switch (type) { +case I915_MAP_WB : +return "WB" ; +case I915_MAP_WC : +return "WC" ; + } + +return "" ; +} +
drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_lmem_write_cpu(void *arg) · line 597
Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +10
-0+static inline struct drm_i915_gem_object * +create_region (struct intel_memory_region *mr,u64 size) +{ +struct drm_i915_gem_object *obj; + + obj =i915_gem_object_create_region (mr, size,0 ); +if (!IS_ERR (obj)) { +if (!i915_gem_object_type_has (obj, +I915_GEM_OBJECT_HAS_STRUCT_PAGE | +I915_GEM_OBJECT_HAS_IOMEM )) {
Can we not tell from the mr what properties we would end up with?
I would suggest calling it something like create_region_for_mapping() as I had to look around to see why the type_has() was justified.
Hmm. Perhaps better (more agnostic to the pin_map) would be to try and fail to create the map and squash the -ENODEV error there.
Quoted 45 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +45
-0+i915_gem_object_put (obj); +return ERR_PTR (-ENODEV ); + } + } + +return obj; +} + +static int wrap_ktime_compare (const void *A ,const void *B ) +{ +const ktime_t *a =A , *b =B ; + +return ktime_compare (*a, *b); +} + +int _perf_memcpy (struct intel_memory_region *src_mr, +struct intel_memory_region *dst_mr, +u64 size,u32 src_type,u32 dst_type) +{ +struct drm_i915_gem_object *src, *dst; +void *src_addr, *dst_addr; +ktime_t t[5 ]; +int pass; +int ret =0 ; + + src =create_region (src_mr, size); +if (IS_ERR (src)) { + ret =PTR_ERR (src); + goto out; + } + + src_addr =i915_gem_object_pin_map (src, src_type); +if (IS_ERR (src_addr)) { + ret =PTR_ERR (src_addr); + goto out_put_src; + } + + dst =create_region (dst_mr, size); +if (IS_ERR (dst)) { + ret =PTR_ERR (dst); + goto out_unpin_src; + } + + dst_addr =i915_gem_object_pin_map (dst, dst_type); +if (IS_ERR (dst_addr)) {
drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_lmem_write_cpu(void *arg) · line 652
Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +10
-0+ ret =PTR_ERR (dst_addr); + goto out_put_dst; + } + +for (pass =0 ; pass <ARRAY_SIZE (t); pass++) { +ktime_t t0, t1; + + t0 =ktime_get (); + +memcpy (dst_addr, src_addr, size);
Fwiw, different sizes of memcpy() may prove important, (memcpy32/memcpy64). As would memcpy_from_wc.
Quoted 53 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +53
-0+ + t1 =ktime_get (); + t[pass] =ktime_sub (t1, t0); + } + +sort (t,ARRAY_SIZE (t),sizeof (*t), wrap_ktime_compare,NULL ); +pr_info ("%s src(%s, %s) -> dst(%s, %s) memcpy %llu KiB copy: %lld MiB/s\n" , + __func__, + src_mr->name, +stringify_map_type (src_type), + dst_mr->name, +stringify_map_type (dst_type), + size >>10 , +div64_u64 (mul_u32_u32 (4 * size, +1000 *1000 *1000 ), + t[1 ] +2 * t[2 ] + t[3 ]) >>20 ); + +i915_gem_object_unpin_map (dst); +__i915_gem_object_put_pages (dst); +out_put_dst: +i915_gem_object_put (dst); +out_unpin_src: +i915_gem_object_unpin_map (src); +__i915_gem_object_put_pages (src); +out_put_src: +i915_gem_object_put (src); +out: +if (ret == -ENODEV || ret == -ENOMEM ) + ret =0 ; + +return ret; +} + +int perf_memcpy (void *arg) +{ +struct drm_i915_private *i915 = arg; +static const u32 types[] = { +I915_MAP_WB , +I915_MAP_WC , + }; +static const u32 sizes[] = { +SZ_4K , +SZ_64K , +SZ_2M , +SZ_64M , + }; +struct intel_memory_region *src_mr, *dst_mr; +int src_id, dst_id; +int i, j, k; +int ret; + +for_each_memory_region (src_mr, i915, src_id) { +for_each_memory_region (dst_mr, i915, dst_id) {
drivers/gpu/drm/i915/selftests/intel_memory_region.c static int igt_lmem_write_cpu(void *arg) · line 715
Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_memory_region.c +10
-0+for (i =0 ; i <ARRAY_SIZE (sizes); ++i) { +for (j =0 ; j <ARRAY_SIZE (types); ++j) { +for (k =0 ; k <ARRAY_SIZE (types); ++k) { + ret =_perf_memcpy (src_mr, + dst_mr, + sizes[i], + types[j], + types[k]); +if (ret) +return ret;
64M from wc could be quite slow. I might put a caveat here to stop measuring larger sizes if we exceed a time limit. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests/perf: measure memcpy bw between regions
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/i915/selftests/perf: measure memcpy bw between regions
URL : https://patchwork.freedesktop.org/series/72621/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip a5ec4dca083a drm/i915/selftests/perf: measure memcpy bw between regions -:175: WARNING:DEEP_INDENTATION: Too many leading tabs - consider code refactoring #175: FILE: drivers/gpu/drm/i915/selftests/intel_memory_region.c:714: + if (ret)
total: 0 errors, 1 warnings, 0 checks, 183 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/selftests/perf: measure memcpy bw between regions
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/i915/selftests/perf: measure memcpy bw between regions
URL : https://patchwork.freedesktop.org/series/72621/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.6.0 Commit: drm/i915/selftests/perf: measure memcpy bw between regions +drivers/gpu/drm/i915/selftests/intel_memory_region.c:613:5: warning: symbol '_perf_memcpy' was not declared. Should it be static? +drivers/gpu/drm/i915/selftests/intel_memory_region.c:686:5: warning: symbol 'perf_memcpy' was not declared. Should it be static?
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/selftests/perf: measure memcpy bw between regions
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/i915/selftests/perf: measure memcpy bw between regions
URL : https://patchwork.freedesktop.org/series/72621/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7827 -> Patchwork_16278
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_16278 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_16278, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_16278:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live_gem_contexts:
- fi-byt-j1900: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7827/fi-byt-j1900/igt@i915_selftest@live_gem_contexts.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/fi-byt-j1900/igt@i915_selftest@live_gem_contexts.html
Known issues
------------
Here are the changes found in Patchwork_16278 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_close_race@basic-threads:
- fi-byt-j1900: [PASS][3] -> [TIMEOUT][4] ([fdo#112271] / [i915#816])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7827/fi-byt-j1900/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/fi-byt-j1900/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][5] -> [FAIL][6] ([fdo#111407])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7827/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/fi-kbl-7500u/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live_blt:
- fi-hsw-4770: [DMESG-FAIL][7] ([i915#553] / [i915#725]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7827/fi-hsw-4770/igt@i915_selftest@live_blt.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/fi-hsw-4770/igt@i915_selftest@live_blt.html
* igt@i915_selftest@live_hangcheck:
- fi-icl-u3: [INCOMPLETE][9] ([fdo#108569] / [i915#140]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7827/fi-icl-u3/igt@i915_selftest@live_hangcheck.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/fi-icl-u3/igt@i915_selftest@live_hangcheck.html
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
[i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140
[i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816
Participating hosts (46 -> 43)
------------------------------
Additional (5): fi-bsw-n3050 fi-gdg-551 fi-cfl-8109u fi-ivb-3770 fi-skl-6600u
Missing (8): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-kbl-x1275 fi-kbl-7560u fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7827 -> Patchwork_16278
CI-20190529: 20190529
CI_DRM_7827: c8969aeacfff681c83a800e82b0f18a6ab3e77ea @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5389: 966c58649dee31bb5bf2fad92f75ffd365968b81 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16278: a5ec4dca083a83834ed122d8a96655ad4d05c205 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
a5ec4dca083a drm/i915/selftests/perf: measure memcpy bw between regions
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16278/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx