KHR_fp16
WebCL working group (public_webcl 'at' khronos.org)
Tomi Aarnio, Nokia Research
Mikael Bourges-Sevenier, Advanced Micro Devices
Steven Eliuk, Samsung Electronics
Tasneem Brutch, Samsung Electronics
Members of the WebCL working group
Last modified date: August 14, 2014
Revision: 2
WebCL extension #2
Written against the WebCL API 1.0 specification.
This extension exposes the cl_khr_fp16 functionality to WebCL.
There are no WebCL-specific behavioral changes.
Consult the above extension for documentation, issues and new functions and enumerants.
When this extension is enabled:
#pragma OPENCL EXTENSION
cl_khr_fp16 : enable
.
halfN
datatypes can be used in WebCL
kernel code.
partial interface WebCL { CLenum DEVICE_PREFERRED_VECTOR_WIDTH_HALF = 0x1034; CLenum DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0x103C; };
// Enables KHR_fp16 on all devices that support it, and // returns those devices in an array. If there are no // such devices, an empty array is returned. function getFP16Devices() { var devices = []; webcl.getPlatforms().forEach(function(plat) { plat.getDevices().forEach(function(dev) { var isSupported = dev.enableExtension("KHR_fp16"); if (isSupported) devices.push(dev); }); }); if (devices.length === 0) { console.error("Your system does not support KHR_fp16."); } else { console.info("Enabled KHR_fp16 on "+devices.length+" devices."); console.info("Make sure to include '#pragma OPENCL EXTENSION cl_khr_fp16 : enable' in your kernel code."); } return devices; }
Revision 1, 2013/11/19
Revision 2, 2014/08/14