Define SubDevicesScopeGuarded in the harness and remove duplicate copies (#2379)
Some checks failed
Presubmit / Build ubuntu-22.04 gl (push) Failing after 1s
Presubmit / Build ubuntu-22.04 aarch64 debug (push) Failing after 1s
Presubmit / Build ubuntu-22.04 arm (push) Failing after 1s
Presubmit / Build ubuntu-22.04 android-aarch64 (push) Failing after 1s
Presubmit / Build ubuntu-22.04 android-arm (push) Failing after 1s
Presubmit / Check code format (push) Failing after 5m1s
Presubmit / Build macos-latest (push) Has been cancelled
Presubmit / Build windows-latest (push) Has been cancelled

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit 2025-04-21 11:16:17 +01:00 committed by GitHub
parent 90524879e4
commit 9fc0d23b4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 83 deletions

View file

@ -377,4 +377,24 @@ public:
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

View file

@ -27,24 +27,4 @@
#include <sys/types.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

View file

@ -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

View file

@ -24,26 +24,6 @@
#include "harness/testHarness.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
{
SemaphoreBase(cl_device_id device): device(device) {}

View file

@ -30,26 +30,6 @@ enum class RunMode
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
// specified by CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR at the time of creating one
// or more of sema_objects.