rocr: Fixed inefficient copy operations

Changed variable assignments to use std::move() where appropriate

Signed-off-by: Alysa Liu <Alysa.Liu@amd.com>
Этот коммит содержится в:
Alysa Liu
2025-05-27 13:22:25 -04:00
коммит произвёл Liu, Alysa
родитель 293092f32f
Коммит 369d89ade3
5 изменённых файлов: 7 добавлений и 7 удалений
+1 -1
Просмотреть файл
@@ -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 =
+1 -1
Просмотреть файл
@@ -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."); }
+2 -2
Просмотреть файл
@@ -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);
}
}
+1 -1
Просмотреть файл
@@ -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) {
+2 -2
Просмотреть файл
@@ -175,7 +175,7 @@ namespace code {
std::string Symbol::GetSymbolName() const {
std::string FullName = Name();
return FullName.rfind(":") != std::string::npos ?
FullName.substr(FullName.rfind(":") + 1) : FullName;
std::move(FullName.substr(FullName.rfind(":") + 1)) : std::move(FullName);
}
hsa_code_symbol_t Symbol::ToHandle(Symbol* sym)
@@ -1732,7 +1732,7 @@ namespace code {
std::string AmdHsaCode::MangleSymbolName(const std::string& module_name, const std::string symbol_name)
{
if (module_name.empty()) {
return symbol_name;
return std::move(symbol_name);
} else {
return module_name + "::" + symbol_name;
}