[Piglit] [PATCH] builtin_function: try and use casts for 64-bits instead of dtype setting.

Dave Airlie airlied at gmail.com
Mon Jul 4 06:20:03 UTC 2016


From: Dave Airlie <airlied at redhat.com>

The dtype setting only works with numpy 1.9 and above, which doesn't
seem to be in most distros yet.

Reported-by: Jose Fonseca <jfonseca at vmware.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 generated_tests/builtin_function.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
index a886dbd..689a805 100644
--- a/generated_tests/builtin_function.py
+++ b/generated_tests/builtin_function.py
@@ -957,28 +957,28 @@ def _make_componentwise_test_vectors(test_suite_dict):
       [np.linspace(-1.9, 1.9, 4), np.linspace(-1.9, 1.9, 4),
        np.linspace(-2.0, 2.0, 4)])
 
-    f('abs', 1, 150, np.abs, None, [np.linspace(-10, 15, 5, dtype=np.dtype(np.int64))],
+    f('abs', 1, 150, np.abs, None, [np.linspace(-10, 15, 54).astype(np.int64)],
       extension="ARB_gpu_shader_int64")
-    f('sign', 1, 150, np.sign, None, [np.linspace(-15, 15, 5, dtype=np.dtype(np.int64))],
+    f('sign', 1, 150, np.sign, None, [np.linspace(-15, 15, 5).astype(np.int64)],
       extension="ARB_gpu_shader_int64")
     f('min', 2, 150, min, [1],
-      [np.linspace(-20, 20, 4, dtype=np.dtype(np.int64)), np.linspace(-20, 20, 4, dtype=np.dtype(np.int64))],
+      [np.linspace(-20, 20, 4).astype(np.int64), np.linspace(-20, 20, 4).astype(np.int64)],
       extension="ARB_gpu_shader_int64")
     f('min', 2, 150, min, [1],
-      [np.linspace(20, 90, 4, dtype=np.dtype(np.uint64)), np.linspace(20, 90, 4, dtype=np.dtype(np.uint64))],
+      [np.linspace(20, 90, 4).astype(np.uint64), np.linspace(20, 90, 4).astype(np.uint64)],
       extension="ARB_gpu_shader_int64")
     f('max', 2, 150, max, [1],
-      [np.linspace(-20, 20, 4, dtype=np.dtype(np.int64)), np.linspace(-20, 20, 4, dtype=np.dtype(np.int64))],
+      [np.linspace(-20, 20, 4).astype(np.int64), np.linspace(-20, 20, 4).astype(np.int64)],
       extension="ARB_gpu_shader_int64")
     f('max', 2, 150, max, [1],
-      [np.linspace(20, 90, 4, dtype=np.dtype(np.uint64)), np.linspace(20, 90, 4, dtype=np.dtype(np.uint64))],
+      [np.linspace(20, 90, 4).astype(np.uint64), np.linspace(20, 90, 4).astype(np.uint64)],
       extension="ARB_gpu_shader_int64")
-    f('clamp', 3, 150, _clamp, [1, 2], [np.linspace(-20, 20, 4, dtype=np.dtype(np.int64)),
-                                   np.linspace(-15, 15, 3, dtype=np.dtype(np.int64)),
-                                   np.linspace(-15, 15, 3, dtype=np.dtype(np.int64))],
+    f('clamp', 3, 150, _clamp, [1, 2], [np.linspace(-20, 20, 4).astype(np.int64),
+                                   np.linspace(-15, 15, 3).astype(np.int64),
+                                   np.linspace(-15, 15, 3).astype(np.int64)],
       extension="ARB_gpu_shader_int64")
     f('mix', 3, 150, lambda x, y, a: y if a else x, None,
-      [np.linspace(-20, 20, 2, dtype=np.dtype(np.int64)), np.linspace(-30, 30, 2, dtype=np.dtype(np.int64)), bools],
+      [np.linspace(-20, 20, 2).astype(np.int64), np.linspace(-30, 30, 2).astype(np.int64), bools],
       extension="ARB_gpu_shader_int64")
 _make_componentwise_test_vectors(test_suite)
 
-- 
2.5.5



More information about the Piglit mailing list