-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OPENCL][ADRENO] Introduce Qualcomm extension support (#17519)
Introduce qualcomm extension support "cl_qcom_perf_hint", "cl_qcom_priority_hint" extn support added over workspace interface. OpenCL version will be picked up from SDK headers. CI fixes for build without Adreno OpenCL SDK. Entensions are activated based on its availability in SDK. New workspace API "SetNativePtr" defined that releases existing cl_mem and creates new mem object backed by given host ptr. Works for cl_qcom_ion_host_ptr, cl_qcom_android_ahardwarebuffer_host_ptr, cl_qcom_android_native_buffer_host_ptr, cl_qcom_dmabuf_host_ptr and cl_qcom_ion_host_ptr. The responsibility of preparing the host_ptr objects is with application. Some times the application needs device id for various devices related information. Use below ref. to get cl_device_id from workspace. OpenCLWorkspace* workspace = OpenCLWorkspace::Global(); cl_device_id device_id = workspace->GetCLDeviceID(0);
- Loading branch information
1 parent
370ec6a
commit 37bca85
Showing
9 changed files
with
133 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// Note:: This should be first tests to be executed. | ||
// hence, crafted the filename accordingly | ||
|
||
#include <gtest/gtest.h> | ||
#include <tvm/runtime/container/optional.h> | ||
|
||
#include "../src/runtime/opencl/opencl_common.h" | ||
|
||
using namespace tvm::runtime; | ||
using namespace tvm::runtime::cl; | ||
|
||
#ifdef USE_OPENCL_EXTN_QCOM | ||
#pragma message("Qualcomm OpenCL Extn GTests: enabled") | ||
TEST(QCOMExtn, ContextPriorityHint) { | ||
OpenCLWorkspace* workspace = OpenCLWorkspace::Global(); | ||
cl_context_properties properties[] = {CL_CONTEXT_PRIORITY_HINT_QCOM, CL_PRIORITY_HINT_LOW_QCOM, | ||
0}; | ||
// Only allow one time | ||
ASSERT_EQ(workspace->Init(properties), true); | ||
// Subsequent calls will be failure | ||
ASSERT_EQ(workspace->Init(properties), false); | ||
} | ||
|
||
TEST(QCOMExtn, ContextPerfHint) { | ||
OpenCLWorkspace* workspace = OpenCLWorkspace::Global(); | ||
auto dev = DLDevice{kDLOpenCL, 0}; | ||
workspace->SetPerfHint(dev, CL_PERF_HINT_HIGH_QCOM); | ||
} | ||
#else | ||
#pragma message("Qualcomm OpenCL Extn GTests: disabled") | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters