carrot/tinygrad_repo/test/external/external_cl_half_max.py
Vehicle Researcher 8eb8330d95 openpilot v0.9.9 release
date: 2025-03-08T09:09:29
master commit: ce355250be726f9bc8f0ac165a6cde41586a983d
2025-03-08 09:09:31 +00:00

14 lines
370 B
Python

from tinygrad.runtime.ops_gpu import CLDevice, CLProgram, compile_cl
if __name__ == "__main__":
dev = CLDevice()
lib = compile_cl("""
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
__kernel void test(__global half *out, __global half *a, __global half *b) {
int gid = get_global_id(0);
out[gid] = max(a[gid], b[gid]);
}
""")
prg = CLProgram(dev, "test", lib)