From ba2defcdef8f1c23ce2740bcc48722e8968391fc Mon Sep 17 00:00:00 2001 From: George Hotz Date: Tue, 21 Jun 2022 23:54:09 -0700 Subject: [PATCH] elif False --- accel/opencl/ops_opencl.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/accel/opencl/ops_opencl.py b/accel/opencl/ops_opencl.py index 2b6e08e160..8e8a51640d 100644 --- a/accel/opencl/ops_opencl.py +++ b/accel/opencl/ops_opencl.py @@ -128,6 +128,13 @@ class OpenCLBuffer(GPUBuffer): ewtypes.append(f"__global const float4 *{name}_g") getters.append(f"inline float4 get4_{name}(__global const float4 *x, const sampler_t smp, int2 loc, int gid) {{"+ f"return x[gid/4]; }}") + elif False: + # use float4 indexed (HACK!) + # TODO: work out when this is okay + ewtypes.append(f"__global const float4 *{name}_g") + getters.append(f"inline float4 get4_{name}(__global const float4 *x, const sampler_t smp, int2 loc, int gid) {{"+ + "int valid = 1; int idx = gid;"+buf.st.expr()+";"+ + f"return x[idx/4]; }}") else: # fallback to float ewtypes.append(f"__global const float *{name}_g")