All of lore.kernel.org
 help / color / mirror / Atom feed
* [thud/ti2019.01][PATCH] ocl: fix g++8.3 opencl-examples undefined behavior
@ 2019-06-24 19:07 Yuan Zhao
  2019-06-24 20:55 ` Denys Dmytriyenko
  0 siblings, 1 reply; 3+ messages in thread
From: Yuan Zhao @ 2019-06-24 19:07 UTC (permalink / raw)
  To: meta-arago

Signed-off-by: Yuan Zhao <yuanzhao@ti.com>
---
 ...g-8.3.0-OpenCL-example-undefined-behavior.patch | 68 ++++++++++++++++++++++
 .../recipes-ti/ocl/opencl-examples_git.bb          |  6 +-
 2 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch

diff --git a/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch b/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
new file mode 100644
index 00000000..b2c40c84
--- /dev/null
+++ b/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
@@ -0,0 +1,68 @@
+From 7cf77b704544b6012105f7ed19807b798b6cb242 Mon Sep 17 00:00:00 2001
+From: Yuan Zhao <yuanzhao@ti.com>
+Date: Mon, 24 Jun 2019 13:24:11 -0500
+Subject: [PATCH] Fix g++ 8.3.0 OpenCL example undefined behavior
+
+- Fix undefined behavior of non-void functions with no return statements,
+  when using g++ 8.3.0.  Change them to void functions.
+
+Upstream-Status: Submitted [Remove this patch when next release is out]
+
+Signed-off-by: Yuan Zhao <yuanzhao@ti.com>
+---
+ examples/persistent_common/host_assist.cpp | 2 +-
+ examples/persistent_common/host_assist.h   | 2 +-
+ examples/sgemm/main.cpp                    | 4 ++--
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/examples/persistent_common/host_assist.cpp b/examples/persistent_common/host_assist.cpp
+index f1640bc..fd8bb18 100644
+--- a/examples/persistent_common/host_assist.cpp
++++ b/examples/persistent_common/host_assist.cpp
+@@ -34,7 +34,7 @@ void print_completion_code(uint32_t completion_code)
+ /******************************************************************************
+ * Given an OpenCL Device, Abort if the device is not part of the AM57x platform
+ ******************************************************************************/
+-int assert_am57x(cl::Device &device)
++void assert_am57x(cl::Device &device)
+ {
+     cl::Platform platform;
+     std::string  platform_name;
+diff --git a/examples/persistent_common/host_assist.h b/examples/persistent_common/host_assist.h
+index dec381e..4abf837 100644
+--- a/examples/persistent_common/host_assist.h
++++ b/examples/persistent_common/host_assist.h
+@@ -7,7 +7,7 @@
+ /*-----------------------------------------------------------------------------
+ * Prototypes
+ *----------------------------------------------------------------------------*/
+-int  assert_am57x         (cl::Device &device);
++void assert_am57x         (cl::Device &device);
+ void print_completion_code(uint32_t completion_code);
+ 
+ #endif // _HOST_ASSIST_H_
+diff --git a/examples/sgemm/main.cpp b/examples/sgemm/main.cpp
+index 85f19ac..dfac651 100644
+--- a/examples/sgemm/main.cpp
++++ b/examples/sgemm/main.cpp
+@@ -96,7 +96,7 @@ int NUMCOMPUNITS                    = 0;
+ /* ======================================================================== */
+ void PrintUsageAndExit();
+ void HandleOptions(int argc, char* argv[]);
+-bool SetSgemmParams(Device& device);
++void SetSgemmParams(Device& device);
+ 
+ /* ======================================================================== */
+ /*  MAIN                                                                    */
+@@ -428,7 +428,7 @@ static cl_ulong roundDownPower2(cl_ulong value)
+ /*-----------------------------------------------------------------------------
+ * Check platform name, set sgemm blocking/tiling parameters accordingly
+ *----------------------------------------------------------------------------*/
+-bool SetSgemmParams(Device& device)
++void SetSgemmParams(Device& device)
+ {
+    int APanelSz        = 8  << 10;
+    int BPanelSz        = 16 << 10;
+-- 
+2.17.1
+
diff --git a/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb b/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
index cbc35ce5..d0925db1 100644
--- a/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
+++ b/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
@@ -5,7 +5,9 @@ LICENSE = "BSD"
 include ocl.inc
 require recipes-ti/includes/ti-paths.inc
 
-PR = "${INC_PR}.0"
+SRC_URI += "file://0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch;patchdir=${WORKDIR}/git"
+
+PR = "${INC_PR}.1"
 
 COMPATIBLE_MACHINE = "dra7xx|keystone"
 PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -64,7 +66,7 @@ OCL_MPAX_EXAMPLE_LIST = " vecadd_mpax \
 
 OCL_EXAMPLE_LIST_append_k2hk = " ${OCL_MPAX_EXAMPLE_LIST}"
 
-python do_unpack_append() {
+python do_patch_append() {
     import shutil
 
     git_dir = d.expand("${WORKDIR}/git/examples")
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [thud/ti2019.01][PATCH] ocl: fix g++8.3 opencl-examples undefined behavior
  2019-06-24 19:07 [thud/ti2019.01][PATCH] ocl: fix g++8.3 opencl-examples undefined behavior Yuan Zhao
@ 2019-06-24 20:55 ` Denys Dmytriyenko
  2019-06-25  1:28   ` Zhao, Yuan
  0 siblings, 1 reply; 3+ messages in thread
From: Denys Dmytriyenko @ 2019-06-24 20:55 UTC (permalink / raw)
  To: Yuan Zhao; +Cc: meta-arago

On Mon, Jun 24, 2019 at 02:07:34PM -0500, Yuan Zhao wrote:
> Signed-off-by: Yuan Zhao <yuanzhao@ti.com>
> ---
>  ...g-8.3.0-OpenCL-example-undefined-behavior.patch | 68 ++++++++++++++++++++++
>  .../recipes-ti/ocl/opencl-examples_git.bb          |  6 +-
>  2 files changed, 72 insertions(+), 2 deletions(-)
>  create mode 100644 meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
> 
> diff --git a/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch b/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
> new file mode 100644
> index 00000000..b2c40c84
> --- /dev/null
> +++ b/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
> @@ -0,0 +1,68 @@
> +From 7cf77b704544b6012105f7ed19807b798b6cb242 Mon Sep 17 00:00:00 2001
> +From: Yuan Zhao <yuanzhao@ti.com>
> +Date: Mon, 24 Jun 2019 13:24:11 -0500
> +Subject: [PATCH] Fix g++ 8.3.0 OpenCL example undefined behavior
> +
> +- Fix undefined behavior of non-void functions with no return statements,
> +  when using g++ 8.3.0.  Change them to void functions.
> +
> +Upstream-Status: Submitted [Remove this patch when next release is out]
> +
> +Signed-off-by: Yuan Zhao <yuanzhao@ti.com>
> +---
> + examples/persistent_common/host_assist.cpp | 2 +-
> + examples/persistent_common/host_assist.h   | 2 +-
> + examples/sgemm/main.cpp                    | 4 ++--
> + 3 files changed, 4 insertions(+), 4 deletions(-)
> +
> +diff --git a/examples/persistent_common/host_assist.cpp b/examples/persistent_common/host_assist.cpp
> +index f1640bc..fd8bb18 100644
> +--- a/examples/persistent_common/host_assist.cpp
> ++++ b/examples/persistent_common/host_assist.cpp
> +@@ -34,7 +34,7 @@ void print_completion_code(uint32_t completion_code)
> + /******************************************************************************
> + * Given an OpenCL Device, Abort if the device is not part of the AM57x platform
> + ******************************************************************************/
> +-int assert_am57x(cl::Device &device)
> ++void assert_am57x(cl::Device &device)
> + {
> +     cl::Platform platform;
> +     std::string  platform_name;
> +diff --git a/examples/persistent_common/host_assist.h b/examples/persistent_common/host_assist.h
> +index dec381e..4abf837 100644
> +--- a/examples/persistent_common/host_assist.h
> ++++ b/examples/persistent_common/host_assist.h
> +@@ -7,7 +7,7 @@
> + /*-----------------------------------------------------------------------------
> + * Prototypes
> + *----------------------------------------------------------------------------*/
> +-int  assert_am57x         (cl::Device &device);
> ++void assert_am57x         (cl::Device &device);
> + void print_completion_code(uint32_t completion_code);
> + 
> + #endif // _HOST_ASSIST_H_
> +diff --git a/examples/sgemm/main.cpp b/examples/sgemm/main.cpp
> +index 85f19ac..dfac651 100644
> +--- a/examples/sgemm/main.cpp
> ++++ b/examples/sgemm/main.cpp
> +@@ -96,7 +96,7 @@ int NUMCOMPUNITS                    = 0;
> + /* ======================================================================== */
> + void PrintUsageAndExit();
> + void HandleOptions(int argc, char* argv[]);
> +-bool SetSgemmParams(Device& device);
> ++void SetSgemmParams(Device& device);
> + 
> + /* ======================================================================== */
> + /*  MAIN                                                                    */
> +@@ -428,7 +428,7 @@ static cl_ulong roundDownPower2(cl_ulong value)
> + /*-----------------------------------------------------------------------------
> + * Check platform name, set sgemm blocking/tiling parameters accordingly
> + *----------------------------------------------------------------------------*/
> +-bool SetSgemmParams(Device& device)
> ++void SetSgemmParams(Device& device)
> + {
> +    int APanelSz        = 8  << 10;
> +    int BPanelSz        = 16 << 10;
> +-- 
> +2.17.1
> +
> diff --git a/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb b/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
> index cbc35ce5..d0925db1 100644
> --- a/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
> +++ b/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
> @@ -5,7 +5,9 @@ LICENSE = "BSD"
>  include ocl.inc
>  require recipes-ti/includes/ti-paths.inc
>  
> -PR = "${INC_PR}.0"
> +SRC_URI += "file://0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch;patchdir=${WORKDIR}/git"

Can this be done with striplevel/pnum instead of patchdir?
Also, when using patchdir, it's preferred to use relative path, instead of 
very long absolute one. I'm aware of our existing instances of passing ${S} 
(which is redundant) and ${WORKDIR} to patchdir, when it can be as simple as 
patchdir=..


> +
> +PR = "${INC_PR}.1"
>  
>  COMPATIBLE_MACHINE = "dra7xx|keystone"
>  PACKAGE_ARCH = "${MACHINE_ARCH}"
> @@ -64,7 +66,7 @@ OCL_MPAX_EXAMPLE_LIST = " vecadd_mpax \
>  
>  OCL_EXAMPLE_LIST_append_k2hk = " ${OCL_MPAX_EXAMPLE_LIST}"
>  
> -python do_unpack_append() {
> +python do_patch_append() {
>      import shutil
>  
>      git_dir = d.expand("${WORKDIR}/git/examples")
> -- 
> 2.14.1
> 
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [thud/ti2019.01][PATCH] ocl: fix g++8.3 opencl-examples undefined behavior
  2019-06-24 20:55 ` Denys Dmytriyenko
@ 2019-06-25  1:28   ` Zhao, Yuan
  0 siblings, 0 replies; 3+ messages in thread
From: Zhao, Yuan @ 2019-06-25  1:28 UTC (permalink / raw)
  To: Dmytriyenko, Denys; +Cc: meta-arago

Okay, I am changing to relative patchdir.  Patch v2 coming up.  Thanks!  - Yuan

-----Original Message-----
From: Dmytriyenko, Denys 
Sent: Monday, June 24, 2019 3:56 PM
To: Zhao, Yuan
Cc: meta-arago@arago-project.org
Subject: Re: [meta-arago] [thud/ti2019.01][PATCH] ocl: fix g++8.3 opencl-examples undefined behavior

On Mon, Jun 24, 2019 at 02:07:34PM -0500, Yuan Zhao wrote:
> Signed-off-by: Yuan Zhao <yuanzhao@ti.com>
> ---
>  ...g-8.3.0-OpenCL-example-undefined-behavior.patch | 68 ++++++++++++++++++++++
>  .../recipes-ti/ocl/opencl-examples_git.bb          |  6 +-
>  2 files changed, 72 insertions(+), 2 deletions(-)
>  create mode 100644 meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
> 
> diff --git a/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch b/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
> new file mode 100644
> index 00000000..b2c40c84
> --- /dev/null
> +++ b/meta-arago-extras/recipes-ti/ocl/files/0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch
> @@ -0,0 +1,68 @@
> +From 7cf77b704544b6012105f7ed19807b798b6cb242 Mon Sep 17 00:00:00 2001
> +From: Yuan Zhao <yuanzhao@ti.com>
> +Date: Mon, 24 Jun 2019 13:24:11 -0500
> +Subject: [PATCH] Fix g++ 8.3.0 OpenCL example undefined behavior
> +
> +- Fix undefined behavior of non-void functions with no return statements,
> +  when using g++ 8.3.0.  Change them to void functions.
> +
> +Upstream-Status: Submitted [Remove this patch when next release is out]
> +
> +Signed-off-by: Yuan Zhao <yuanzhao@ti.com>
> +---
> + examples/persistent_common/host_assist.cpp | 2 +-
> + examples/persistent_common/host_assist.h   | 2 +-
> + examples/sgemm/main.cpp                    | 4 ++--
> + 3 files changed, 4 insertions(+), 4 deletions(-)
> +
> +diff --git a/examples/persistent_common/host_assist.cpp b/examples/persistent_common/host_assist.cpp
> +index f1640bc..fd8bb18 100644
> +--- a/examples/persistent_common/host_assist.cpp
> ++++ b/examples/persistent_common/host_assist.cpp
> +@@ -34,7 +34,7 @@ void print_completion_code(uint32_t completion_code)
> + /******************************************************************************
> + * Given an OpenCL Device, Abort if the device is not part of the AM57x platform
> + ******************************************************************************/
> +-int assert_am57x(cl::Device &device)
> ++void assert_am57x(cl::Device &device)
> + {
> +     cl::Platform platform;
> +     std::string  platform_name;
> +diff --git a/examples/persistent_common/host_assist.h b/examples/persistent_common/host_assist.h
> +index dec381e..4abf837 100644
> +--- a/examples/persistent_common/host_assist.h
> ++++ b/examples/persistent_common/host_assist.h
> +@@ -7,7 +7,7 @@
> + /*-----------------------------------------------------------------------------
> + * Prototypes
> + *----------------------------------------------------------------------------*/
> +-int  assert_am57x         (cl::Device &device);
> ++void assert_am57x         (cl::Device &device);
> + void print_completion_code(uint32_t completion_code);
> + 
> + #endif // _HOST_ASSIST_H_
> +diff --git a/examples/sgemm/main.cpp b/examples/sgemm/main.cpp
> +index 85f19ac..dfac651 100644
> +--- a/examples/sgemm/main.cpp
> ++++ b/examples/sgemm/main.cpp
> +@@ -96,7 +96,7 @@ int NUMCOMPUNITS                    = 0;
> + /* ======================================================================== */
> + void PrintUsageAndExit();
> + void HandleOptions(int argc, char* argv[]);
> +-bool SetSgemmParams(Device& device);
> ++void SetSgemmParams(Device& device);
> + 
> + /* ======================================================================== */
> + /*  MAIN                                                                    */
> +@@ -428,7 +428,7 @@ static cl_ulong roundDownPower2(cl_ulong value)
> + /*-----------------------------------------------------------------------------
> + * Check platform name, set sgemm blocking/tiling parameters accordingly
> + *----------------------------------------------------------------------------*/
> +-bool SetSgemmParams(Device& device)
> ++void SetSgemmParams(Device& device)
> + {
> +    int APanelSz        = 8  << 10;
> +    int BPanelSz        = 16 << 10;
> +-- 
> +2.17.1
> +
> diff --git a/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb b/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
> index cbc35ce5..d0925db1 100644
> --- a/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
> +++ b/meta-arago-extras/recipes-ti/ocl/opencl-examples_git.bb
> @@ -5,7 +5,9 @@ LICENSE = "BSD"
>  include ocl.inc
>  require recipes-ti/includes/ti-paths.inc
>  
> -PR = "${INC_PR}.0"
> +SRC_URI += "file://0003-Fix-g-8.3.0-OpenCL-example-undefined-behavior.patch;patchdir=${WORKDIR}/git"

Can this be done with striplevel/pnum instead of patchdir?
Also, when using patchdir, it's preferred to use relative path, instead of 
very long absolute one. I'm aware of our existing instances of passing ${S} 
(which is redundant) and ${WORKDIR} to patchdir, when it can be as simple as 
patchdir=..


> +
> +PR = "${INC_PR}.1"
>  
>  COMPATIBLE_MACHINE = "dra7xx|keystone"
>  PACKAGE_ARCH = "${MACHINE_ARCH}"
> @@ -64,7 +66,7 @@ OCL_MPAX_EXAMPLE_LIST = " vecadd_mpax \
>  
>  OCL_EXAMPLE_LIST_append_k2hk = " ${OCL_MPAX_EXAMPLE_LIST}"
>  
> -python do_unpack_append() {
> +python do_patch_append() {
>      import shutil
>  
>      git_dir = d.expand("${WORKDIR}/git/examples")
> -- 
> 2.14.1
> 
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-25  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24 19:07 [thud/ti2019.01][PATCH] ocl: fix g++8.3 opencl-examples undefined behavior Yuan Zhao
2019-06-24 20:55 ` Denys Dmytriyenko
2019-06-25  1:28   ` Zhao, Yuan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.