[PATCH 136/144] skip subdevice tests on devices with only 1 compute unit
authorAndreas Beckmann <anbe@debian.org>
Wed, 24 Nov 2021 09:46:50 +0000 (10:46 +0100)
committerAndreas Beckmann <anbe@debian.org>
Fri, 7 Jan 2022 23:55:22 +0000 (23:55 +0000)
do not let them fail

Gbp-Pq: Name 0136-skip-subdevice-tests-on-devices-with-only-1-compute-.patch

examples/EinsteinToolkit/CMakeLists.txt
examples/EinsteinToolkit/EinsteinToolkit.c
tests/runtime/CMakeLists.txt
tests/runtime/test_clCreateSubDevices.c

index 704a02e7f5043434506d95ae877585ccabf0f486..139d1c61c23ad54cd7d7e0a9fe14ca907a30dcab 100644 (file)
@@ -54,5 +54,6 @@ if(NOT MIPS)
     COST 15.0
     LABELS "EinsteinToolkit"
     ENVIRONMENT "POCL_AFFINITY=1"
+    SKIP_RETURN_CODE 77
     DEPENDS "pocl_version_check")
 endif()
index 1c8a2ba1aa3eba94c7498134da699188e7cfdb74..85418cd3853b79dec5d88bcc4ed344930633664a 100644 (file)
@@ -528,6 +528,18 @@ void setup(const char* program_source1, const char* program_source2)
 
   if (use_subdev)
     {
+      {
+        cl_uint max_cus;
+        int err = clGetDeviceInfo (main_device_id, CL_DEVICE_MAX_COMPUTE_UNITS,
+                                   sizeof (max_cus), &max_cus, NULL);
+        assert (err == CL_SUCCESS);
+        if (max_cus < 2)
+          {
+            fprintf (stderr,
+                     "Insufficient compute units for subdevice creation\n");
+            exit (77);
+          }
+      }
       const cl_device_partition_property props[]
           = { CL_DEVICE_PARTITION_EQUALLY, 2, 0 };
       cl_device_id subdevs[128];
index b620d85c4b5df81758232a1c5e7e6e984fa87ce0..dc198bdfac8bec0998780c732fbd0e4ab9b6abe0 100644 (file)
@@ -96,7 +96,7 @@ add_test_pocl(NAME "runtime/clGetSupportedImageFormats" COMMAND "test_clGetSuppo
 
 add_test_pocl(NAME "runtime/clCreateKernelsInProgram" COMMAND "test_clCreateKernelsInProgram")
 
-add_test_pocl(NAME "runtime/clCreateSubDevices" COMMAND  "test_clCreateSubDevices")
+add_test(NAME "runtime/clCreateSubDevices" COMMAND  "test_clCreateSubDevices")
 
 add_test_pocl(NAME "runtime/test_event_free" COMMAND  "test_event_free")
 
@@ -136,6 +136,7 @@ set_tests_properties( "runtime/clGetDeviceInfo" "runtime/clEnqueueNativeKernel"
     LABELS "internal;runtime")
 
 set_tests_properties(
+  "runtime/clCreateSubDevices"
   "runtime/test_buffer_migration"
   "runtime/test_buffer_ping_pong"
   "runtime/test_cl_pocl_content_size"
index fa5922e8acab76cc5c15096681a0c755d90f37a6..01c2aa49d395ce518bacec22bd8aff0db421d02b 100644 (file)
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
     {
       printf("This test requires a cl device with at least 2 compute units"
              " (a dual-core or better CPU)\n");
-      return 1;
+      return 77;
     }
 
   err = clGetDeviceInfo(rootdev, CL_DEVICE_PARTITION_MAX_SUB_DEVICES,