Skip to content

Commit 4f46a48

Browse files
committed
[OpenMP][libomptarget] Remove unused virtual functions in GenericKernelTy
The virtual functions getDefaultNumBlocks and getDefaultNumThreads from the kernels are only forwarding the call to the generic device's ones. This patch removes those two functions from the kernels (and their derived ones). Now calls are made to the device's functions directly. Differential Revision: https://reviews.llvm.org/D156905
1 parent f7e0208 commit 4f46a48

File tree

5 files changed

+2
-31
lines changed

5 files changed

+2
-31
lines changed

openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,6 @@ struct AMDGPUKernelTy : public GenericKernelTy {
469469
KernelArgsTy &KernelArgs, uint32_t NumThreads,
470470
uint64_t NumBlocks) const override;
471471

472-
/// The default number of blocks is common to the whole device.
473-
uint32_t getDefaultNumBlocks(GenericDeviceTy &GenericDevice) const override {
474-
return GenericDevice.getDefaultNumBlocks();
475-
}
476-
477-
/// The default number of threads is common to the whole device.
478-
uint32_t getDefaultNumThreads(GenericDeviceTy &GenericDevice) const override {
479-
return GenericDevice.getDefaultNumThreads();
480-
}
481-
482472
/// Get group and private segment kernel size.
483473
uint32_t getGroupSize() const { return GroupSize; }
484474
uint32_t getPrivateSize() const { return PrivateSize; }

openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ void AsyncInfoWrapperTy::finalize(Error &Err) {
227227

228228
Error GenericKernelTy::init(GenericDeviceTy &GenericDevice,
229229
DeviceImageTy &Image) {
230-
PreferredNumThreads = getDefaultNumThreads(GenericDevice);
231-
230+
PreferredNumThreads = GenericDevice.getDefaultNumThreads();
232231
MaxNumThreads = GenericDevice.getThreadLimit();
233232

234233
return initImpl(GenericDevice, Image);
@@ -318,7 +317,7 @@ uint64_t GenericKernelTy::getNumBlocks(GenericDeviceTy &GenericDevice,
318317
return std::min(NumTeamsClause[0], GenericDevice.getBlockLimit());
319318
}
320319

321-
uint64_t DefaultNumBlocks = getDefaultNumBlocks(GenericDevice);
320+
uint64_t DefaultNumBlocks = GenericDevice.getDefaultNumBlocks();
322321
uint64_t TripCountNumBlocks = std::numeric_limits<uint64_t>::max();
323322
if (LoopTripCount > 0) {
324323
if (isSPMDMode()) {

openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,6 @@ struct GenericKernelTy {
318318
llvm::SmallVectorImpl<void *> &Args,
319319
llvm::SmallVectorImpl<void *> &Ptrs) const;
320320

321-
/// Get the default number of threads and blocks for the kernel.
322-
virtual uint32_t getDefaultNumThreads(GenericDeviceTy &Device) const = 0;
323-
virtual uint32_t getDefaultNumBlocks(GenericDeviceTy &Device) const = 0;
324-
325321
/// Get the number of threads and blocks for the kernel based on the
326322
/// user-defined threads and block clauses.
327323
uint32_t getNumThreads(GenericDeviceTy &GenericDevice,

openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ struct CUDAKernelTy : public GenericKernelTy {
6666
uint64_t NumBlocks, KernelArgsTy &KernelArgs, void *Args,
6767
AsyncInfoWrapperTy &AsyncInfoWrapper) const override;
6868

69-
/// The default number of blocks is common to the whole device.
70-
uint32_t getDefaultNumBlocks(GenericDeviceTy &GenericDevice) const override {
71-
return GenericDevice.getDefaultNumBlocks();
72-
}
73-
74-
/// The default number of threads is common to the whole device.
75-
uint32_t getDefaultNumThreads(GenericDeviceTy &GenericDevice) const override {
76-
return GenericDevice.getDefaultNumThreads();
77-
}
78-
7969
private:
8070
/// The CUDA kernel function to execute.
8171
CUfunction Func;

openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ struct GenELF64KernelTy : public GenericKernelTy {
8484
return Plugin::success();
8585
}
8686

87-
/// Get the default number of blocks and threads for the kernel.
88-
uint32_t getDefaultNumBlocks(GenericDeviceTy &) const override { return 1; }
89-
uint32_t getDefaultNumThreads(GenericDeviceTy &) const override { return 1; }
90-
9187
private:
9288
/// The kernel function to execute.
9389
void (*Func)(void);

0 commit comments

Comments
 (0)