Improve loop variables.
Derived from github pull request by folklore1984. Change-Id: I70cd3da131691543fed8bf913d6245d41c49280d
Dieser Commit ist enthalten in:
@@ -193,9 +193,8 @@ AqlQueue::AqlQueue(GpuAgent* agent, size_t req_size_pkts, HSAuint32 node_id, Scr
|
||||
// Set group and private memory apertures in amd_queue_.
|
||||
auto& regions = agent->regions();
|
||||
|
||||
for (int i = 0; i < regions.size(); i++) {
|
||||
const MemoryRegion* amdregion;
|
||||
amdregion = static_cast<const MemoryRegion*>(regions[i]);
|
||||
for (auto region : regions) {
|
||||
const MemoryRegion* amdregion = static_cast<const amd::MemoryRegion*>(region);
|
||||
uint64_t base = amdregion->GetBaseAddress();
|
||||
|
||||
if (amdregion->IsLDS()) {
|
||||
@@ -816,7 +815,7 @@ void AqlQueue::ExecutePM4(uint32_t* cmd_data, size_t cmd_size_b) {
|
||||
|
||||
nop_pad[0] = PM4_HDR(PM4_HDR_IT_OPCODE_NOP, nop_pad_size_dw, agent_->isa()->GetMajorVersion());
|
||||
|
||||
for (int i = 1; i < nop_pad_size_dw; ++i) {
|
||||
for (uint32_t i = 1; i < nop_pad_size_dw; ++i) {
|
||||
nop_pad[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ hsa_status_t MemoryRegion::Lock(uint32_t num_agents, const hsa_agent_t* agents,
|
||||
core::Runtime::runtime_singleton_->gpu_agents().begin(),
|
||||
core::Runtime::runtime_singleton_->gpu_agents().end());
|
||||
} else {
|
||||
for (int i = 0; i < num_agents; ++i) {
|
||||
for (uint32_t i = 0; i < num_agents; ++i) {
|
||||
core::Agent* agent = core::Agent::Convert(agents[i]);
|
||||
if (agent == NULL || !agent->IsValid()) {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
|
||||
@@ -686,7 +686,7 @@ hsa_status_t hsa_amd_interop_map_buffer(uint32_t num_agents,
|
||||
if (core_agents == NULL) return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
for (uint32_t i = 0; i < num_agents; i++) {
|
||||
core::Agent* device = core::Agent::Convert(agents[i]);
|
||||
IS_VALID(device);
|
||||
core_agents[i] = device;
|
||||
@@ -755,7 +755,7 @@ hsa_status_t hsa_amd_ipc_memory_attach(const hsa_amd_ipc_memory_t* ipc, size_t l
|
||||
if (num_agents > tinyArraySize) delete[] core_agents;
|
||||
});
|
||||
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
for (uint32_t i = 0; i < num_agents; i++) {
|
||||
core::Agent* device = core::Agent::Convert(mapping_agents[i]);
|
||||
IS_VALID(device);
|
||||
core_agents[i] = device;
|
||||
|
||||
@@ -238,8 +238,8 @@ void ExtensionEntryPoints::UpdateAmdExtTable(void *func_ptr) {
|
||||
}
|
||||
|
||||
void ExtensionEntryPoints::Unload() {
|
||||
for (int i = 0; i < libs_.size(); i++) {
|
||||
void* ptr = os::GetExportAddress(libs_[i], "Unload");
|
||||
for (auto lib : libs_) {
|
||||
void* ptr = os::GetExportAddress(lib, "Unload");
|
||||
if (ptr) {
|
||||
((Unload_t)ptr)();
|
||||
}
|
||||
@@ -247,8 +247,8 @@ void ExtensionEntryPoints::Unload() {
|
||||
// Due to valgrind bug, runtime cannot dlclose extensions see:
|
||||
// http://valgrind.org/docs/manual/faq.html#faq.unhelpful
|
||||
if (!core::Runtime::runtime_singleton_->flag().running_valgrind()) {
|
||||
for (int i = 0; i < libs_.size(); i++) {
|
||||
os::CloseLib(libs_[i]);
|
||||
for (auto lib : libs_) {
|
||||
os::CloseLib(lib);
|
||||
}
|
||||
}
|
||||
libs_.clear();
|
||||
|
||||
@@ -476,7 +476,7 @@ hsa_status_t Runtime::FillMemory(void* ptr, uint32_t value, size_t count) {
|
||||
core::Agent* blit_agent = core::Agent::Convert(info.agentOwner);
|
||||
if (blit_agent->device_type() != core::Agent::DeviceType::kAmdGpuDevice) {
|
||||
blit_agent = nullptr;
|
||||
for (int i = 0; i < agent_count; i++) {
|
||||
for (uint32_t i = 0; i < agent_count; i++) {
|
||||
if (core::Agent::Convert(accessible[i])->device_type() ==
|
||||
core::Agent::DeviceType::kAmdGpuDevice) {
|
||||
blit_agent = core::Agent::Convert(accessible[i]);
|
||||
@@ -643,7 +643,7 @@ hsa_status_t Runtime::InteropMap(uint32_t num_agents, Agent** agents,
|
||||
if (num_agents > tinyArraySize) delete[] nodes;
|
||||
});
|
||||
|
||||
for (int i = 0; i < num_agents; i++)
|
||||
for (uint32_t i = 0; i < num_agents; i++)
|
||||
agents[i]->GetInfo((hsa_agent_info_t)HSA_AMD_AGENT_INFO_DRIVER_NODE_ID,
|
||||
&nodes[i]);
|
||||
|
||||
@@ -761,7 +761,7 @@ hsa_status_t Runtime::PtrInfo(void* ptr, hsa_amd_pointer_info_t* info, void* (*a
|
||||
|
||||
if (returnListData) {
|
||||
uint32_t count = 0;
|
||||
for (int i = 0; i < thunkInfo.NMappedNodes; i++) {
|
||||
for (HSAuint32 i = 0; i < thunkInfo.NMappedNodes; i++) {
|
||||
assert(mappedNodes[i] < agents_by_node_.size() &&
|
||||
"PointerInfo: Invalid node ID returned from thunk.");
|
||||
count += agents_by_node_[mappedNodes[i]].size();
|
||||
@@ -773,10 +773,10 @@ hsa_status_t Runtime::PtrInfo(void* ptr, hsa_amd_pointer_info_t* info, void* (*a
|
||||
*num_agents_accessible = count;
|
||||
|
||||
uint32_t index = 0;
|
||||
for (int i = 0; i < thunkInfo.NMappedNodes; i++) {
|
||||
for (HSAuint32 i = 0; i < thunkInfo.NMappedNodes; i++) {
|
||||
auto& list = agents_by_node_[mappedNodes[i]];
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
(*accessible)[index] = list[j]->public_handle();
|
||||
for (auto agent : list) {
|
||||
(*accessible)[index] = agent->public_handle();
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -883,7 +883,7 @@ hsa_status_t Runtime::IPCAttach(const hsa_amd_ipc_memory_t* handle, size_t len,
|
||||
if (num_agents > tinyArraySize) delete[] nodes;
|
||||
});
|
||||
|
||||
for (int i = 0; i < num_agents; i++)
|
||||
for (uint32_t i = 0; i < num_agents; i++)
|
||||
agents[i]->GetInfo((hsa_agent_info_t)HSA_AMD_AGENT_INFO_DRIVER_NODE_ID, &nodes[i]);
|
||||
|
||||
if (hsaKmtRegisterSharedHandleToNodes(
|
||||
@@ -1271,8 +1271,8 @@ void Runtime::LoadTools() {
|
||||
if (tool_names != "") {
|
||||
std::vector<std::string> names = parse_tool_names(tool_names);
|
||||
std::vector<const char*> failed;
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
os::LibHandle tool = os::LoadLib(names[i]);
|
||||
for (auto& name : names) {
|
||||
os::LibHandle tool = os::LoadLib(name);
|
||||
|
||||
if (tool != NULL) {
|
||||
tool_libs_.push_back(tool);
|
||||
@@ -1283,7 +1283,7 @@ void Runtime::LoadTools() {
|
||||
if (!ld(&hsa_api_table_.hsa_api,
|
||||
hsa_api_table_.hsa_api.version.major_id,
|
||||
failed.size(), &failed[0])) {
|
||||
failed.push_back(names[i].c_str());
|
||||
failed.push_back(name.c_str());
|
||||
os::CloseLib(tool);
|
||||
continue;
|
||||
}
|
||||
@@ -1313,7 +1313,7 @@ void Runtime::LoadTools() {
|
||||
}
|
||||
else {
|
||||
if (flag().report_tool_load_failures())
|
||||
debug_print("Tool lib \"%s\" failed to load.\n", names[i].c_str());
|
||||
debug_print("Tool lib \"%s\" failed to load.\n", name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1335,7 +1335,7 @@ void Runtime::CloseTools() {
|
||||
// Due to valgrind bug, runtime cannot dlclose extensions see:
|
||||
// http://valgrind.org/docs/manual/faq.html#faq.unhelpful
|
||||
if (!flag_.running_valgrind()) {
|
||||
for (int i = 0; i < tool_libs_.size(); i++) os::CloseLib(tool_libs_[i]);
|
||||
for (auto& lib : tool_libs_) os::CloseLib(lib);
|
||||
}
|
||||
tool_libs_.clear();
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ SignalGroup::SignalGroup(uint32_t num_signals, const hsa_signal_t* hsa_signals)
|
||||
signals = NULL;
|
||||
}
|
||||
if (signals == NULL) return;
|
||||
for (int i = 0; i < count; i++) signals[i] = hsa_signals[i];
|
||||
for (uint32_t i = 0; i < count; i++) signals[i] = hsa_signals[i];
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren