use release for cl-objects instead of delete

- fix for data race in events
- modification of the addition child event

Change-Id: I6ea3a413f13f13a91d37d20d8b9fad37d0ffafb9
This commit is contained in:
Kamil Diedrich
2019-02-04 13:08:47 +01:00
committed by sys_ocldev
parent 3820a5e8e5
commit e1eab521e7
29 changed files with 329 additions and 189 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -24,7 +24,8 @@ void ContextFixture::SetUp(cl_uint numDevices, cl_device_id *pDeviceList) {
}
void ContextFixture::TearDown() {
delete pContext;
pContext = nullptr;
if (pContext != nullptr) {
pContext->release();
}
}
} // namespace OCLRT

View File

@ -25,6 +25,7 @@ void DeviceFixture::SetUpImpl(const OCLRT::HardwareInfo *hardwareInfo) {
void DeviceFixture::TearDown() {
delete pDevice;
pDevice = nullptr;
}
MockDevice *DeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -80,7 +80,7 @@ class ExecutionModelSchedulerTest : public DeviceFixture,
}
void TearDown() override {
delete parentKernel;
parentKernel->release();
DeviceQueueFixture::TearDown();
CommandQueueHwFixture::TearDown();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -65,17 +65,22 @@ class ExecutionModelKernelFixture : public ProgramFromBinaryTest,
}
void TearDown() override {
delete pKernel;
if (pKernel != nullptr) {
pKernel->release();
}
std::string temp;
temp.assign(pPlatform->getDevice(0)->getDeviceInfo().clVersion);
if (temp.find("OpenCL 1.2") != std::string::npos) {
delete pDevice;
pDevice = nullptr;
}
ProgramFromBinaryTest::TearDown();
PlatformFixture::TearDown();
if (temp.find("OpenCL 1.2") != std::string::npos) {
if (pDevice != nullptr) {
delete pDevice;
pDevice = nullptr;
}
}
}
Kernel *pKernel;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -98,8 +98,8 @@ struct HelloWorldFixture : public FixtureFactory::IndirectHeapFixture,
virtual void TearDown() {
pCmdQ->flush();
delete srcBuffer;
delete destBuffer;
srcBuffer->release();
destBuffer->release();
KernelFixture::TearDown();
IndirectHeapFixture::TearDown();

View File

@ -1,23 +1,8 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* SPDX-License-Identifier: MIT
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
@ -101,8 +86,7 @@ struct HelloWorldKernelFixture : public ProgramFixture {
virtual void TearDown() {
delete pKernelName;
delete pTestFilename;
delete pKernel;
pKernel = nullptr;
pKernel->release();
pContext->release();
ProgramFixture::TearDown();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -78,8 +78,7 @@ struct MediaKernelFixture : public HelloWorldFixture<FactoryType>,
}
void TearDown() override {
delete pVmeKernel;
pVmeKernel = nullptr;
pVmeKernel->release();
HardwareParse::TearDown();
Parent::TearDown();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -72,8 +72,7 @@ class ProgramFixture {
void Cleanup() {
if (pProgram != nullptr) {
delete pProgram;
pProgram = nullptr;
pProgram->release();
}
if (knownSource != nullptr) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -15,7 +15,6 @@ void ProgramFixture::CreateProgramFromBinary(cl_context context,
const std::string &binaryFileName,
cl_int &retVal,
const std::string &options) {
Cleanup();
retVal = CL_SUCCESS;
std::string testFile;