rocr: Fixed inefficient copy operations
Changed variable assignments to use std::move() where appropriate Signed-off-by: Alysa Liu <Alysa.Liu@amd.com>
This commit is contained in:
@@ -84,7 +84,7 @@ __forceinline uint64_t drm_perm(hsa_access_permission_t perm) {
|
||||
} // namespace
|
||||
|
||||
KfdDriver::KfdDriver(std::string devnode_name)
|
||||
: core::Driver(core::DriverType::KFD, devnode_name) {}
|
||||
: core::Driver(core::DriverType::KFD, std::move(devnode_name)) {}
|
||||
|
||||
hsa_status_t KfdDriver::Init() {
|
||||
HSAKMT_STATUS ret =
|
||||
|
||||
@@ -126,7 +126,7 @@ class ScratchCache {
|
||||
ScratchCache& operator=(const ScratchCache& rhs) = delete;
|
||||
ScratchCache& operator=(ScratchCache&& rhs) = delete;
|
||||
|
||||
ScratchCache(deallocator_t deallocator) : dealloc(deallocator), available_bytes_(0) {}
|
||||
ScratchCache(deallocator_t deallocator) : dealloc(std::move(deallocator)), available_bytes_(0) {}
|
||||
|
||||
~ScratchCache() { assert(map.empty() && "ScratchCache not empty at shutdown."); }
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ void RvdFilter::BuildDeviceUuidList(uint32_t numNodes) {
|
||||
<< props.UniqueID;
|
||||
std::string uuidVal(stream.str());
|
||||
std::transform(uuidVal.begin(), uuidVal.end(), uuidVal.begin(), ::toupper);
|
||||
devUuidList_.push_back(uuidVal);
|
||||
devUuidList_.push_back(std::move(uuidVal));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ void RvdFilter::SetDeviceUuidList() {
|
||||
<< dbgUuid[idx];
|
||||
std::string uuidVal(stream.str());
|
||||
std::transform(uuidVal.begin(), uuidVal.end(), uuidVal.begin(), ::toupper);
|
||||
devUuidList_[idx] = uuidVal;
|
||||
devUuidList_[idx] = std::move(uuidVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ template <typename T> class lazy_ptr {
|
||||
|
||||
void reset(std::function<T*()> Constructor = nullptr) {
|
||||
obj.reset();
|
||||
func = Constructor;
|
||||
func = std::move(Constructor);
|
||||
}
|
||||
|
||||
void reset(T* ptr) {
|
||||
|
||||
Reference in New Issue
Block a user