[Beignet] [PATCH] runtime: Need to separate atomic in L3 test and SLM test in self_test().

Zhigang Gong zhigang.gong at intel.com
Sun Jul 12 17:39:26 PDT 2015


On HSW, if we use default 4.0.x kernel without the i915.enable_ppgtt=2
boot argument, then the atomic in L3 will not work and the SLM will not
work neither. We need to test atomic in L3 firstly, if it fails we need
to test SLM again. Otherwise, beignet will not give any error/warning
information for both atomic in L3 and SLM not working case.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 src/cl_device_id.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index f995550..b788137 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -560,7 +560,7 @@ skl_gt4_break:
  * SELF_TEST_ATOMIC_FAIL: for hsw enqueue  kernel failure to not enable atomics in L3.
  * SELF_TEST_OTHER_FAIL: other fail like runtime API fail.*/
 LOCAL cl_self_test_res
-cl_self_test(cl_device_id device)
+cl_self_test(cl_device_id device, uint32_t atomic_in_l3_flag)
 {
   cl_int status;
   cl_context ctx;
@@ -583,6 +583,7 @@ cl_self_test(cl_device_id device)
     return ret;
   tested = 1;
   ctx = clCreateContext(NULL, 1, &device, NULL, NULL, &status);
+  cl_driver_set_atomic_flag(ctx->drv, atomic_in_l3_flag);
   if (status == CL_SUCCESS) {
     queue = clCreateCommandQueue(ctx, device, 0, &status);
     if (status == CL_SUCCESS) {
@@ -607,10 +608,13 @@ cl_self_test(cl_device_id device)
                       printf("Beignet: self-test failed: (3, 7, 5) + (5, 7, 3) returned (%i, %i, %i)\n"
                              "See README.md or http://www.freedesktop.org/wiki/Software/Beignet/\n",
                              test_data[0], test_data[1], test_data[2]);
+
                     }
                   }
                 } else{
                   ret = SELF_TEST_ATOMIC_FAIL;
+                  // Atomic fail need to test SLM again with atomic in L3 feature disabled.
+                  tested = 0;
                 }
               }
             }
@@ -639,8 +643,13 @@ cl_get_device_ids(cl_platform_id    platform,
   /* Do we have a usable device? */
   device = cl_get_gt_device();
   if (device) {
-    cl_self_test_res ret = cl_self_test(device);
-    device->atomic_test_result = ret;
+    cl_self_test_res ret = cl_self_test(device, 0);
+    if (ret == SELF_TEST_ATOMIC_FAIL) {
+      ret = cl_self_test(device, ret);
+      device->atomic_test_result = ret;
+      printf("Beignet: warning - disable atomic in L3 feature.\n");
+    }
+
     if(ret == SELF_TEST_SLM_FAIL) {
       int disable_self_test = 0;
       // can't use BVAR (backend/src/sys/cvar.hpp) here as it's C++
-- 
1.9.1



More information about the Beignet mailing list