<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 6, 2015 at 7:01 PM, Tom Stellard <span dir="ltr"><<a href="mailto:thomas.stellard@amd.com" target="_blank">thomas.stellard@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This implementation was ported from the AMD builtin library<br>
and has been tested with piglit, OpenCV, and the ocl conformance tests.<br>
---<br>
 generic/include/clc/clc.h                  |  1 +<br>
 generic/include/clc/geometric/distance.h   | 22 ++++++++++++++++++++++<br>
 generic/include/clc/geometric/distance.inc | 23 +++++++++++++++++++++++<br>
 generic/lib/SOURCES                        |  1 +<br>
 generic/lib/geometric/<a href="http://distance.cl" target="_blank">distance.cl</a>          | 30 ++++++++++++++++++++++++++++++<br>
 generic/lib/geometric/distance.inc         | 25 +++++++++++++++++++++++++<br>
 6 files changed, 102 insertions(+)<br>
 create mode 100644 generic/include/clc/geometric/distance.inc<br>
 create mode 100644 generic/lib/geometric/<a href="http://distance.cl" target="_blank">distance.cl</a><br>
 create mode 100644 generic/lib/geometric/distance.inc<br>
<br>
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h<br>
index cee1614..2fb818a 100644<br>
--- a/generic/include/clc/clc.h<br>
+++ b/generic/include/clc/clc.h<br>
@@ -114,6 +114,7 @@<br>
<br>
 /* 6.11.5 Geometric Functions */<br>
 #include <clc/geometric/cross.h><br>
+#include <clc/geometric/distance.h><br>
 #include <clc/geometric/dot.h><br>
 #include <clc/geometric/length.h><br>
 #include <clc/geometric/normalize.h><br>
diff --git a/generic/include/clc/geometric/distance.h b/generic/include/clc/geometric/distance.h<br>
index 3e91332..c7aa6a1 100644<br>
--- a/generic/include/clc/geometric/distance.h<br>
+++ b/generic/include/clc/geometric/distance.h<br>
@@ -1,2 +1,24 @@<br>
+/*<br>
+ * Copyright (c) 2014,2015 Advanced Micro Devices, Inc.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>
+ * of this software and associated documentation files (the "Software"), to deal<br>
+ * in the Software without restriction, including without limitation the rights<br>
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>
+ * copies of the Software, and to permit persons to whom the Software is<br>
+ * furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included in<br>
+ * all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br>
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br>
+ * THE SOFTWARE.<br>
+ */<br>
+<br></blockquote><div><br></div>This patch looks good to me.<br><br></div><div class="gmail_quote">I don't see much point in retroactively adding the AMD copyright statement to distance.h since you're not modifying the file itself at this time (and Peter was the initial author), but while it seems weird, you are also included in the commit history for the file (adding __CLC_ prefix to the macro names).... so I guess it's not completely out of line.<br><br></div><div class="gmail_quote">But that being said, the functionality and code looks exactly like what I had written myself independently (other than chosen variable names).<br></div><div class="gmail_quote"><div><br></div><div>--Aaron<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 #define __CLC_BODY <clc/geometric/distance.inc><br>
 #include <clc/geometric/floatn.inc><br>
diff --git a/generic/include/clc/geometric/distance.inc b/generic/include/clc/geometric/distance.inc<br>
new file mode 100644<br>
index 0000000..6babbdc<br>
--- /dev/null<br>
+++ b/generic/include/clc/geometric/distance.inc<br>
@@ -0,0 +1,23 @@<br>
+/*<br>
+ * Copyright (c) 2014,2015 Advanced Micro Devices, Inc.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>
+ * of this software and associated documentation files (the "Software"), to deal<br>
+ * in the Software without restriction, including without limitation the rights<br>
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>
+ * copies of the Software, and to permit persons to whom the Software is<br>
+ * furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included in<br>
+ * all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br>
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br>
+ * THE SOFTWARE.<br>
+ */<br>
+<br>
+_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT distance(__CLC_FLOATN p0, __CLC_FLOATN p1);<br>
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES<br>
index ac3d870..9ac2c05 100644<br>
--- a/generic/lib/SOURCES<br>
+++ b/generic/lib/SOURCES<br>
@@ -33,6 +33,7 @@ common/<a href="http://sign.cl" target="_blank">sign.cl</a><br>
 common/<a href="http://smoothstep.cl" target="_blank">smoothstep.cl</a><br>
 common/<a href="http://step.cl" target="_blank">step.cl</a><br>
 geometric/<a href="http://cross.cl" target="_blank">cross.cl</a><br>
+geometric/<a href="http://distance.cl" target="_blank">distance.cl</a><br>
 geometric/<a href="http://dot.cl" target="_blank">dot.cl</a><br>
 geometric/<a href="http://length.cl" target="_blank">length.cl</a><br>
 geometric/<a href="http://normalize.cl" target="_blank">normalize.cl</a><br>
diff --git a/generic/lib/geometric/<a href="http://distance.cl" target="_blank">distance.cl</a> b/generic/lib/geometric/<a href="http://distance.cl" target="_blank">distance.cl</a><br>
new file mode 100644<br>
index 0000000..4a5b8e2<br>
--- /dev/null<br>
+++ b/generic/lib/geometric/<a href="http://distance.cl" target="_blank">distance.cl</a><br>
@@ -0,0 +1,30 @@<br>
+/*<br>
+ * Copyright (c) 2014,2015 Advanced Micro Devices, Inc.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>
+ * of this software and associated documentation files (the "Software"), to deal<br>
+ * in the Software without restriction, including without limitation the rights<br>
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>
+ * copies of the Software, and to permit persons to whom the Software is<br>
+ * furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included in<br>
+ * all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br>
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br>
+ * THE SOFTWARE.<br>
+ */<br>
+<br>
+#include <clc/clc.h><br>
+<br>
+#ifdef cl_khr_fp64<br>
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable<br>
+#endif<br>
+<br>
+#define __CLC_BODY <distance.inc><br>
+#include <clc/geometric/floatn.inc><br>
diff --git a/generic/lib/geometric/distance.inc b/generic/lib/geometric/distance.inc<br>
new file mode 100644<br>
index 0000000..193665e<br>
--- /dev/null<br>
+++ b/generic/lib/geometric/distance.inc<br>
@@ -0,0 +1,25 @@<br>
+/*<br>
+ * Copyright (c) 2014,2015 Advanced Micro Devices, Inc.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>
+ * of this software and associated documentation files (the "Software"), to deal<br>
+ * in the Software without restriction, including without limitation the rights<br>
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>
+ * copies of the Software, and to permit persons to whom the Software is<br>
+ * furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included in<br>
+ * all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br>
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br>
+ * THE SOFTWARE.<br>
+ */<br>
+<br>
+_CLC_OVERLOAD _CLC_DEF __CLC_FLOAT distance(__CLC_FLOATN p0, __CLC_FLOATN p1) {<br>
+  return length(p0 - p1);<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.4<br>
<br>
<br>
_______________________________________________<br>
Libclc-dev mailing list<br>
<a href="mailto:Libclc-dev@pcc.me.uk">Libclc-dev@pcc.me.uk</a><br>
<a href="http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev" target="_blank">http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev</a><br>
</font></span></blockquote></div><br></div></div>