| 532 | } |
| 533 | |
| 534 | hipError_t hipModuleLaunchKernel(hipFunction_t f, uint32_t gridDimX, uint32_t gridDimY, |
| 535 | uint32_t gridDimZ, uint32_t blockDimX, uint32_t blockDimY, |
| 536 | uint32_t blockDimZ, uint32_t sharedMemBytes, hipStream_t hStream, |
| 537 | void** kernelParams, void** extra) { |
| 538 | HIP_INIT_API(hipModuleLaunchKernel, f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, |
| 539 | blockDimZ, sharedMemBytes, hStream, kernelParams, extra); |
| 540 | |
| 541 | if (!hip::isValid(hStream)) { |
| 542 | HIP_RETURN(hipErrorContextIsDestroyed); |
| 543 | } |
| 544 | |
| 545 | int deviceId = hip::Stream::DeviceId(hStream); |
| 546 | const amd::Device* device = g_devices[deviceId]->devices()[0]; |
| 547 | |
| 548 | STREAM_CAPTURE(hipModuleLaunchKernel, hStream, f, gridDimX, gridDimY, gridDimZ, blockDimX, |
| 549 | blockDimY, blockDimZ, sharedMemBytes, kernelParams, extra); |
| 550 | |
| 551 | constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max()); |
| 552 | constexpr auto uint16_max = static_cast<uint64_t>(std::numeric_limits<uint16_t>::max()) + 1; |
| 553 | if (gridDimX > int32_max || gridDimY > uint16_max || gridDimZ > uint16_max) { |
| 554 | HIP_RETURN(hipErrorInvalidValue); |
| 555 | } |
| 556 | |
| 557 | amd::HIPLaunchParams launch_params(gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, |
| 558 | sharedMemBytes); |
| 559 | if (!launch_params.IsValidConfig() || |
| 560 | launch_params.local_.product() > device->info().maxWorkGroupSize_) { |
| 561 | HIP_RETURN(hipErrorInvalidValue); |
| 562 | } |
| 563 | |
| 564 | if (sharedMemBytes > device->info().localMemSizePerCU_) { |
| 565 | HIP_RETURN(hipErrorInvalidValue); |
| 566 | } |
| 567 | |
| 568 | if (launch_params.global_[0] == 0 || launch_params.global_[1] == 0 || |
| 569 | launch_params.global_[2] == 0) { |
| 570 | HIP_RETURN(hipErrorInvalidValue); |
| 571 | } |
| 572 | |
| 573 | if (launch_params.local_[0] == 0 || launch_params.local_[1] == 0 || |
| 574 | launch_params.local_[2] == 0) { |
| 575 | HIP_RETURN(hipErrorInvalidValue); |
| 576 | } |
| 577 | |
| 578 | HIP_RETURN( |
| 579 | ihipModuleLaunchKernel(f, launch_params, hStream, kernelParams, extra, nullptr, nullptr)); |
| 580 | } |
| 581 | |
| 582 | hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX, |
| 583 | uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ, |
no test coverage detected