| 184 | } |
| 185 | |
| 186 | hipError_t ihipGraphAddMemsetNode(hip::GraphNode** pGraphNode, hip::Graph* graph, |
| 187 | hip::GraphNode* const* pDependencies, size_t numDependencies, |
| 188 | const hipMemsetParams* pMemsetParams, bool capture = true, |
| 189 | size_t depth = 1, size_t arrWidth = 1, size_t arrHeight = 1, |
| 190 | int devId = 0) { |
| 191 | if (pGraphNode == nullptr || graph == nullptr || pMemsetParams == nullptr || |
| 192 | (numDependencies > 0 && pDependencies == nullptr) || pMemsetParams->height == 0) { |
| 193 | return hipErrorInvalidValue; |
| 194 | } |
| 195 | // The element size must be 1, 2, or 4 bytes |
| 196 | if (pMemsetParams->elementSize != sizeof(int8_t) && |
| 197 | pMemsetParams->elementSize != sizeof(int16_t) && |
| 198 | pMemsetParams->elementSize != sizeof(int32_t)) { |
| 199 | return hipErrorInvalidValue; |
| 200 | } |
| 201 | hipError_t status; |
| 202 | status = ihipGraphMemsetParams_validate(pMemsetParams); |
| 203 | if (status != hipSuccess) { |
| 204 | return status; |
| 205 | } |
| 206 | if (depth == 0) { |
| 207 | return hipErrorInvalidValue; |
| 208 | } |
| 209 | if (pMemsetParams->height == 1) { |
| 210 | status = |
| 211 | ihipMemset_validate(pMemsetParams->dst, pMemsetParams->value, pMemsetParams->elementSize, |
| 212 | pMemsetParams->width * pMemsetParams->elementSize); |
| 213 | } else { |
| 214 | if (pMemsetParams->pitch < (pMemsetParams->width * pMemsetParams->elementSize)) { |
| 215 | return hipErrorInvalidValue; |
| 216 | } |
| 217 | auto sizeBytes = |
| 218 | pMemsetParams->width * pMemsetParams->height * depth * pMemsetParams->elementSize; |
| 219 | status = ihipMemset3D_validate( |
| 220 | {pMemsetParams->dst, pMemsetParams->pitch, pMemsetParams->width, pMemsetParams->height}, |
| 221 | pMemsetParams->value, {pMemsetParams->width, pMemsetParams->height, depth}, sizeBytes); |
| 222 | } |
| 223 | if (status != hipSuccess) { |
| 224 | return status; |
| 225 | } |
| 226 | *pGraphNode = new hip::GraphMemsetNode(pMemsetParams, depth, arrWidth, arrHeight); |
| 227 | status = ihipGraphAddNode(*pGraphNode, graph, pDependencies, numDependencies, capture, devId); |
| 228 | return status; |
| 229 | } |
| 230 | |
| 231 | hipError_t capturehipLaunchKernel(hipStream_t& stream, const void*& hostFunction, dim3& gridDim, |
| 232 | dim3& blockDim, void**& args, size_t& sharedMemBytes) { |
no test coverage detected