mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 00:09:02 +00:00
Define SubDevicesScopeGuarded in the harness and remove duplicate copies (#2379)
Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
@@ -377,4 +377,24 @@ public:
|
|||||||
size_t getSize() const { return allocsize; };
|
size_t getSize() const { return allocsize; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// scope guard helper to ensure proper releasing of sub devices
|
||||||
|
struct SubDevicesScopeGuarded
|
||||||
|
{
|
||||||
|
SubDevicesScopeGuarded(const cl_int dev_count)
|
||||||
|
{
|
||||||
|
sub_devices.resize(dev_count);
|
||||||
|
}
|
||||||
|
~SubDevicesScopeGuarded()
|
||||||
|
{
|
||||||
|
for (auto &device : sub_devices)
|
||||||
|
{
|
||||||
|
cl_int err = clReleaseDevice(device);
|
||||||
|
if (err != CL_SUCCESS)
|
||||||
|
log_error("\n Releasing sub-device failed \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<cl_device_id> sub_devices;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _typeWrappers_h
|
#endif // _typeWrappers_h
|
||||||
|
|||||||
@@ -27,24 +27,4 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
// scope guard helper to ensure proper releasing of sub devices
|
|
||||||
struct SubDevicesScopeGuarded
|
|
||||||
{
|
|
||||||
SubDevicesScopeGuarded(const cl_int dev_count)
|
|
||||||
{
|
|
||||||
sub_devices.resize(dev_count);
|
|
||||||
}
|
|
||||||
~SubDevicesScopeGuarded()
|
|
||||||
{
|
|
||||||
for (auto &device : sub_devices)
|
|
||||||
{
|
|
||||||
cl_int err = clReleaseDevice(device);
|
|
||||||
if (err != CL_SUCCESS)
|
|
||||||
log_error("\n Releasing sub-device failed \n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cl_device_id> sub_devices;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _testBase_h
|
#endif // _testBase_h
|
||||||
|
|||||||
@@ -45,27 +45,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// scope guard helper to ensure proper releasing of sub devices
|
|
||||||
struct SubDevicesScopeGuarded
|
|
||||||
{
|
|
||||||
SubDevicesScopeGuarded(const cl_int dev_count)
|
|
||||||
{
|
|
||||||
sub_devices.resize(dev_count);
|
|
||||||
}
|
|
||||||
~SubDevicesScopeGuarded()
|
|
||||||
{
|
|
||||||
for (auto &device : sub_devices)
|
|
||||||
{
|
|
||||||
cl_int err = clReleaseDevice(device);
|
|
||||||
if (err != CL_SUCCESS)
|
|
||||||
log_error("\n Releasing sub-device failed \n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cl_device_id> sub_devices;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _testBase_h
|
#endif // _testBase_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,26 +24,6 @@
|
|||||||
#include "harness/testHarness.h"
|
#include "harness/testHarness.h"
|
||||||
#include "harness/typeWrappers.h"
|
#include "harness/typeWrappers.h"
|
||||||
|
|
||||||
// scope guard helper to ensure proper releasing of sub devices
|
|
||||||
struct SubDevicesScopeGuarded
|
|
||||||
{
|
|
||||||
SubDevicesScopeGuarded(const cl_int dev_count)
|
|
||||||
{
|
|
||||||
sub_devices.resize(dev_count);
|
|
||||||
}
|
|
||||||
~SubDevicesScopeGuarded()
|
|
||||||
{
|
|
||||||
for (auto &device : sub_devices)
|
|
||||||
{
|
|
||||||
cl_int err = clReleaseDevice(device);
|
|
||||||
if (err != CL_SUCCESS)
|
|
||||||
log_error("\n Releasing sub-device failed \n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cl_device_id> sub_devices;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SemaphoreBase
|
struct SemaphoreBase
|
||||||
{
|
{
|
||||||
SemaphoreBase(cl_device_id device): device(device) {}
|
SemaphoreBase(cl_device_id device): device(device) {}
|
||||||
|
|||||||
@@ -30,26 +30,6 @@ enum class RunMode
|
|||||||
RM_SIGNAL
|
RM_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
// scope guard helper to ensure proper releasing of sub devices
|
|
||||||
struct SubDevicesScopeGuarded
|
|
||||||
{
|
|
||||||
SubDevicesScopeGuarded(const cl_int dev_count)
|
|
||||||
{
|
|
||||||
sub_devices.resize(dev_count);
|
|
||||||
}
|
|
||||||
~SubDevicesScopeGuarded()
|
|
||||||
{
|
|
||||||
for (auto& device : sub_devices)
|
|
||||||
{
|
|
||||||
cl_int err = clReleaseDevice(device);
|
|
||||||
if (err != CL_SUCCESS)
|
|
||||||
log_error("\n Releasing sub-device failed \n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cl_device_id> sub_devices;
|
|
||||||
};
|
|
||||||
|
|
||||||
// the device associated with command_queue is not same as one of the devices
|
// the device associated with command_queue is not same as one of the devices
|
||||||
// specified by CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR at the time of creating one
|
// specified by CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR at the time of creating one
|
||||||
// or more of sema_objects.
|
// or more of sema_objects.
|
||||||
|
|||||||
Reference in New Issue
Block a user