mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Improve MTdataHolder design and use it in math_brute_force (#1490)
Improve the design of the MTdataHolder wrapper: * Make it a class instead of a struct with a private member, to make it clearer that there is no direct access to the MTdata member. * Make the 1-arg constructor `explicit` to avoid unintended conversions. * Forbid copy construction/assignment as MTdataHolder is never initialised from an MTdataHolder object in the codebase. * Define move construction/assignment as per the "rule of five". Use the MTdataHolder class throughout math_brute_force, to simplify code by avoiding manual resource management. Original patch by Marco Antognini. Signed-off-by: Marco Antognini <marco.antognini@arm.com> Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com> Signed-off-by: Marco Antognini <marco.antognini@arm.com> Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
committed by
GitHub
parent
a87e686757
commit
8f9c1960ff
@@ -132,7 +132,7 @@ struct ThreadInfo
|
||||
maxErrorValue; // position of the max error value (param 1). Init to 0.
|
||||
double maxErrorValue2; // position of the max error value (param 2). Init
|
||||
// to 0.
|
||||
MTdata d;
|
||||
MTdataHolder d;
|
||||
|
||||
// Per thread command queue to improve performance
|
||||
clCommandQueueWrapper tQueue;
|
||||
@@ -848,7 +848,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
test_info.k[i].resize(test_info.threadCount, nullptr);
|
||||
}
|
||||
|
||||
test_info.tinfo.resize(test_info.threadCount, ThreadInfo{});
|
||||
test_info.tinfo.resize(test_info.threadCount);
|
||||
for (cl_uint i = 0; i < test_info.threadCount; i++)
|
||||
{
|
||||
cl_buffer_region region = {
|
||||
@@ -897,7 +897,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
test_info.tinfo[i].d = init_genrand(genrand_int32(d));
|
||||
test_info.tinfo[i].d = MTdataHolder(genrand_int32(d));
|
||||
}
|
||||
|
||||
// Init the kernels
|
||||
@@ -949,10 +949,5 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &threadInfo : test_info.tinfo)
|
||||
{
|
||||
free_mtdata(threadInfo.d);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user