SWDEV-232903 - Move hipmemset dword optimization into ROCclr.

Change-Id: I1af437de2771f6a48d06ce643ade6b79f551a55c


[ROCm/clr commit: 4d1195f0a7]
Αυτή η υποβολή περιλαμβάνεται σε:
kjayapra-amd
2021-08-23 21:51:09 -04:00
υποβλήθηκε από Karthik Jayaprakash
γονέας b6ab3bbc80
υποβολή 7c4dfc27a7
@@ -2238,55 +2238,10 @@ hipError_t ihipMemsetCommand(std::vector<amd::Command*>& commands, void* dst, in
int64_t value64 = 0;
amd::Command* command;
if (sizeBytes / sizeof(int64_t) > 0) {
n_head_bytes = static_cast<uint8_t*>(aligned_dst) - static_cast<uint8_t*>(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<address>(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;
}