From 546926a1877b47375ffc85403ef95792fb237699 Mon Sep 17 00:00:00 2001 From: Liangliang He Date: Mon, 30 Oct 2017 15:18:52 +0800 Subject: [PATCH] Fix CL_HPP_TARGET_OPENCL_VERSION warning --- mace/core/BUILD | 4 ++-- mace/core/runtime/opencl/cl2_header.h | 12 ++++++++++++ mace/core/runtime/opencl/opencl_allocator.cc | 2 +- mace/core/runtime/opencl/opencl_runtime.h | 6 +----- mace/kernels/opencl/batch_norm_opencl.cc | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 mace/core/runtime/opencl/cl2_header.h diff --git a/mace/core/BUILD b/mace/core/BUILD index 9d337bc4..63a30357 100644 --- a/mace/core/BUILD +++ b/mace/core/BUILD @@ -12,11 +12,11 @@ load("//mace:mace.bzl", "if_android") cc_library( name = "opencl_runtime", srcs = glob([ - "runtime/opencl/cl.hpp", - "runtime/opencl/cl2.hpp", "runtime/opencl/*.cc", ]), hdrs = glob([ + "runtime/opencl/cl.hpp", + "runtime/opencl/cl2.hpp", "runtime/opencl/*.h", ]), copts = ["-std=c++11"], diff --git a/mace/core/runtime/opencl/cl2_header.h b/mace/core/runtime/opencl/cl2_header.h new file mode 100644 index 00000000..f7c4af4b --- /dev/null +++ b/mace/core/runtime/opencl/cl2_header.h @@ -0,0 +1,12 @@ +// +// Copyright (c) 2017 XiaoMi All rights reserved. +// + +#ifndef MACE_CORE_RUNTIME_OPENCL_CL2_HEADER_H_ +#define MACE_CORE_RUNTIME_OPENCL_CL2_HEADER_H_ + +#define CL_HPP_TARGET_OPENCL_VERSION 200 + +#include "mace/core/runtime/opencl/cl2.hpp" + +#endif // MACE_CORE_RUNTIME_OPENCL_CL2_HEADER_H_ diff --git a/mace/core/runtime/opencl/opencl_allocator.cc b/mace/core/runtime/opencl/opencl_allocator.cc index f1338cf2..d40432e2 100644 --- a/mace/core/runtime/opencl/opencl_allocator.cc +++ b/mace/core/runtime/opencl/opencl_allocator.cc @@ -2,8 +2,8 @@ // Copyright (c) 2017 XiaoMi All rights reserved. // +#include "mace/core/runtime/opencl/cl2_header.h" #include "mace/core/runtime/opencl/opencl_allocator.h" -#include "mace/core/runtime/opencl/cl2.hpp" #include "mace/core/runtime/opencl/opencl_runtime.h" namespace mace { diff --git a/mace/core/runtime/opencl/opencl_runtime.h b/mace/core/runtime/opencl/opencl_runtime.h index e7c7b180..f21ade57 100644 --- a/mace/core/runtime/opencl/opencl_runtime.h +++ b/mace/core/runtime/opencl/opencl_runtime.h @@ -5,14 +5,10 @@ #ifndef MACE_CORE_RUNTIME_OPENCL_OPENCL_RUNTIME_H_ #define MACE_CORE_RUNTIME_OPENCL_OPENCL_RUNTIME_H_ -#ifndef CL_HPP_TARGET_OPENCL_VERSION -#define CL_HPP_TARGET_OPENCL_VERSION 200 -#endif - #include #include -#include "mace/core/runtime/opencl/cl2.hpp" +#include "mace/core/runtime/opencl/cl2_header.h" #include "mace/core/runtime/opencl/opencl_wrapper.h" namespace mace { diff --git a/mace/kernels/opencl/batch_norm_opencl.cc b/mace/kernels/opencl/batch_norm_opencl.cc index 82efa459..86f15164 100644 --- a/mace/kernels/opencl/batch_norm_opencl.cc +++ b/mace/kernels/opencl/batch_norm_opencl.cc @@ -3,7 +3,7 @@ // #include "mace/kernels/batch_norm.h" -#include "mace/core/runtime/opencl/cl2.hpp" +#include "mace/core/runtime/opencl/cl2_header.h" #include "mace/core/runtime/opencl/opencl_runtime.h" #include "mace/utils/tuner.h" @@ -79,4 +79,4 @@ void BatchNormFunctor::operator()( } } // namespace kernels -} // namespace mace \ No newline at end of file +} // namespace mace -- GitLab