summaryrefslogtreecommitdiff
path: root/opencl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-11 16:40:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-11 21:13:51 +0100
commitef8674a48888e2601653fd6481b6542914ffd97c (patch)
treecda7a994e6838380fb4f50ac9939437176e83075 /opencl
parentc544432c049ee93536386a77da1f1d9562ea3b48 (diff)
pickBestDevice return is ignored
so might as well return the BestDeviceIndex instead of passing it by ref Change-Id: Ic92fa3b5bfe3d319ff9fcb61b7f5404b5a624be5 Reviewed-on: https://gerrit.libreoffice.org/84971 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'opencl')
-rw-r--r--opencl/source/opencl_device.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index 85a5b3ef6ec9..fe6f92a34ee6 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -333,11 +333,11 @@ ds_status profileDevices(std::unique_ptr<ds_profile> const & pProfile, std::uniq
}
/* Pick best device */
-ds_status pickBestDevice(std::unique_ptr<ds_profile> const & profile, int& rBestDeviceIndex)
+int pickBestDevice(std::unique_ptr<ds_profile> const & profile)
{
double bestScore = DBL_MAX;
- rBestDeviceIndex = -1;
+ int nBestDeviceIndex = -1;
for (std::vector<ds_device>::size_type d = 0; d < profile->devices.size();
d++)
@@ -390,18 +390,18 @@ ds_status pickBestDevice(std::unique_ptr<ds_profile> const & profile, int& rBest
if (fScore < bestScore)
{
bestScore = fScore;
- rBestDeviceIndex = d;
+ nBestDeviceIndex = d;
}
}
- if (rBestDeviceIndex != -1 && profile->devices[rBestDeviceIndex].eType == DeviceType::OpenCLDevice)
+ if (nBestDeviceIndex != -1 && profile->devices[nBestDeviceIndex].eType == DeviceType::OpenCLDevice)
{
- SAL_INFO("opencl.device", "Selected Device[" << rBestDeviceIndex << "]: " << profile->devices[rBestDeviceIndex].sDeviceName << "(OpenCL).");
+ SAL_INFO("opencl.device", "Selected Device[" << nBestDeviceIndex << "]: " << profile->devices[nBestDeviceIndex].sDeviceName << "(OpenCL).");
}
else
{
- SAL_INFO("opencl.device", "Selected Device[" << rBestDeviceIndex << "]: CPU (Native).");
+ SAL_INFO("opencl.device", "Selected Device[" << nBestDeviceIndex << "]: CPU (Native).");
}
- return DS_SUCCESS;
+ return nBestDeviceIndex;
}
/* Return device ID for matching device name */
@@ -566,8 +566,7 @@ ds_device const & getDeviceSelection(
}
/* Pick best device */
- int bestDeviceIdx;
- pickBestDevice(aProfile, bestDeviceIdx);
+ int bestDeviceIdx = pickBestDevice(aProfile);
/* Override if necessary */
char* overrideDeviceStr = getenv("SC_OPENCL_DEVICE_OVERRIDE");