SWDEV-440866 - [hip-roclr] Adds support to batch memory operations APIs

Change-Id: I449ffca44bbb04d13348d112e896d603c70fd485
This commit is contained in:
Sourabh Betigeri
2024-03-26 10:22:35 -07:00
کامیت شده توسط Sourabh Betigeri
والد c47f9dda58
کامیت bd5d8e9baf
18فایلهای تغییر یافته به همراه217 افزوده شده و 16 حذف شده
+40 -1
مشاهده پرونده
@@ -23,8 +23,36 @@
#include "platform/command_utils.hpp"
namespace hip {
hipError_t ihipBatchMemOperation(hipStream_t stream, cl_command_type cmdType, unsigned int count,
hipStreamBatchMemOpParams* paramArray, unsigned int flags) {
if (paramArray == nullptr || flags != 0 || count > 256) {
return hipErrorInvalidValue;
}
if (!hip::isValid(stream)) {
return hipErrorContextIsDestroyed;
}
hip::Stream* hip_stream = hip::getStream(stream);
amd::Command::EventWaitList waitList;
amd::BatchMemoryOperationCommand* command =
new amd::BatchMemoryOperationCommand(*hip_stream, cmdType, count,
flags, waitList, paramArray,
sizeof(hipStreamBatchMemOpParams));
if (command == nullptr) {
return hipErrorOutOfMemory;
}
command->enqueue();
command->release();
HIP_RETURN(hipSuccess);
}
hipError_t ihipStreamOperation(hipStream_t stream, cl_command_type cmdType, void* ptr,
uint64_t value, uint64_t mask, unsigned int flags, size_t sizeBytes) {
uint64_t value, uint64_t mask, unsigned int flags,
size_t sizeBytes) {
size_t offset = 0;
unsigned int outFlags = 0;
@@ -136,4 +164,15 @@ hipError_t hipStreamWriteValue64(hipStream_t stream, void* ptr, uint64_t value,
0, // flags un-used for now set it to 0
sizeof(uint64_t)));
}
hipError_t hipStreamBatchMemOp(hipStream_t stream, unsigned int count,
hipStreamBatchMemOpParams* paramArray, unsigned int flags) {
HIP_INIT_API(hipStreamBatchMemOp, count, paramArray, flags);
HIP_RETURN_DURATION(ihipBatchMemOperation(
stream,
ROCCLR_COMMAND_BATCH_STREAM,
count,
paramArray,
flags));
}
} // namespace hip