Skip to content

Commit 64d6f57

Browse files
authored
SWDEV-523281 - CHANGELOG.md and negative test return values : hipLaunchKernelEx, hipLaunchKernelExC, hipDrvLaunchKernelEx (#155)
1 parent a5c860f commit 64d6f57

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Full documentation for HIP is available at [rocm.docs.amd.com](https://rocm.docs
66

77
### Added
88

9+
* New HIP APIs
10+
- `hipLaunchKernelEx` dispatches the provided kernel with the given launch configuration and forwards the kernel arguments.
11+
- `hipLaunchKernelExC` launches a HIP kernel using a generic function pointer and the specified configuration.
12+
- `hipDrvLaunchKernelEx` dispatches the device kernel represented by a HIP function object
913
* New support for Open Compute Project (OCP) floating-point `FP4`/`FP6`/`FP8` as the following. For details, see [Low precision floating point document](https://rocm.docs.amd.com/projects/HIP/en/latest/reference/low_fp_types.html).
1014
- Data types for `FP4`/`FP6`/`FP8`.
1115
- HIP APIs for `FP4`/`FP6`/`FP8`, which are compatible with corresponding CUDA APIs.
@@ -35,7 +39,6 @@ HIP runtime has the following functional improvements which greatly improve runt
3539

3640
* Error of "unable to find modules" in HIP clean up for code object module.
3741

38-
3942
## HIP 6.4 (For ROCm 6.4)
4043

4144
### Added

hipamd/src/hip_module.cpp

+26-3
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,10 @@ hipError_t hipLaunchCooperativeKernel_common(const void* f, dim3 gridDim, dim3 b
824824
return hipErrorCooperativeLaunchTooLarge;
825825
}
826826

827+
if (globalWorkSizeX == 0 || globalWorkSizeY == 0 || globalWorkSizeZ == 0) {
828+
return hipErrorInvalidConfiguration;
829+
}
830+
827831
return ihipModuleLaunchKernel(func, static_cast<uint32_t>(globalWorkSizeX),
828832
static_cast<uint32_t>(globalWorkSizeY),
829833
static_cast<uint32_t>(globalWorkSizeZ), blockDim.x, blockDim.y,
@@ -1086,11 +1090,19 @@ hipError_t hipLinkDestroy(hipLinkState_t hip_link_state) {
10861090

10871091
hipError_t hipLaunchKernelExC(const hipLaunchConfig_t* config, const void* fPtr, void** args) {
10881092
HIP_INIT_API(hipLaunchKernelExC, config, fPtr, args);
1093+
if (fPtr == nullptr) {
1094+
HIP_RETURN(hipErrorInvalidDeviceFunction);
1095+
}
10891096

1090-
if (fPtr == nullptr || config == nullptr || config->numAttrs == 0) {
1097+
if (config == nullptr) {
10911098
HIP_RETURN(hipErrorInvalidConfiguration);
10921099
}
10931100

1101+
if (config->numAttrs == 0) {
1102+
HIP_RETURN_DURATION(hipLaunchKernel_common(fPtr, config->gridDim, config->blockDim, args,
1103+
config->dynamicSmemBytes, config->stream));
1104+
}
1105+
10941106
for (size_t attr_idx = 0; attr_idx < config->numAttrs; ++attr_idx) {
10951107
hipLaunchAttribute& attr = config->attrs[attr_idx];
10961108
switch (attr.id) {
@@ -1112,9 +1124,12 @@ hipError_t hipLaunchKernelExC(const hipLaunchConfig_t* config, const void* fPtr,
11121124
hipError_t hipDrvLaunchKernelEx(const HIP_LAUNCH_CONFIG* config, hipFunction_t f,
11131125
void** kernelParams, void** extra) {
11141126
HIP_INIT_API(hipDrvLaunchKernelEx, config, f, kernelParams, extra);
1127+
if (f == nullptr) {
1128+
HIP_RETURN(hipErrorInvalidResourceHandle);
1129+
}
11151130

1116-
if (f == nullptr || config == nullptr || config->numAttrs == 0) {
1117-
HIP_RETURN(hipErrorInvalidConfiguration);
1131+
if (config == nullptr) {
1132+
HIP_RETURN(hipErrorInvalidValue);
11181133
}
11191134

11201135
size_t globalWorkSizeX = static_cast<size_t>(config->gridDimX) * config->blockDimX;
@@ -1126,6 +1141,14 @@ hipError_t hipDrvLaunchKernelEx(const HIP_LAUNCH_CONFIG* config, hipFunction_t f
11261141
HIP_RETURN(hipErrorInvalidConfiguration);
11271142
}
11281143

1144+
if (config->numAttrs == 0) {
1145+
HIP_RETURN(ihipModuleLaunchKernel(
1146+
f, static_cast<uint32_t>(globalWorkSizeX), static_cast<uint32_t>(globalWorkSizeY),
1147+
static_cast<uint32_t>(globalWorkSizeZ), config->blockDimX, config->blockDimY,
1148+
config->blockDimZ, config->sharedMemBytes, config->hStream, kernelParams, nullptr,
1149+
nullptr, nullptr, 0));
1150+
}
1151+
11291152
for (size_t attr_idx = 0; attr_idx < config->numAttrs; ++attr_idx) {
11301153
hipLaunchAttribute& attr = config->attrs[attr_idx];
11311154
switch (attr.id) {

0 commit comments

Comments
 (0)