openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
536 B

# ugh, OS X OpenCL doesn't support half
from tinygrad.runtime.ops_gpu import CLDevice, CLProgram, CLCompiler
src = """#pragma OPENCL EXTENSION cl_khr_fp16 : enable
__kernel void max_half(__global half* data0, const __global half* data1) {
int gidx0 = get_group_id(0);
data0[gidx0] = max(data1[gidx0], (half)0.0);
}"""
if __name__ == "__main__":
dev = CLDevice()
print("created device")
lib = CLCompiler(dev, "test").compile(src)
print("created lib", len(lib))
prg = CLProgram(dev, "max_half", lib)
print("created prg")