rocr: Fixed inefficient copy operations
Changed variable assignments to use std::move() where appropriate.
Changed function headers to pass string arguments by reference where appropriate.
Signed-off-by: Alysa Liu <Alysa.Liu@amd.com>
[ROCm/ROCR-Runtime commit: ae6851dbb4]
This commit is contained in:
zatwierdzone przez
Liu, Alysa
rodzic
b97f9ba6d5
commit
65f5ce6f0a
@@ -83,8 +83,8 @@ __forceinline uint64_t drm_perm(hsa_access_permission_t perm) {
|
||||
|
||||
} // namespace
|
||||
|
||||
KfdDriver::KfdDriver(std::string devnode_name)
|
||||
: core::Driver(core::DriverType::KFD, devnode_name) {}
|
||||
KfdDriver::KfdDriver(std::string& devnode_name)
|
||||
: core::Driver(core::DriverType::KFD, std::move(devnode_name)) {}
|
||||
|
||||
hsa_status_t KfdDriver::Init() {
|
||||
HSAKMT_STATUS ret =
|
||||
@@ -128,7 +128,8 @@ hsa_status_t KfdDriver::ShutDown() {
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::DiscoverDriver(std::unique_ptr<core::Driver>& driver) {
|
||||
auto tmp_driver = std::unique_ptr<core::Driver>(new KfdDriver("/dev/kfd"));
|
||||
std::string devnode("/dev/kfd");
|
||||
auto tmp_driver = std::unique_ptr<core::Driver>(new KfdDriver(devnode));
|
||||
|
||||
if (tmp_driver->Open() == HSA_STATUS_SUCCESS) {
|
||||
driver = std::move(tmp_driver);
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace code {
|
||||
void PrintRelocationData(std::ostream& out, RelocationSection* section);
|
||||
void PrintSymbol(std::ostream& out, Symbol* sym);
|
||||
void PrintDisassembly(std::ostream& out, const unsigned char *isa, size_t size, uint32_t isa_offset = 0);
|
||||
std::string MangleSymbolName(const std::string& module_name, const std::string symbol_name);
|
||||
std::string MangleSymbolName(const std::string& module_name, const std::string& symbol_name);
|
||||
bool ElfImageError();
|
||||
|
||||
public:
|
||||
|
||||
@@ -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.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user