From 314d70ff17c785999aaf5b4953fc019be893e630 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Tue, 19 Jul 2022 19:17:47 -0700 Subject: [PATCH] zero out the buffer --- openpilot/compile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openpilot/compile.py b/openpilot/compile.py index ea1503ae8a..b5052ff2d6 100644 --- a/openpilot/compile.py +++ b/openpilot/compile.py @@ -232,6 +232,11 @@ def compile(input, output_fn): row_pitch = (a.shape[0]*4*2 + 63)//64 * 64 size = row_pitch * a.shape[1] buf = CLBuffer(size) + + # zero out the buffer + zeros = np.zeros(size, dtype=np.uint8) + CL.enqueue_copy(buf.cl, zeros, is_blocking=True) + CLProgram("from_image_strided", """ __kernel void from_image_strided(read_only image2d_t in, __global float4 *out, int row_pitch) { const sampler_t smp = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;