Skip to content

Commit 45506f3

Browse files
authored
Merge pull request #1244 from kbenzie/benie/hip-fix-maybe-uninitialized
[HIP] Fix maybe uninitialized warnings
2 parents 79c28d0 + e6e822a commit 45506f3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

source/adapters/hip/enqueue.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
10711071

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

1074-
hipArray_Format Format;
1075-
size_t NumChannels;
1074+
hipArray_Format Format{};
1075+
size_t NumChannels{};
10761076
UR_CHECK_ERROR(getArrayDesc(Array, Format, NumChannels));
10771077

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

1135-
hipArray_Format Format;
1136-
size_t NumChannels;
1135+
hipArray_Format Format{};
1136+
size_t NumChannels{};
11371137
UR_CHECK_ERROR(getArrayDesc(Array, Format, NumChannels));
11381138

11391139
int ElementByteSize = imageElementByteSize(Format);
@@ -1195,14 +1195,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy(
11951195

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

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

12081208
UR_ASSERT(SrcFormat == DstFormat,

source/adapters/hip/kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ urKernelSetArgMemObj(ur_kernel_handle_t hKernel, uint32_t argIndex,
280280
hKernel->Args.addMemObjArg(argIndex, hArgValue, Properties->memoryAccess);
281281
if (hArgValue->isImage()) {
282282
auto array = std::get<SurfaceMem>(hArgValue->Mem).getArray(Device);
283-
hipArray_Format Format;
283+
hipArray_Format Format{};
284284
size_t NumChannels;
285285
UR_CHECK_ERROR(getArrayDesc(array, Format, NumChannels));
286286
if (Format != HIP_AD_FORMAT_UNSIGNED_INT32 &&

0 commit comments

Comments
 (0)