From 7c4dfc27a7704ff68d58fd15178e2d02a34192f0 Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Mon, 23 Aug 2021 21:51:09 -0400 Subject: [PATCH] SWDEV-232903 - Move hipmemset dword optimization into ROCclr. Change-Id: I1af437de2771f6a48d06ce643ade6b79f551a55c [ROCm/clr commit: 4d1195f0a791f7b423172ee9e036ac811a9494a2] --- projects/clr/hipamd/src/hip_memory.cpp | 51 ++------------------------ 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index 33dbea764e..284a314d0e 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -2238,55 +2238,10 @@ hipError_t ihipMemsetCommand(std::vector& commands, void* dst, in int64_t value64 = 0; amd::Command* command; - if (sizeBytes / sizeof(int64_t) > 0) { - n_head_bytes = static_cast(aligned_dst) - static_cast(dst); - n_tail_bytes = ((sizeBytes - n_head_bytes) % sizeof(int64_t)); - offset = offset + n_head_bytes; - size_t n_bytes = sizeBytes - n_tail_bytes - n_head_bytes; - if (n_bytes > 0) { - if (valueSize == sizeof(int8_t)) { - value = value & 0xff; - value64 = ((value << 56) | (value << 48) | (value << 40) | (value << 32) | (value << 24) | - (value << 16) | (value << 8) | (value)); - } else if (valueSize == sizeof(int16_t)) { - value = value & 0xffff; - value64 = ((value << 48) | (value << 32) | (value << 16) | (value)); - } else if (valueSize == sizeof(int32_t)) { - value = value & 0xffffffff; - value64 = ((value << 32) | (value)); - } else if (valueSize == sizeof(int64_t)) { - value64 = value; - } else { - LogPrintfError("Unsupported Pattern size: %u \n", valueSize); - return hipErrorInvalidValue; - } - // If n_tail_bytes is != 0 then we will do a second fillBuffer Command - // on the same stream below, dont wait, do the first call async. - hip_error = - packFillMemoryCommand(command, memory, offset, value64, sizeof(int64_t), n_bytes, queue); - commands.push_back(command); - } - if (hip_error != hipSuccess) { - return hip_error; - } - } else { - n_head_bytes = sizeBytes; - } + hip_error = packFillMemoryCommand(command, memory, offset, value, valueSize, sizeBytes, + queue); + commands.push_back(command); - if (n_head_bytes != 0) { - memory = getMemoryObject(dst, offset); - hip_error = - packFillMemoryCommand(command, memory, offset, value, valueSize, n_head_bytes, queue); - commands.push_back(command); - } - - if (n_tail_bytes != 0) { - void* new_dst = (reinterpret_cast
(dst) + sizeBytes) - n_tail_bytes; - memory = getMemoryObject(new_dst, offset); - hip_error = - packFillMemoryCommand(command, memory, offset, value, valueSize, n_tail_bytes, queue); - commands.push_back(command); - } return hip_error; }