Fix Engine Offsetting for Copy on Engine

Forgot SDMA blit engine indices are offset by DevToDev 0-position in
a couple of places.

Change-Id: Ie811d8281bc812738ed0107694f3dffde5e93685
This commit is contained in:
Jonathan Kim
2023-03-03 16:16:20 -05:00
parent 7ed6d73b6d
commit 7364a93b98
2 changed files with 5 additions and 5 deletions
@@ -807,9 +807,9 @@ hsa_status_t GpuAgent::DmaCopyOnEngine(void* dst, core::Agent& dst_agent,
bool limit_h2d_blit = isa_->GetVersion() == core::Isa::Version(9, 0, 10);
// Ensure engine selection is within proper range based on transfer type
if ((is_xgmi && engine_offset < properties_.NumSdmaEngines) ||
(!is_xgmi && engine_offset >= properties_.NumSdmaEngines) ||
(!is_h2d_blit && !is_same_gpu && limit_h2d_blit && !engine_offset)) {
if ((is_xgmi && engine_offset <= properties_.NumSdmaEngines) ||
(!is_xgmi && engine_offset > properties_.NumSdmaEngines) ||
(!is_h2d_blit && !is_same_gpu && limit_h2d_blit && engine_offset == BlitHostToDev)) {
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
}
+2 -2
View File
@@ -511,8 +511,8 @@ hsa_status_t Runtime::CopyMemoryOnEngine(void* dst, core::Agent* dst_agent, cons
core::Agent* copy_agent = (src_gpu) ? src_agent : dst_agent;
// engine_id is single bitset unique.
int engine_offset = ffs(engine_id) - 1;
if (!engine_id || !!((engine_id >> (engine_offset + 1)))) {
int engine_offset = ffs(engine_id);
if (!engine_id || !!((engine_id >> engine_offset))) {
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
}