Skip to content

Commit

Permalink
Merge pull request #1244 from kbenzie/benie/hip-fix-maybe-uninitialized
Browse files Browse the repository at this point in the history
[HIP] Fix maybe uninitialized warnings
  • Loading branch information
kbenzie authored Jan 15, 2024
2 parents 79c28d0 + e6e822a commit 45506f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions source/adapters/hip/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(

hipArray *Array = std::get<SurfaceMem>(hImage->Mem).getArray(Device);

hipArray_Format Format;
size_t NumChannels;
hipArray_Format Format{};
size_t NumChannels{};
UR_CHECK_ERROR(getArrayDesc(Array, Format, NumChannels));

int ElementByteSize = imageElementByteSize(Format);
Expand Down Expand Up @@ -1132,8 +1132,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite(
hipArray *Array =
std::get<SurfaceMem>(hImage->Mem).getArray(hQueue->getDevice());

hipArray_Format Format;
size_t NumChannels;
hipArray_Format Format{};
size_t NumChannels{};
UR_CHECK_ERROR(getArrayDesc(Array, Format, NumChannels));

int ElementByteSize = imageElementByteSize(Format);
Expand Down Expand Up @@ -1195,14 +1195,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy(

hipArray *SrcArray =
std::get<SurfaceMem>(hImageSrc->Mem).getArray(hQueue->getDevice());
hipArray_Format SrcFormat;
size_t SrcNumChannels;
hipArray_Format SrcFormat{};
size_t SrcNumChannels{};
UR_CHECK_ERROR(getArrayDesc(SrcArray, SrcFormat, SrcNumChannels));

hipArray *DstArray =
std::get<SurfaceMem>(hImageDst->Mem).getArray(hQueue->getDevice());
hipArray_Format DstFormat;
size_t DstNumChannels;
hipArray_Format DstFormat{};
size_t DstNumChannels{};
UR_CHECK_ERROR(getArrayDesc(DstArray, DstFormat, DstNumChannels));

UR_ASSERT(SrcFormat == DstFormat,
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/hip/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ urKernelSetArgMemObj(ur_kernel_handle_t hKernel, uint32_t argIndex,
hKernel->Args.addMemObjArg(argIndex, hArgValue, Properties->memoryAccess);
if (hArgValue->isImage()) {
auto array = std::get<SurfaceMem>(hArgValue->Mem).getArray(Device);
hipArray_Format Format;
hipArray_Format Format{};
size_t NumChannels;
UR_CHECK_ERROR(getArrayDesc(array, Format, NumChannels));
if (Format != HIP_AD_FORMAT_UNSIGNED_INT32 &&
Expand Down

0 comments on commit 45506f3

Please sign in to comment.