Skip to content

Commit fa56c92

Browse files
authored
Merge pull request #483 from RadeonOpenCompute/fix_remove_vla_from_hc_am
Remove VLA usage from HC_AM
2 parents d338cd9 + 472150a commit fa56c92

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/hsa/hc_am.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,8 @@ am_status_t am_map_to_peers(void* ptr, size_t num_peer, const hc::accelerator* p
524524
else
525525
return AM_ERROR_MISC;
526526
}
527-
528-
const size_t max_agent = hc::accelerator::get_all().size();
529-
hsa_agent_t agents[max_agent];
527+
528+
std::vector<hsa_agent_t> agents{hc::accelerator::get_all().size()};
530529

531530
int peer_count = 0;
532531

@@ -572,7 +571,7 @@ am_status_t am_map_to_peers(void* ptr, size_t num_peer, const hc::accelerator* p
572571
// allow access to the agents
573572
if(peer_count)
574573
{
575-
hsa_status_t status = hsa_amd_agents_allow_access(peer_count, agents, NULL, ptr);
574+
hsa_status_t status = hsa_amd_agents_allow_access(peer_count, agents.data(), NULL, ptr);
576575
return status == HSA_STATUS_SUCCESS ? AM_SUCCESS : AM_ERROR_MISC;
577576
}
578577

0 commit comments

Comments
 (0)