adstraw commented on code in PR #12727:
URL: https://github.com/apache/tvm/pull/12727#discussion_r973333270
##########
src/runtime/hexagon/hexagon_device_api.cc:
##########
@@ -90,18 +90,20 @@ void* HexagonDeviceAPI::AllocDataSpace(Device dev, int
ndim, const int64_t* shap
const size_t typesize = (dtype.bits / 8) * dtype.lanes;
+ HexagonBufferManager* mgr = runtime_hexbuffs ? runtime_hexbuffs.get() :
&hexbuffs;
Review Comment:
It would be best if we could fully find and fix the "init time" uses of
`hexbuffs` before merging this PR.
If that's not possible, then `mgr` should be a member of HexagonDeviceAPI
which is initialized with `&hexbuffs` and then set to
`std::make_unique<HexagonBufferManager>()` in "acquire" to avoid all this
trinary switching at runtime.
##########
src/runtime/hexagon/hexagon_device_api.h:
##########
@@ -50,6 +50,22 @@ class HexagonDeviceAPI final : public DeviceAPI {
//! \brief Destructor
~HexagonDeviceAPI() {}
+ //! \brief Ensures resource managers are in a good state for the runtime
+ void AcquireResources() {
+ CHECK_EQ(runtime_hexbuffs, nullptr);
+ runtime_hexbuffs = std::make_unique<HexagonBufferManager>();
Review Comment:
Set `mgr` member variable here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]