Skip to content

Commit

Permalink
Merge pull request #483 from RadeonOpenCompute/fix_remove_vla_from_hc_am
Browse files Browse the repository at this point in the history
Remove VLA usage from HC_AM
  • Loading branch information
whchung authored Oct 4, 2017
2 parents d338cd9 + 472150a commit fa56c92
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/hsa/hc_am.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,8 @@ am_status_t am_map_to_peers(void* ptr, size_t num_peer, const hc::accelerator* p
else
return AM_ERROR_MISC;
}

const size_t max_agent = hc::accelerator::get_all().size();
hsa_agent_t agents[max_agent];

std::vector<hsa_agent_t> agents{hc::accelerator::get_all().size()};

int peer_count = 0;

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

Expand Down

0 comments on commit fa56c92

Please sign in to comment.