Skip to content

Commit 81d20d8

Browse files
committed
[Offload][NFC] Fix warning messages in runtime
Summary: These are lots of random warnings due to inconsistent initialization or signedness.
1 parent ec1f28d commit 81d20d8

File tree

6 files changed

+14
-21
lines changed

6 files changed

+14
-21
lines changed

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,10 +1670,10 @@ struct AMDGPUStreamManagerTy final
16701670
hsa_agent_t Agent;
16711671

16721672
/// The maximum number of queues.
1673-
int MaxNumQueues;
1673+
uint32_t MaxNumQueues;
16741674

16751675
/// The size of created queues.
1676-
int QueueSize;
1676+
uint32_t QueueSize;
16771677
};
16781678

16791679
/// Abstract class that holds the common members of the actual kernel devices
@@ -1847,8 +1847,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
18471847
// Create an AMDGPU device with a device id and default AMDGPU grid values.
18481848
AMDGPUDeviceTy(GenericPluginTy &Plugin, int32_t DeviceId, int32_t NumDevices,
18491849
AMDHostDeviceTy &HostDevice, hsa_agent_t Agent)
1850-
: GenericDeviceTy(Plugin, DeviceId, NumDevices, {0}),
1851-
AMDGenericDeviceTy(),
1850+
: GenericDeviceTy(Plugin, DeviceId, NumDevices, {}), AMDGenericDeviceTy(),
18521851
OMPX_NumQueues("LIBOMPTARGET_AMDGPU_NUM_HSA_QUEUES", 4),
18531852
OMPX_QueueSize("LIBOMPTARGET_AMDGPU_HSA_QUEUE_SIZE", 512),
18541853
OMPX_DefaultTeamsPerCU("LIBOMPTARGET_AMDGPU_TEAMS_PER_CU", 4),
@@ -2015,9 +2014,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
20152014
return Plugin::success();
20162015
}
20172016

2018-
const uint64_t getStreamBusyWaitMicroseconds() const {
2019-
return OMPX_StreamBusyWait;
2020-
}
2017+
uint64_t getStreamBusyWaitMicroseconds() const { return OMPX_StreamBusyWait; }
20212018

20222019
Expected<std::unique_ptr<MemoryBuffer>>
20232020
doJITPostProcessing(std::unique_ptr<MemoryBuffer> MB) const override {

offload/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void *GenericKernelTy::prepareArgs(
593593
Args[0] = &Ptrs[0];
594594
}
595595

596-
for (int I = KLEOffset; I < NumArgs; ++I) {
596+
for (uint32_t I = KLEOffset; I < NumArgs; ++I) {
597597
Ptrs[I] =
598598
(void *)((intptr_t)ArgPtrs[I - KLEOffset] + ArgOffsets[I - KLEOffset]);
599599
Args[I] = &Ptrs[I];

offload/src/LegacyAPI.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ EXTERN int __tgt_target_mapper(ident_t *Loc, int64_t DeviceId, void *HostPtr,
8888
TIMESCOPE_WITH_IDENT(Loc);
8989
OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
9090
KernelArgsTy KernelArgs{1, ArgNum, ArgsBase, Args, ArgSizes,
91-
ArgTypes, ArgNames, ArgMappers, 0};
91+
ArgTypes, ArgNames, ArgMappers, 0, {},
92+
{}, {}, 0};
9293
return __tgt_target_kernel(Loc, DeviceId, -1, -1, HostPtr, &KernelArgs);
9394
}
9495

@@ -132,7 +133,8 @@ EXTERN int __tgt_target_teams_mapper(ident_t *Loc, int64_t DeviceId,
132133
TIMESCOPE_WITH_IDENT(Loc);
133134
OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
134135
KernelArgsTy KernelArgs{1, ArgNum, ArgsBase, Args, ArgSizes,
135-
ArgTypes, ArgNames, ArgMappers, 0};
136+
ArgTypes, ArgNames, ArgMappers, 0, {},
137+
{}, {}, 0};
136138
return __tgt_target_kernel(Loc, DeviceId, NumTeams, ThreadLimit, HostPtr,
137139
&KernelArgs);
138140
}

offload/src/OpenMP/API.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ EXTERN void *omp_get_mapped_ptr(const void *Ptr, int DeviceNum) {
642642
return nullptr;
643643
}
644644

645-
size_t NumDevices = omp_get_initial_device();
645+
int NumDevices = omp_get_initial_device();
646646
if (DeviceNum == NumDevices) {
647647
DP("Device %d is initial device, returning Ptr " DPxMOD ".\n",
648648
DeviceNum, DPxPTR(Ptr));

offload/src/OpenMP/Mapping.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,7 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
314314

315315
// Notify the plugin about the new mapping.
316316
if (Device.notifyDataMapped(HstPtrBegin, Size))
317-
return {{false /*IsNewEntry=*/, false /*IsHostPointer=*/},
318-
nullptr /*Entry=*/,
319-
nullptr /*TargetPointer=*/};
317+
return TargetPointerResultTy{};
320318
} else {
321319
// This entry is not present and we did not create a new entry for it.
322320
LR.TPR.Flags.IsPresent = false;
@@ -344,9 +342,7 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
344342
LR.TPR.TargetPointer = nullptr;
345343
} else if (LR.TPR.getEntry()->addEventIfNecessary(Device, AsyncInfo) !=
346344
OFFLOAD_SUCCESS)
347-
return {{false /*IsNewEntry=*/, false /*IsHostPointer=*/},
348-
nullptr /*Entry=*/,
349-
nullptr /*TargetPointer=*/};
345+
return TargetPointerResultTy{};
350346
} else {
351347
// If not a host pointer and no present modifier, we need to wait for the
352348
// event if it exists.
@@ -360,9 +356,7 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
360356
// If it fails to wait for the event, we need to return nullptr in
361357
// case of any data race.
362358
REPORT("Failed to wait for event " DPxMOD ".\n", DPxPTR(Event));
363-
return {{false /*IsNewEntry=*/, false /*IsHostPointer=*/},
364-
nullptr /*Entry=*/,
365-
nullptr /*TargetPointer=*/};
359+
return TargetPointerResultTy{};
366360
}
367361
}
368362
}

offload/src/omptarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ int target_replay(ident_t *Loc, DeviceTy &Device, void *HostPtr,
17501750
TARGET_ALLOC_DEFAULT);
17511751
Device.submitData(TgtPtr, DeviceMemory, DeviceMemorySize, AsyncInfo);
17521752

1753-
KernelArgsTy KernelArgs = {0};
1753+
KernelArgsTy KernelArgs{};
17541754
KernelArgs.Version = OMP_KERNEL_ARG_VERSION;
17551755
KernelArgs.NumArgs = NumArgs;
17561756
KernelArgs.Tripcount = LoopTripCount;

0 commit comments

Comments
 (0)