| 2863 | } |
| 2864 | |
| 2865 | hipError_t packFillMemoryCommand(amd::Command*& command, amd::Memory* memory, size_t offset, |
| 2866 | int64_t value, size_t valueSize, size_t sizeBytes, |
| 2867 | hip::Stream* stream) { |
| 2868 | if ((memory == nullptr) || (stream == nullptr)) { |
| 2869 | return hipErrorInvalidValue; |
| 2870 | } |
| 2871 | |
| 2872 | amd::Command::EventWaitList waitList; |
| 2873 | amd::Coord3D fillOffset(offset, 0, 0); |
| 2874 | amd::Coord3D fillSize(sizeBytes, 1, 1); |
| 2875 | // surface=[pitch, width, height] |
| 2876 | amd::Coord3D surface(sizeBytes, sizeBytes, 1); |
| 2877 | amd::FillMemoryCommand* fillMemCommand = |
| 2878 | new amd::FillMemoryCommand(*stream, CL_COMMAND_FILL_BUFFER, waitList, *memory->asBuffer(), |
| 2879 | &value, valueSize, fillOffset, fillSize, surface); |
| 2880 | if (fillMemCommand == nullptr) { |
| 2881 | return hipErrorOutOfMemory; |
| 2882 | } |
| 2883 | |
| 2884 | if (!fillMemCommand->validatePeerMemory()) { |
| 2885 | delete fillMemCommand; |
| 2886 | return hipErrorInvalidValue; |
| 2887 | } |
| 2888 | command = fillMemCommand; |
| 2889 | return hipSuccess; |
| 2890 | } |
| 2891 | |
| 2892 | hipError_t ihipMemset_validate(void* dst, int64_t value, size_t valueSize, size_t sizeBytes) { |
| 2893 | if (sizeBytes == 0) { |
no test coverage detected