tests/i915/gem_spin_batch: Update with engine discovery
PATCH 1/1 tests/i915/gem_spin_batch: Update with engine discovery
Legacy execbuf abi tests are prefixed with legacy. New test are added to run on physical engines accessed through engine discovery.
So legacy tests run on the unconfigured (with engine map) context and use a new helper gem_eb_flags_to_engine to look up the engine from the intel_execution_engines2 static list. This is only to enable the core test code to be shared.
Places where new contexts are created had to be updated to either equally configure the contexts or not.
--- tests/i915/gem_spin_batch.c | 71 +++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 23 deletions(-)
tests/i915/gem_spin_batch.c +48 -23
@@ -32,7 +32,8 @@ "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\#x , #ref, (long long)x, tolerance, (long long)ref) -static void spin (int fd,unsigned int engine,unsigned int timeout_sec) +static void spin (int fd,const struct intel_execution_engine2 *e2, +unsigned int timeout_sec) {const uint64_t timeout_100ms =100000000LL ;unsigned long loops =0 ;
@@ -41,9 +42,9 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)struct timespec itv = { };uint64_t elapsed; - spin = __igt_spin_new(fd, .engine = engine); + spin = __igt_spin_new(fd, .engine = e2->flags);while ((elapsed =igt_nsec_elapsed (&tv)) >>30 < timeout_sec) { - igt_spin_t *next = __igt_spin_new(fd, .engine = engine); + igt_spin_t *next = __igt_spin_new(fd, .engine = e2->flags);igt_spin_set_timeout (spin, timeout_100ms -igt_nsec_elapsed (&itv));
@@ -69,13 +70,14 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)#define RESUBMIT_NEW_CTX (1 << 0)#define RESUBMIT_ALL_ENGINES (1 << 1) -static void spin_resubmit (int fd,unsigned int engine,unsigned int flags) +static void spin_resubmit (int fd,const struct intel_execution_engine2 *e2, +unsigned int flags) {const uint32_t ctx0 =gem_context_create (fd);const uint32_t ctx1 = (flags &RESUBMIT_NEW_CTX ) ?gem_context_create (fd) : ctx0; - igt_spin_t *spin = __igt_spin_new(fd, .ctx = ctx0, .engine = engine); -unsigned int other; + igt_spin_t *spin = __igt_spin_new(fd, .ctx = ctx0, .engine = e2->flags); +const struct intel_execution_engine2 *other;struct drm_i915_gem_execbuffer2 eb = { .buffer_count =1 ,
@@ -83,16 +85,23 @@ static void spin_resubmit(int fd, unsigned int engine, unsigned int flags) .rsvd1 = ctx1, }; +igt_assert (gem_context_has_engine_map (fd,0 ) || + !(flags &RESUBMIT_ALL_ENGINES )); +if (flags &RESUBMIT_ALL_ENGINES ) { -for_each_physical_engine (fd, other) { -if (other == engine) +gem_context_set_all_engines (fd, ctx0); +if (ctx0 != ctx1) +gem_context_set_all_engines (fd, ctx1); + +for_each_context_engine (fd, ctx1, other) { +if (other->flags == e2->flags)continue ; - eb.flags = other; + eb.flags = other->flags;gem_execbuf (fd, &eb); } }else { - eb.flags = engine; + eb.flags = e2->flags;gem_execbuf (fd, &eb); }
@@ -115,12 +124,12 @@ static void spin_exit_handler(int sig)static void spin_on_all_engines (int fd,unsigned int timeout_sec) { -unsigned engine; +const struct intel_execution_engine2 *e2; -for_each_physical_engine (fd, engine) { +__for_each_physical_engine (fd, e2) { igt_fork(child, 1) {igt_install_exit_handler (spin_exit_handler); -spin (fd, engine, timeout_sec); +spin (fd, e2, timeout_sec); } }
@@ -129,6 +138,7 @@ static void spin_on_all_engines(int fd, unsigned int timeout_sec) igt_main { +const struct intel_execution_engine2 *e2;const struct intel_execution_engine *e;int fd =-1 ;
@@ -141,20 +151,35 @@ igt_main }for (e = intel_execution_engines; e->name; e++) { - igt_subtest_f("basic-%s", e->name) -spin (fd, e->exec_id,3 ); + e2 =gem_eb_flags_to_engine (e->exec_id | e->flags); +if (!e2) +continue ; + + igt_subtest_f("legacy-%s", e->name) +spin (fd, e2,3 ); + + igt_subtest_f("legacy-resubmit-%s", e->name) +spin_resubmit (fd, e2,0 ); + + igt_subtest_f("legacy-resubmit-new-%s", e->name) +spin_resubmit (fd, e2,RESUBMIT_NEW_CTX ); + } + +__for_each_physical_engine (fd, e2) { + igt_subtest_f("%s", e2->name) +spin (fd, e2,3 ); - igt_subtest_f("resubmit-%s", e->name) -spin_resubmit (fd, e->exec_id,0 ); + igt_subtest_f("resubmit-%s", e2->name) +spin_resubmit (fd, e2,0 ); - igt_subtest_f("resubmit-new-%s", e->name) -spin_resubmit (fd, e->exec_id,RESUBMIT_NEW_CTX ); + igt_subtest_f("resubmit-new-%s", e2->name) +spin_resubmit (fd, e2,RESUBMIT_NEW_CTX ); - igt_subtest_f("resubmit-all-%s", e->name) -spin_resubmit (fd, e->exec_id,RESUBMIT_ALL_ENGINES ); + igt_subtest_f("resubmit-all-%s", e2->name) +spin_resubmit (fd, e2,RESUBMIT_ALL_ENGINES ); - igt_subtest_f("resubmit-new-all-%s", e->name) -spin_resubmit (fd, e->exec_id, + igt_subtest_f("resubmit-new-all-%s", e2->name) +spin_resubmit (fd, e2,RESUBMIT_NEW_CTX |RESUBMIT_ALL_ENGINES ); }
Signature · 6 lines
2.19.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for tests/i915/gem_spin_batch: Update with engine discovery
== Series Details ==
== Series Details ==
Series: tests/i915/gem_spin_batch: Update with engine discovery
URL : https://patchwork.freedesktop.org/series/63087/
State : failure
== Summary ==
IGT patchset build failed on latest successful build 873df2fa9e8f5fd02d4532b30ef2579f4fe4f27f i915: Fix gem_context_has_engine_map() for older kernels
[311/484] Linking target tests/gem_exec_whisper.
[312/484] Linking target tests/gem_fd_exhaustion.
[313/484] Linking target tests/gem_fence_upload.
[314/484] Linking target tests/gem_fenced_exec_thrash.
[315/484] Linking target tests/gem_gtt_cpu_tlb.
[316/484] Linking target tests/gem_flink_race.
[317/484] Linking target tests/gem_flink_basic.
[318/484] Linking target tests/gem_gpgpu_fill.
[319/484] Linking target tests/gem_gtt_hog.
[320/484] Linking target tests/gem_gtt_speed.
[321/484] Linking target tests/gem_largeobject.
[322/484] Linking target tests/gem_madvise.
[323/484] Linking target tests/gem_lut_handle.
[324/484] Linking target tests/gem_linear_blits.
[325/484] Linking target tests/gem_media_fill.
[326/484] Linking target tests/gem_media_vme.
[327/484] Linking target tests/gem_mmap_wc.
[328/484] Linking target tests/gem_mmap_gtt.
[329/484] Linking target tests/gem_mmap_offset_exhaustion.
[330/484] Linking target tests/gem_ppgtt.
[331/484] Linking target tests/gem_persistent_relocs.
[332/484] Linking target tests/gem_partial_pwrite_pread.
[333/484] Linking target tests/gem_pipe_control_store_loop.
[334/484] Linking target tests/gem_pread.
[335/484] Linking target tests/gem_pwrite.
[336/484] Linking target tests/gem_pread_after_blit.
[337/484] Linking target tests/gem_pwrite_pread.
[338/484] Linking target tests/gem_pwrite_snooped.
[339/484] Linking target tests/gem_reloc_vs_gpu.
[340/484] Linking target tests/gem_read_read_speed.
[341/484] Linking target tests/gem_readwrite.
[342/484] Linking target tests/gem_reg_read.
[343/484] Linking target tests/gem_reloc_overflow.
[344/484] Linking target tests/gem_render_linear_blits.
[345/484] Linking target tests/gem_render_copy.
[346/484] Linking target tests/gem_render_copy_redux.
[347/484] Linking target tests/gem_render_tiled_blits.
[348/484] Linking target tests/gem_reset_stats.
[349/484] Linking target tests/gem_request_retire.
[350/484] Linking target tests/gem_ring_sync_copy.
[351/484] Linking target tests/gem_ring_sync_loop.
[352/484] Linking target tests/gem_set_tiling_vs_blt.
[353/484] Compiling C object 'tests/tests@@gem_spin_batch@exe/i915_gem_spin_batch.c.o'.
FAILED: tests/tests@@gem_spin_batch@exe/i915_gem_spin_batch.c.o
ccache cc -Itests/tests@@gem_spin_batch@exe -Itests -I../tests -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/igt/include -I/opt/igt/include/libdrm -I/usr/include/x86_64-linux-gnu -I/usr/include/alsa -I/usr/include -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread -MD -MQ 'tests/tests@@gem_spin_batch@exe/i915_gem_spin_batch.c.o' -MF 'tests/tests@@gem_spin_batch@exe/i915_gem_spin_batch.c.o.d' -o 'tests/tests@@gem_spin_batch@exe/i915_gem_spin_batch.c.o' -c ../tests/i915/gem_spin_batch.c ../tests/i915/gem_spin_batch.c: In function ‘__real_main139’:../tests/i915/gem_spin_batch.c:154:6: error: incompatible types when assigning to type ‘const struct intel_execution_engine2 *’ from type ‘struct intel_execution_engine2’
e2 = gem_eb_flags_to_engine(e->exec_id | e->flags);
^ninja: build stopped: subcommand failed.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ GitLab.Pipeline: warning for tests/i915/gem_spin_batch: Update with engine discovery
In reply to Ramalingam C== Series Details ==
== Series Details ==
Series: tests/i915/gem_spin_batch: Update with engine discovery
URL : https://patchwork.freedesktop.org/series/63087/
State : warning
== Summary ==
Pipeline status: FAILED.
See https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/46160 for more details.
== Logs ==
For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/46160
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 67 lines · Ramalingam C
Legacy execbuf abi tests are prefixed with legacy. New test are added to run on physical engines accessed through engine discovery.
So legacy tests run on the unconfigured (with engine map) context and use a new helper
gem_eb_flags_to_engineto look up the engine from theintel_execution_engines2static list. This is only to enable the core test code to be shared.Places where new contexts are created had to be updated to either equally configure the contexts or not.
Signed-off-by Ramalingam C <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>--- tests/i915/gem_spin_batch.c | 71 +++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 23 deletions(-)tests/i915/gem_spin_batch.c +10
-6@@ -32,7 +32,8 @@ "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\#x , #ref, (long long)x, tolerance, (long long)ref) -static void spin (int fd,unsigned int engine,unsigned int timeout_sec) +static void spin (int fd,const struct intel_execution_engine2 *e2, +unsigned int timeout_sec) {const uint64_t timeout_100ms =100000000LL ;unsigned long loops =0 ;@@ -41,9 +42,9 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)struct timespec itv = { };uint64_t elapsed; - spin = __igt_spin_new(fd, .engine = engine); + spin = __igt_spin_new(fd, .engine = e2->flags);while ((elapsed =igt_nsec_elapsed (&tv)) >>30 < timeout_sec) { - igt_spin_t *next = __igt_spin_new(fd, .engine = engine); + igt_spin_t *next = __igt_spin_new(fd, .engine = e2->flags);igt_spin_set_timeout (spin, timeout_100ms -igt_nsec_elapsed (&itv));@@ -69,13 +70,14 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)#define RESUBMIT_NEW_CTX (1 << 0)#define RESUBMIT_ALL_ENGINES (1 << 1) -static void spin_resubmit (int fd,unsigned int engine,unsigned int flags) +static void spin_resubmit (int fd,const struct intel_execution_engine2 *e2, +unsigned int flags) {const uint32_t ctx0 =gem_context_create (fd);const uint32_t ctx1 = (flags &RESUBMIT_NEW_CTX ) ?gem_context_create (fd) : ctx0; - igt_spin_t *spin = __igt_spin_new(fd, .ctx = ctx0, .engine = engine); -unsigned int other; + igt_spin_t *spin = __igt_spin_new(fd, .ctx = ctx0, .engine = e2->flags); +const struct intel_execution_engine2 *other;struct drm_i915_gem_execbuffer2 eb = { .buffer_count =1 ,@@ -83,16 +85,23 @@ static void spin_resubmit(int fd, unsigned int engine, unsigned int flags) .rsvd1 = ctx1, }; +igt_assert (gem_context_has_engine_map (fd,0 ) || + !(flags &RESUBMIT_ALL_ENGINES ));
tests/i915/gem_spin_batch.c static void spin_resubmit(int fd, unsigned int engine, unsigned int flags) · line 97
Quoted 10 lines
tests/i915/gem_spin_batch.c +7
-2+if (flags &RESUBMIT_ALL_ENGINES ) { -for_each_physical_engine (fd, other) { -if (other == engine) +gem_context_set_all_engines (fd, ctx0); +if (ctx0 != ctx1) +gem_context_set_all_engines (fd, ctx1); + +for_each_context_engine (fd, ctx1, other) { +if (other->flags == e2->flags)
Make this comparison based on class:instance please. If there are enough call sites consider a helper like gem_is_engine_equal?
Quoted 37 lines
tests/i915/gem_spin_batch.c +6
-5continue ; - eb.flags = other; + eb.flags = other->flags;gem_execbuf (fd, &eb); } }else { - eb.flags = engine; + eb.flags = e2->flags;gem_execbuf (fd, &eb); }@@ -115,12 +124,12 @@ static void spin_exit_handler(int sig)static void spin_on_all_engines (int fd,unsigned int timeout_sec) { -unsigned engine; +const struct intel_execution_engine2 *e2; -for_each_physical_engine (fd, engine) { +__for_each_physical_engine (fd, e2) { igt_fork(child, 1) {igt_install_exit_handler (spin_exit_handler); -spin (fd, engine, timeout_sec); +spin (fd, e2, timeout_sec); } }@@ -129,6 +138,7 @@ static void spin_on_all_engines(int fd, unsigned int timeout_sec) igt_main { +const struct intel_execution_engine2 *e2;const struct intel_execution_engine *e;int fd =-1 ;
tests/i915/gem_spin_batch.c igt_main · line 156
Quoted 8 lines
tests/i915/gem_spin_batch.c +3
-2@@ -141,20 +151,35 @@ igt_main }for (e = intel_execution_engines; e->name; e++) { - igt_subtest_f("basic-%s", e->name) -spin (fd, e->exec_id,3 ); + e2 =gem_eb_flags_to_engine (e->exec_id | e->flags); +if (!e2) +continue ;
And rebase to catch up with my fix which changes this helper to return the object, not the pointer. Skip condition is then e2.flags == -1.
Quoted 28 lines
tests/i915/gem_spin_batch.c +18
-6+ + igt_subtest_f("legacy-%s", e->name) +spin (fd, e2,3 ); + + igt_subtest_f("legacy-resubmit-%s", e->name) +spin_resubmit (fd, e2,0 ); + + igt_subtest_f("legacy-resubmit-new-%s", e->name) +spin_resubmit (fd, e2,RESUBMIT_NEW_CTX ); + } + +__for_each_physical_engine (fd, e2) { + igt_subtest_f("%s", e2->name) +spin (fd, e2,3 ); - igt_subtest_f("resubmit-%s", e->name) -spin_resubmit (fd, e->exec_id,0 ); + igt_subtest_f("resubmit-%s", e2->name) +spin_resubmit (fd, e2,0 ); - igt_subtest_f("resubmit-new-%s", e->name) -spin_resubmit (fd, e->exec_id,RESUBMIT_NEW_CTX ); + igt_subtest_f("resubmit-new-%s", e2->name) +spin_resubmit (fd, e2,RESUBMIT_NEW_CTX ); - igt_subtest_f("resubmit-all-%s", e->name) -spin_resubmit (fd, e->exec_id,RESUBMIT_ALL_ENGINES );
tests/i915/gem_spin_batch.c igt_main · line 185
Quoted 10 lines
tests/i915/gem_spin_batch.c +4
-2+ igt_subtest_f("resubmit-all-%s", e2->name) +spin_resubmit (fd, e2,RESUBMIT_ALL_ENGINES ); - igt_subtest_f("resubmit-new-all-%s", e->name) -spin_resubmit (fd, e->exec_id, + igt_subtest_f("resubmit-new-all-%s", e2->name) +spin_resubmit (fd, e2,RESUBMIT_NEW_CTX |RESUBMIT_ALL_ENGINES ); }
The rest is I think okay.
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev