提交 776748e3 编写于 作者: L Liangliang He

Add Adreno performance hints

上级 12765f20
//
// Copyright (c) 2017 XiaoMi All rights reserved.
//
#ifndef MACE_CORE_RUNTIME_OPENCL_EXTENSION_H_
#define MACE_CORE_RUNTIME_OPENCL_EXTENSION_H_
#include "mace/core/runtime/opencl/cl2_header.h"
// Adreno extensions
// Adreno performance hints
typedef cl_uint cl_perf_hint;
#define CL_CONTEXT_PERF_HINT_QCOM 0x40C2
#define CL_PERF_HINT_HIGH_QCOM 0x40C3
#define CL_PERF_HINT_NORMAL_QCOM 0x40C4
#define CL_PERF_HINT_LOW_QCOM 0x40C5
// Adreno priority hints
typedef cl_uint cl_priority_hint;
#define CL_PRIORITY_HINT_NONE_QCOM 0
#define CL_CONTEXT_PRIORITY_HINT_QCOM 0x40C9
#define CL_PRIORITY_HINT_HIGH_QCOM 0x40CA
#define CL_PRIORITY_HINT_NORMAL_QCOM 0x40CB
#define CL_PRIORITY_HINT_LOW_QCOM 0x40CC
#endif // MACE_CORE_RUNTIME_OPENCL_EXTENSION_H_
......@@ -7,6 +7,7 @@
#include <memory>
#include <mutex>
#include "mace/core/runtime/opencl/opencl_extension.h"
#include "mace/core/runtime/opencl/opencl_runtime.h"
#include "mace/public/mace.h"
#include "mace/utils/tuner.h"
......@@ -108,9 +109,15 @@ OpenCLRuntime::OpenCLRuntime() {
properties |= CL_QUEUE_PROFILING_ENABLE;
}
// a context is like a "runtime link" to the device and platform;
// i.e. communication is possible
cl::Context context({gpu_device});
// TODO (heliangliang) Make this configurable (e.g.HIGH for benchmark,
// disabled for Mali)
cl_context_properties context_properties[] = {
// Set context perf hint to normal
CL_CONTEXT_PERF_HINT_QCOM, CL_PERF_HINT_NORMAL_QCOM,
// Set context priority hint to low
CL_CONTEXT_PRIORITY_HINT_QCOM, CL_PRIORITY_HINT_LOW_QCOM, 0};
cl::Context context({gpu_device}, context_properties);
cl::CommandQueue command_queue(context, gpu_device, properties);
const char *kernel_path = getenv("MACE_KERNEL_PATH");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册