This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Qualcomm AI Engine Direct - support multi-context, dlbc (pytorch#2450)
Summary: bypass-github-export-checks - refactor compiler spec for more backends - support HTP features of multi-context, dlbc - test cases for multi-context Pull Request resolved: pytorch#2450 Reviewed By: kirklandsign Differential Revision: D54932332 Pulled By: cccclai fbshipit-source-id: 5570897c1ab3833fc1c0b45d0331469aece4cf31
- Loading branch information
1 parent
246ed45
commit 84cd2bb
Showing
23 changed files
with
697 additions
and
214 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
49 changes: 49 additions & 0 deletions
49
backends/qualcomm/runtime/backends/htpbackend/HtpContext.cpp
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,49 @@ | ||
/* | ||
* Copyright (c) Qualcomm Innovation Center, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <executorch/backends/qualcomm/runtime/Logging.h> | ||
#include <executorch/backends/qualcomm/runtime/backends/htpbackend/HtpContext.h> | ||
|
||
#include "HTP/QnnHtpCommon.h" | ||
#include "Saver/QnnSaverCommon.h" | ||
|
||
namespace torch { | ||
namespace executor { | ||
namespace qnn { | ||
|
||
Error HtpContext::MakeConfig(std::vector<const QnnContext_Config_t*>& config) { | ||
const std::vector<QnnContext_CustomConfig_t>& context_custom_config = | ||
htp_context_custom_config_->CreateContextCustomConfig(); | ||
|
||
uint32_t num_custom_configs = context_custom_config.size(); | ||
context_config_.resize(num_custom_configs); | ||
// +1 for null terminated | ||
config.reserve(num_custom_configs + 1); | ||
|
||
for (std::size_t i = 0; i < num_custom_configs; ++i) { | ||
context_config_[i].option = QNN_CONTEXT_CONFIG_OPTION_CUSTOM; | ||
context_config_[i].customConfig = context_custom_config[i]; | ||
config.push_back(&context_config_[i]); | ||
} | ||
|
||
config.push_back(nullptr); | ||
return Error::Ok; | ||
} | ||
|
||
Error HtpContext::AfterConfigure() { | ||
// update sf_handle with first context handle encounterded as group handle | ||
// TODO: should handle the thread safety if needed | ||
if (sf_handle_ == 0x0) { | ||
sf_handle_ = GetHandle(); | ||
} | ||
return Error::Ok; | ||
} | ||
|
||
} // namespace qnn | ||
} // namespace executor | ||
} // namespace torch |
Oops, something went wrong.