rocr: Fix inefficient copy operations

Refactor variable assignments to use std::move() where appropriate.
Updat function headers to accept parameters by const& where appropriate.

Signed-off-by: Alysa Liu <Alysa.Liu@amd.com>
This commit is contained in:
Alysa Liu
2025-05-29 10:30:05 -04:00
committed by Liu, Alysa
parent ae6851dbb4
commit f6c8cbd293
2 changed files with 3 additions and 4 deletions
@@ -83,7 +83,7 @@ __forceinline uint64_t drm_perm(hsa_access_permission_t perm) {
} // namespace
KfdDriver::KfdDriver(std::string& devnode_name)
KfdDriver::KfdDriver(std::string devnode_name)
: core::Driver(core::DriverType::KFD, std::move(devnode_name)) {}
hsa_status_t KfdDriver::Init() {
@@ -128,8 +128,7 @@ hsa_status_t KfdDriver::ShutDown() {
}
hsa_status_t KfdDriver::DiscoverDriver(std::unique_ptr<core::Driver>& driver) {
std::string devnode("/dev/kfd");
auto tmp_driver = std::unique_ptr<core::Driver>(new KfdDriver(devnode));
auto tmp_driver = std::unique_ptr<core::Driver>(new KfdDriver("/dev/kfd"));
if (tmp_driver->Open() == HSA_STATUS_SUCCESS) {
driver = std::move(tmp_driver);
@@ -69,7 +69,7 @@ namespace AMD {
/// and more.
class KfdDriver final : public core::Driver {
public:
KfdDriver(std::string& devnode_name);
KfdDriver(std::string devnode_name);
/// @brief Determine of the KFD is present on the system and attemp to open it if found.
///