Create platformsImpl when needed
Change-Id: Ie89356761fc39910c765066d40cd363c93002692 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
38ecb25ee6
commit
48c084ca32
|
@ -8,6 +8,9 @@
|
||||||
#include "opencl/source/platform/platform.h"
|
#include "opencl/source/platform/platform.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
void __attribute__((constructor)) platformsConstructor() {
|
||||||
|
platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
||||||
|
}
|
||||||
void __attribute__((destructor)) platformsDestructor() {
|
void __attribute__((destructor)) platformsDestructor() {
|
||||||
delete platformsImpl;
|
delete platformsImpl;
|
||||||
platformsImpl = nullptr;
|
platformsImpl = nullptr;
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
|
|
||||||
#include "opencl/source/platform/platform.h"
|
#include "opencl/source/platform/platform.h"
|
||||||
|
|
||||||
namespace NEO {
|
using namespace NEO;
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||||
if (fdwReason == DLL_PROCESS_DETACH) {
|
if (fdwReason == DLL_PROCESS_DETACH) {
|
||||||
delete platformsImpl;
|
delete platformsImpl;
|
||||||
}
|
}
|
||||||
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
|
platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} // namespace NEO
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Platform>> *platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
std::vector<std::unique_ptr<Platform>> *platformsImpl = nullptr;
|
||||||
|
|
||||||
Platform::Platform(ExecutionEnvironment &executionEnvironmentIn) : executionEnvironment(executionEnvironmentIn) {
|
Platform::Platform(ExecutionEnvironment &executionEnvironmentIn) : executionEnvironment(executionEnvironmentIn) {
|
||||||
clDevices.reserve(4);
|
clDevices.reserve(4);
|
||||||
|
|
|
@ -72,6 +72,7 @@ extern std::string lastTest;
|
||||||
bool generateRandomInput = false;
|
bool generateRandomInput = false;
|
||||||
|
|
||||||
void applyWorkarounds() {
|
void applyWorkarounds() {
|
||||||
|
platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
||||||
platformsImpl->reserve(1);
|
platformsImpl->reserve(1);
|
||||||
{
|
{
|
||||||
std::ofstream f;
|
std::ofstream f;
|
||||||
|
@ -152,6 +153,7 @@ void initializeTestHelpers() {
|
||||||
|
|
||||||
void cleanTestHelpers() {
|
void cleanTestHelpers() {
|
||||||
GlobalMockSipProgram::shutDownSipProgram();
|
GlobalMockSipProgram::shutDownSipProgram();
|
||||||
|
delete platformsImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getHardwarePrefix() {
|
std::string getHardwarePrefix() {
|
||||||
|
@ -440,6 +442,5 @@ int main(int argc, char **argv) {
|
||||||
retVal = RUN_ALL_TESTS();
|
retVal = RUN_ALL_TESTS();
|
||||||
|
|
||||||
cleanTestHelpers();
|
cleanTestHelpers();
|
||||||
delete platformsImpl;
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ extern std::string lastTest;
|
||||||
bool generateRandomInput = false;
|
bool generateRandomInput = false;
|
||||||
|
|
||||||
void applyWorkarounds() {
|
void applyWorkarounds() {
|
||||||
|
platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
||||||
platformsImpl->reserve(1);
|
platformsImpl->reserve(1);
|
||||||
{
|
{
|
||||||
std::ofstream f;
|
std::ofstream f;
|
||||||
|
|
Loading…
Reference in New Issue