refactor: Mock file system in ULTs

Functions: fileExists and loadDataToFile
use IO functions from namespace IoFunctions

Now tests that use these functions
are mocked by default,
but some still require access to real files
and have been restored the ability to read files.
They will be mocked in next PRs.

Related-To: NEO-7006
Signed-off-by: Marcel Skierkowski <marcel.skierkowski@intel.com>
This commit is contained in:
Marcel Skierkowski
2025-04-09 15:18:28 +00:00
committed by Compute-Runtime-Automation
parent 077fe1ab48
commit 5d01677454
56 changed files with 349 additions and 80 deletions

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
@@ -29,6 +30,7 @@ template <uint32_t rootDeviceIndex = 1u>
struct ApiFixture {
void setUp() {
USE_REAL_FILE_SYSTEM();
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
debugManager.flags.EnableCpuCacheForResources.set(true);
debugManager.flags.ContextGroupSize.set(0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,6 +36,7 @@ struct ClBuildProgramTests : public ApiTests {
namespace ULT {
TEST_F(ClBuildProgramTests, GivenSourceAsInputWhenCreatingProgramWithSourceThenProgramBuildSucceeds) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -366,6 +367,7 @@ TEST_F(ClBuildProgramTests, GivenNullAsInputWhenCreatingProgramThenInvalidProgra
}
TEST_F(ClBuildProgramTests, GivenInvalidCallbackInputWhenBuildProgramThenInvalidValueErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_SUCCESS;
size_t binarySize = 0;
@@ -449,6 +451,7 @@ TEST_F(ClBuildProgramTests, GivenValidCallbackInputWhenBuildProgramThenCallbackI
}
TEST_F(ClBuildProgramTests, givenProgramWhenBuildingForInvalidDevicesInputThenInvalidDeviceErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -523,7 +526,7 @@ TEST_F(ClBuildProgramTests, givenProgramWhenBuildingForInvalidDevicesInputThenIn
}
TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenBuildingThenInvalidOperationErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
MockSpecializedContext context;
cl_program pProgram = nullptr;
size_t sourceSize = 0;
@@ -595,7 +598,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenBuildingThe
}
TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenBuildingThenInvalidOperationErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
MockSpecializedContext context;
cl_program pProgram = nullptr;
size_t sourceSize = 0;
@@ -674,6 +677,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenBuildingTh
}
TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceWhenCreatingKernelThenProgramAndKernelDevicesMatchAndSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
cl_program pProgram = nullptr;
size_t sourceSize = 0;
@@ -729,6 +733,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceW
}
TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceWithCreatedKernelWhenBuildingProgramForSecondDeviceThenInvalidOperationReturned) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
cl_program pProgram = nullptr;
size_t sourceSize = 0;
@@ -801,6 +806,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceW
}
TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForMultipleDevicesSeparatelyWithCreatedKernelThenProgramAndKernelDevicesMatch) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
cl_program pProgram = nullptr;
size_t sourceSize = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,6 +29,7 @@ TEST_F(ClCloneKernelTests, GivenNullKernelWhenCloningKernelThenInvalidKernelErro
}
TEST_F(ClCloneKernelTests, GivenValidKernelWhenCloningKernelThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_kernel pSourceKernel = nullptr;
cl_kernel pClonedKernel = nullptr;
cl_program pProgram = nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,6 +20,8 @@ using ClCompileProgramTests = ApiTests;
namespace ULT {
TEST_F(ClCompileProgramTests, GivenKernelAsSingleSourceWhenCompilingProgramThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -64,19 +66,21 @@ TEST_F(ClCompileProgramTests, GivenKernelAsSingleSourceWhenCompilingProgramThenS
}
TEST_F(ClCompileProgramTests, GivenKernelAsSourceWithHeaderWhenCompilingProgramThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
cl_program pHeader = nullptr;
auto copyBufferWithHeader = R"===(
#include "simple_header.h"
__kernel void CopyBuffer(){}
)===";
)===";
auto copyBufferWithHeaderSize = sizeof(copyBufferWithHeader);
auto header = R"===(
extenr __kernel void AddBuffer();
)===";
)===";
auto headerSize = sizeof(header);
auto headerName = "simple_header.h";
@@ -135,6 +139,8 @@ TEST_F(ClCompileProgramTests, GivenNullProgramWhenCompilingProgramThenInvalidPro
}
TEST_F(ClCompileProgramTests, GivenInvalidCallbackInputWhenCompileProgramThenInvalidValueErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -177,6 +183,8 @@ TEST_F(ClCompileProgramTests, GivenInvalidCallbackInputWhenCompileProgramThenInv
}
TEST_F(ClCompileProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallbackIsInvoked) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -223,6 +231,8 @@ TEST_F(ClCompileProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallback
}
TEST(clCompileProgramTest, givenProgramWhenCompilingForInvalidDevicesInputThenInvalidDeviceErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -317,6 +327,7 @@ TEST(clCompileProgramTest, givenProgramWhenCompilingForInvalidDevicesInputThenIn
}
TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenCompilingThenInvalidOperationErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
MockSpecializedContext context;
cl_program pProgram = nullptr;
@@ -395,6 +406,7 @@ TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenCompiling
}
TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenCompilingThenInvalidOperationErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
MockSpecializedContext context;
cl_program pProgram = nullptr;
@@ -478,4 +490,4 @@ TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenCompilin
retVal = clReleaseProgram(pProgram);
EXPECT_EQ(CL_SUCCESS, retVal);
}
} // namespace ULT
} // namespace ULT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,6 +21,7 @@ using ClCreateKernelTests = ApiTests;
namespace ULT {
TEST_F(ClCreateKernelTests, GivenCorrectKernelInProgramWhenCreatingNewKernelThenKernelIsCreatedAndSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_kernel kernel = nullptr;
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_SUCCESS;
@@ -75,6 +76,7 @@ TEST_F(ClCreateKernelTests, GivenCorrectKernelInProgramWhenCreatingNewKernelThen
}
TEST_F(ClCreateKernelTests, GivenInvalidKernelNameWhenCreatingNewKernelThenInvalidKernelNameErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_kernel kernel = nullptr;
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_SUCCESS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -22,6 +22,8 @@ using ClCreateProgramWithILKHRTests = ApiTests;
namespace ULT {
TEST_F(ClCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgramWithBinaryThenProgramIsCreatedAndSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_INVALID_VALUE;
size_t binarySize = 0;
@@ -67,6 +69,8 @@ TEST_F(ClCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgram
}
TEST_F(ClCreateProgramWithBinaryTests, GivenInvalidInputWhenCreatingProgramWithBinaryThenInvalidValueErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_INVALID_VALUE;
size_t binarySize = 0;
@@ -128,6 +132,8 @@ TEST_F(ClCreateProgramWithBinaryTests, GivenInvalidInputWhenCreatingProgramWithB
}
TEST_F(ClCreateProgramWithBinaryTests, GivenDeviceNotAssociatedWithContextWhenCreatingProgramWithBinaryThenInvalidDeviceErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_INVALID_VALUE;
size_t binarySize = 0;
@@ -229,6 +235,8 @@ TEST_F(ClCreateProgramWithILKHRTests, GivenCorrectParametersWhenCreatingProgramW
}
TEST_F(ClCreateProgramWithILKHRTests, GivenProgramCreatedWithILWhenBuildAfterBuildIsCalledThenReturnSuccess) {
USE_REAL_FILE_SYSTEM();
const uint32_t spirv[16] = {0x03022307};
cl_int err = CL_INVALID_VALUE;
cl_program program = clCreateProgramWithIL(pContext, spirv, sizeof(spirv), &err);
@@ -288,4 +296,4 @@ TEST_F(ClCreateProgramWithILKHRTests, GivenBothFunctionVariantsWhenCreatingProgr
EXPECT_EQ(sizeof(spirv), receivedLength);
}
} // namespace ULT
} // namespace ULT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,6 +23,7 @@ using ClGetKernelArgInfoTests = ApiTests;
namespace ULT {
TEST_F(ClGetKernelArgInfoTests, GivenValidParamsWhenGettingKernelArgInfoThenSuccessAndCorrectSizeAreReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -22,6 +22,7 @@ using ClGetKernelInfoTests = ApiTests;
namespace ULT {
TEST_F(ClGetKernelInfoTests, GivenValidParamsWhenGettingKernelInfoThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,6 +14,7 @@ using namespace NEO;
namespace ULT {
TEST_P(ClGetKernelWorkGroupInfoTests, GivenValidParametersWhenGettingKernelWorkGroupInfoThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
size_t paramValueSizeRet;
auto retVal = clGetKernelWorkGroupInfo(
@@ -57,6 +58,7 @@ TEST_F(ClGetKernelWorkGroupInfoTest, GivenNullDeviceWhenGettingWorkGroupInfoFrom
}
TEST_F(ClGetKernelWorkGroupInfoTest, GivenNullDeviceWhenGettingWorkGroupInfoFromMultiDeviceKernelThenInvalidDeviceErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
size_t paramValueSizeRet;
MockUnrestrictiveContext context;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,6 +24,8 @@ namespace ULT {
void verifyDevices(cl_program pProgram, size_t expectedNumDevices, cl_device_id *expectedDevices);
TEST_F(ClGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -97,6 +99,8 @@ TEST_F(ClGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledT
}
TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenCompilingForSpecificDevicesThenOnlySpecificDevicesAndTheirSubDevicesReportBuildStatus) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -174,6 +178,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenCompilingForSpecificD
}
TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenCompilingWithoutInputDevicesThenAllDevicesReportBuildStatus) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -284,6 +290,8 @@ TEST_F(ClGetProgramBuildInfoTests, givenInvalidDeviceInputWhenGetProgramBuildInf
}
TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingForSpecificDevicesThenOnlySpecificDevicesReportBuildStatus) {
USE_REAL_FILE_SYSTEM();
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -370,6 +378,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingForSpecificDev
}
TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingWithoutInputDevicesThenAllDevicesReportBuildStatus) {
USE_REAL_FILE_SYSTEM();
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -457,6 +467,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingWithoutInputDe
}
TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingForSpecificDevicesThenOnlySpecificDevicesAndTheirSubDevicesReportBuildStatus) {
USE_REAL_FILE_SYSTEM();
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -539,6 +551,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingForSpecificDe
}
TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingWithoutInputDevicesThenAllDevicesReportBuildStatus) {
USE_REAL_FILE_SYSTEM();
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -603,4 +617,4 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingWithoutInputD
EXPECT_EQ(CL_SUCCESS, retVal);
}
} // namespace ULT
} // namespace ULT

View File

@@ -43,6 +43,8 @@ void verifyDevices(cl_program pProgram, size_t expectedNumDevices, cl_device_id
}
TEST_F(ClGetProgramInfoTests, GivenSourceWhenBuildingProgramThenGetProgramInfoReturnsCorrectInfo) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -172,6 +174,8 @@ TEST_F(ClGetProgramInfoTests, GivenIlWhenBuildingProgramThenGetProgramInfoReturn
}
TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithBinaryWhenGettingDevicesThenCorrectDevicesAreReturned) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
auto numDevicesForProgram = 2u;
@@ -227,6 +231,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithBinaryWhenGettingDe
}
TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithBinaryWhenGettingBinariesThenCorrectBinariesAreReturned) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
auto numDevicesForProgram = 2u;
@@ -369,6 +375,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithILWhenGettingDevice
}
TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhenGettingDevicesThenCorrectDevicesAreReturned) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
auto expectedNumDevices = context.getNumDevices();
@@ -406,6 +414,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhe
}
TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhenGettingDevicesThenCorrectBinariesAreReturned) {
USE_REAL_FILE_SYSTEM();
MockUnrestrictiveContextMultiGPU context;
auto expectedNumDevices = context.getNumDevices();
@@ -463,4 +473,4 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhe
retVal = clReleaseProgram(pProgram);
EXPECT_EQ(CL_SUCCESS, retVal);
}
} // namespace ULT
} // namespace ULT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -1217,6 +1217,8 @@ struct IntelClLinkProgramTracingTest : public IntelTracingTest, PlatformFixture
};
TEST_F(IntelClLinkProgramTracingTest, givenLinkProgramCallTracingWhenInvokingCallbackThenPointersFromCallAndCallbackPointToTheSameAddress) {
USE_REAL_FILE_SYSTEM();
call();
EXPECT_EQ(1u, enterCount);
EXPECT_EQ(1u, exitCount);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -22,6 +22,7 @@ namespace ULT {
using ClLinkProgramTests = ApiTests;
TEST_F(ClLinkProgramTests, GivenValidParamsWhenLinkingProgramThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -82,6 +83,7 @@ TEST_F(ClLinkProgramTests, GivenValidParamsWhenLinkingProgramThenSuccessIsReturn
}
TEST_F(ClLinkProgramTests, GivenCreateLibraryOptionWhenLinkingProgramThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -249,6 +251,7 @@ TEST_F(ClLinkProgramTests, GivenProgramsWithSpecConstantsThenSpecConstantsAreEmb
}
TEST_F(ClLinkProgramTests, GivenInvalidCallbackInputWhenLinkProgramThenInvalidValueErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -307,6 +310,7 @@ TEST_F(ClLinkProgramTests, GivenInvalidCallbackInputWhenLinkProgramThenInvalidVa
}
TEST_F(ClLinkProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallbackIsInvoked) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;
@@ -370,6 +374,7 @@ TEST_F(ClLinkProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallbackIsI
}
TEST_F(ClLinkProgramTests, givenMultiDeviceProgramWhenLinkingForInvalidDevicesInputThenInvalidDeviceErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program pProgram = nullptr;
size_t sourceSize = 0;
std::string testFile;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,6 +24,7 @@ TEST_F(ClReleaseKernelTests, GivenNullKernelWhenReleasingKernelThenClInvalidKern
}
TEST_F(ClReleaseKernelTests, GivenRetainedKernelWhenReleasingKernelThenKernelIsCorrectlyReleased) {
USE_REAL_FILE_SYSTEM();
cl_kernel kernel = nullptr;
cl_program program = nullptr;
cl_int binaryStatus = CL_SUCCESS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -330,6 +330,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, AUBSimpleArg, WhenEnqueingKernelThenAddressesAreA
}
HWTEST_F(AUBSimpleArg, givenAubCommandStreamerReceiverWhenBatchBufferFlateningIsForcedThenDumpedAubIsStillValid) {
USE_REAL_FILE_SYSTEM();
cl_uint workDim = 1;
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
@@ -519,6 +520,7 @@ struct AUBSimpleArgNonUniformFixture : public KernelAUBFixture<SimpleArgNonUnifo
using AUBSimpleKernelStatelessTest = Test<KernelAUBFixture<SimpleKernelStatelessFixture>>;
HWTEST_F(AUBSimpleKernelStatelessTest, givenSimpleKernelWhenStatelessPathIsUsedThenExpectCorrectBuffer) {
USE_REAL_FILE_SYSTEM();
constexpr size_t bufferSize = MemoryConstants::pageSize;
cl_uint workDim = 1;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,6 +20,7 @@ extern const HardwareInfo *defaultHwInfo;
using AUBSimpleKernelStatelessTest = Test<KernelAUBFixture<SimpleKernelStatelessFixture>>;
HWTEST_F(AUBSimpleKernelStatelessTest, givenPrefetchEnabledWhenEnqueuedKernelThenDataIsCorrect) {
USE_REAL_FILE_SYSTEM();
DebugManagerStateRestore restore;
debugManager.flags.EnableMemoryPrefetch.set(1);

View File

@@ -70,6 +70,8 @@ class BuiltInTests
}
void SetUp() override {
USE_REAL_FILE_SYSTEM();
debugManager.flags.ForceAuxTranslationMode.set(static_cast<int32_t>(AuxTranslationMode::builtin));
ClDeviceFixture::setUp();
cl_device_id device = pClDevice;
@@ -233,6 +235,7 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, AuxBuiltInTests, givenXeHpCoreCommandsAndAuxTransla
}
TEST_F(BuiltInTests, WhenBuildingListOfBuiltinsThenBuiltinsHaveBeenGenerated) {
USE_REAL_FILE_SYSTEM();
for (auto supportsImages : ::testing::Bool()) {
allBuiltIns.clear();
size_t size = 0;
@@ -271,6 +274,7 @@ TEST_F(BuiltInTests, WhenBuildingListOfBuiltinsThenBuiltinsHaveBeenGenerated) {
}
TEST_F(BuiltInTests, GivenCopyBufferToSystemMemoryBufferWhenDispatchInfoIsCreatedThenParamsAreCorrect) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
MockBuffer *srcPtr = new MockBuffer();
@@ -338,6 +342,7 @@ TEST_F(BuiltInTests, GivenCopyBufferToSystemMemoryBufferWhenDispatchInfoIsCreate
}
TEST_F(BuiltInTests, GivenCopyBufferToLocalMemoryBufferWhenDispatchInfoIsCreatedThenParamsAreCorrect) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
MockBuffer *srcPtr = new MockBuffer();
@@ -560,6 +565,7 @@ HWTEST2_P(AuxBuiltInTests, givenInvalidAuxTranslationDirectionWhenBuildingDispat
}
TEST_F(BuiltInTests, whenAuxBuiltInIsConstructedThenResizeKernelInstancedTo5) {
USE_REAL_FILE_SYSTEM();
MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice);
EXPECT_EQ(5u, mockAuxBuiltInOp.convertToAuxKernel.size());
EXPECT_EQ(5u, mockAuxBuiltInOp.convertToNonAuxKernel.size());
@@ -591,6 +597,7 @@ HWTEST2_P(AuxBuiltInTests, givenMoreKernelObjectsForAuxTranslationThanKernelInst
}
TEST_F(BuiltInTests, givenkAuxBuiltInWhenResizeIsCalledThenCloneAllNewInstancesFromBaseKernel) {
USE_REAL_FILE_SYSTEM();
MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice);
size_t newSize = mockAuxBuiltInOp.convertToAuxKernel.size() + 3;
mockAuxBuiltInOp.resizeKernelInstances(newSize);
@@ -832,6 +839,7 @@ HWTEST2_P(AuxBuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThe
}
TEST_F(BuiltInTests, GivenCopyBufferToBufferWhenDispatchInfoIsCreatedThenSizeIsAlignedToCachLineSize) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
AlignedBuffer src;
@@ -1198,6 +1206,7 @@ HWTEST_F(BuiltInTests, givenHeaplessWhenBuilderCopyImageToImageHeaplessIsUsedThe
}
HWTEST_F(BuiltInTests, WhenBuilderCopyImageToImageIsUsedThenParamsAreCorrect) {
USE_REAL_FILE_SYSTEM();
REQUIRE_IMAGES_OR_SKIP(defaultHwInfo);
std ::unique_ptr<Image> srcImage(Image2dHelper<>::create(pContext));
@@ -1250,7 +1259,7 @@ HWTEST_F(BuiltInTests, givenHeaplessWhenBuilderFillImageHeaplessIsUsedThenParams
HWTEST_F(BuiltInTests, WhenBuilderFillImageIsUsedThenParamsAreCorrect) {
REQUIRE_IMAGES_OR_SKIP(defaultHwInfo);
USE_REAL_FILE_SYSTEM();
MockBuffer fillColor;
std ::unique_ptr<Image> image(Image2dHelper<>::create(pContext));
ASSERT_NE(nullptr, image.get());
@@ -1346,6 +1355,7 @@ HWTEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyImageToLocalBufferSta
}
TEST_F(BuiltInTests, GivenUnalignedCopyBufferToBufferWhenDispatchInfoIsCreatedThenParamsAreCorrect) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
AlignedBuffer src;
@@ -1375,6 +1385,7 @@ TEST_F(BuiltInTests, GivenUnalignedCopyBufferToBufferWhenDispatchInfoIsCreatedTh
}
TEST_F(BuiltInTests, GivenReadBufferAlignedWhenDispatchInfoIsCreatedThenParamsAreCorrect) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
AlignedBuffer srcMemObj;
@@ -1414,6 +1425,7 @@ TEST_F(BuiltInTests, GivenReadBufferAlignedWhenDispatchInfoIsCreatedThenParamsAr
}
TEST_F(BuiltInTests, GivenWriteBufferAlignedWhenDispatchInfoIsCreatedThenParamsAreCorrect) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
auto size = 10 * MemoryConstants::cacheLineSize;
@@ -1449,6 +1461,7 @@ TEST_F(BuiltInTests, GivenWriteBufferAlignedWhenDispatchInfoIsCreatedThenParamsA
}
TEST_F(BuiltInTests, WhenGettingBuilderInfoTwiceThenPointerIsSame) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &builder1 = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
BuiltinDispatchInfoBuilder &builder2 = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice);
@@ -1456,6 +1469,7 @@ TEST_F(BuiltInTests, WhenGettingBuilderInfoTwiceThenPointerIsSame) {
}
HWTEST_F(BuiltInTests, GivenBuiltInOperationWhenGettingBuilderThenCorrectBuiltInBuilderIsReturned) {
USE_REAL_FILE_SYSTEM();
auto clExecutionEnvironment = static_cast<ClExecutionEnvironment *>(pClDevice->getExecutionEnvironment());
bool heaplessAllowed = UnitTestHelper<FamilyType>::isHeaplessAllowed();
@@ -1916,6 +1930,7 @@ TEST_F(BuiltInTests, givenDebugFlagForceUseSourceWhenArgIsAnyThenReturnBuiltinCo
using BuiltInOwnershipWrapperTests = BuiltInTests;
TEST_F(BuiltInOwnershipWrapperTests, givenBuiltinWhenConstructedThenLockAndUnlockOnDestruction) {
USE_REAL_FILE_SYSTEM();
MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice);
MockContext context(pClDevice);
{
@@ -1931,6 +1946,7 @@ TEST_F(BuiltInOwnershipWrapperTests, givenBuiltinWhenConstructedThenLockAndUnloc
}
TEST_F(BuiltInOwnershipWrapperTests, givenLockWithoutParametersWhenConstructingThenLockOnlyWhenRequested) {
USE_REAL_FILE_SYSTEM();
MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice);
MockContext context(pClDevice);
{
@@ -1947,6 +1963,7 @@ TEST_F(BuiltInOwnershipWrapperTests, givenLockWithoutParametersWhenConstructingT
}
TEST_F(BuiltInOwnershipWrapperTests, givenLockWithAcquiredOwnershipWhenTakeOwnershipCalledThenAbort) {
USE_REAL_FILE_SYSTEM();
MockAuxBuilInOp mockAuxBuiltInOp1(*pBuiltIns, *pClDevice);
MockAuxBuilInOp mockAuxBuiltInOp2(*pBuiltIns, *pClDevice);
MockContext context(pClDevice);
@@ -2140,4 +2157,4 @@ HWTEST2_F(BuiltInTests, whenBuilderFillLocalBufferStatelessHeaplessIsUsedThenPar
for (auto &dispatchInfo : multiDispatchInfo) {
EXPECT_FALSE(dispatchInfo.getKernel()->getDestinationAllocationInSystemMemory());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/local_work_size.h"
#include "shared/source/kernel/implicit_args_helper.h"
@@ -1104,6 +1105,7 @@ TEST(DispatchWalker, WhenCalculatingDispatchDimensionsThenCorrectValuesAreReturn
}
HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenAuxToNonAuxWhenTranslationRequiredThenPipeControlWithStallAndDCFlushAdded) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &baseBuilder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::auxTranslation, *pClDevice);
auto &builder = static_cast<BuiltInOp<EBuiltInOps::auxTranslation> &>(baseBuilder);
@@ -1152,6 +1154,7 @@ HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenAuxToNonAuxWhenTran
}
HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenNonAuxToAuxWhenTranslationRequiredThenPipeControlWithStallAdded) {
USE_REAL_FILE_SYSTEM();
BuiltinDispatchInfoBuilder &baseBuilder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::auxTranslation, *pClDevice);
auto &builder = static_cast<BuiltInOp<EBuiltInOps::auxTranslation> &>(baseBuilder);

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen_common/reg_configs_common.h"
#include "shared/source/helpers/file_io.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
@@ -227,6 +228,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, EnqueueCopyImageTest, WhenCopyingImageThenMediaVf
using MipMapCopyImageTest = EnqueueCopyImageMipMapTest;
HWTEST_P(MipMapCopyImageTest, GivenImagesWithNonZeroMipLevelsWhenCopyImageIsCalledThenProperMipLevelsAreSet) {
USE_REAL_FILE_SYSTEM();
bool heaplessAllowed = UnitTestHelper<FamilyType>::isHeaplessAllowed();
bool useHeapless = false;

View File

@@ -91,6 +91,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDRangeKernel
}
TEST(EnqueueMultiDeviceKernelTest, givenMultiDeviceKernelWhenSetArgDeviceUSMThenOnlyOneKernelIsPatched) {
USE_REAL_FILE_SYSTEM();
REQUIRE_SVM_OR_SKIP(defaultHwInfo);
auto deviceFactory = std::make_unique<UltClDeviceFactory>(3, 0);
auto device0 = deviceFactory->rootDevices[0];

View File

@@ -988,6 +988,7 @@ HWTEST_F(EnqueueAuxKernelTests, givenMultipleArgsWhenAuxTranslationIsRequiredThe
}
HWTEST_F(EnqueueAuxKernelTests, givenKernelWithRequiredAuxTranslationWhenEnqueuedThenDispatchAuxTranslationBuiltin) {
USE_REAL_FILE_SYSTEM();
MockKernelWithInternals mockKernel(*pClDevice, context);
MyCmdQ<FamilyType> cmdQ(context, pClDevice);
size_t gws[3] = {1, 0, 0};

View File

@@ -8,6 +8,7 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/memory_manager/allocations_list.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/surface.h"
@@ -911,6 +912,7 @@ TEST_F(EnqueueSvmTest, givenEnqueueSVMMemFillWhenPatternAllocationIsObtainedThen
}
TEST_F(EnqueueSvmTest, GivenSvmAllocationWhenEnqueingKernelThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
auto svmData = context->getSVMAllocsManager()->getSVMAlloc(ptrSVM);
ASSERT_NE(nullptr, svmData);
GraphicsAllocation *svmAllocation = svmData->gpuAllocations.getGraphicsAllocation(context->getDevice(0)->getRootDeviceIndex());
@@ -939,6 +941,7 @@ TEST_F(EnqueueSvmTest, GivenSvmAllocationWhenEnqueingKernelThenSuccessIsReturned
}
TEST_F(EnqueueSvmTest, givenEnqueueTaskBlockedOnUserEventWhenItIsEnqueuedThenSurfacesAreMadeResident) {
USE_REAL_FILE_SYSTEM();
auto svmData = context->getSVMAllocsManager()->getSVMAlloc(ptrSVM);
ASSERT_NE(nullptr, svmData);
GraphicsAllocation *svmAllocation = svmData->gpuAllocations.getGraphicsAllocation(context->getDevice(0)->getRootDeviceIndex());

View File

@@ -63,6 +63,7 @@ struct GetSizeRequiredBufferTest : public CommandEnqueueFixture,
};
HWTEST_F(GetSizeRequiredBufferTest, WhenFillingBufferThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -116,6 +117,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenFillingBufferThenHeapsAndCommandBufferCo
}
HWTEST_F(GetSizeRequiredBufferTest, WhenCopyingBufferThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -168,6 +170,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenCopyingBufferThenHeapsAndCommandBufferCo
}
HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -221,6 +224,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferNonBlockingThenHeapsAndComm
}
HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferBlockingThenThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -275,6 +279,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferBlockingThenThenHeapsAndCom
}
HWTEST_F(GetSizeRequiredBufferTest, WhenWritingBufferNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -326,6 +331,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenWritingBufferNonBlockingThenHeapsAndComm
}
HWTEST_F(GetSizeRequiredBufferTest, WhenWritingBufferBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -440,6 +446,7 @@ HWTEST_F(GetSizeRequiredBufferTest, GivenOutEventForMultiDeviceContextWhenCalcul
}
HWTEST2_F(GetSizeRequiredBufferTest, givenMultipleKernelRequiringSshWhenTotalSizeIsComputedThenItIsProperlyAligned, IsHeapfulSupported) {
USE_REAL_FILE_SYSTEM();
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer,
pCmdQ->getClDevice());
ASSERT_NE(nullptr, &builder);
@@ -549,4 +556,4 @@ HWTEST_F(GetSizeRequiredBufferTest, GivenKernelWithSimpleArgWhenEnqueingKernelTh
EXPECT_GE(expectedSizeDSH, dshAfter - dshBefore);
EXPECT_GE(expectedSizeIOH, iohAfter - iohBefore);
EXPECT_GE(expectedSizeSSH, sshAfter - sshBefore);
}
}

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/utilities/perf_counter.h"
#include "shared/test/common/test_macros/test.h"
@@ -60,6 +61,7 @@ struct GetSizeRequiredImageTest : public CommandEnqueueFixture,
};
HWTEST_F(GetSizeRequiredImageTest, WhenCopyingImageThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -112,6 +114,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenCopyingImageThenHeapsAndCommandBufferCons
}
HWTEST_F(GetSizeRequiredImageTest, WhenCopyingReadWriteImageThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -162,6 +165,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenCopyingReadWriteImageThenHeapsAndCommandB
}
HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -218,6 +222,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageNonBlockingThenHeapsAndComman
}
HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -274,6 +279,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageBlockingThenHeapsAndCommandBu
}
HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -330,6 +336,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageNonBlockingThenHeapsAndComman
}
HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) {
USE_REAL_FILE_SYSTEM();
auto &commandStream = pCmdQ->getCS(1024);
auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u);
@@ -383,4 +390,4 @@ HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageBlockingThenHeapsAndCommandBu
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
}
}

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/command_stream/wait_status.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/timestamp_packet.h"
#include "shared/source/utilities/wait_util.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
@@ -30,6 +31,7 @@ using namespace NEO;
using MultiRootDeviceCommandStreamReceiverBufferTests = MultiRootDeviceFixture;
HWTEST_F(MultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices) {
USE_REAL_FILE_SYSTEM();
REQUIRE_SVM_OR_SKIP(device1);
REQUIRE_SVM_OR_SKIP(device2);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -22,6 +22,7 @@ class ClCompilerInterfaceTest : public ClDeviceFixture,
public ::testing::Test {
public:
void SetUp() override {
USE_REAL_FILE_SYSTEM();
ClDeviceFixture::setUp();
// create the compiler interface
@@ -59,6 +60,7 @@ class ClCompilerInterfaceTest : public ClDeviceFixture,
};
TEST_F(ClCompilerInterfaceTest, WhenBuildIsInvokedThenFclReceivesListOfExtensionsInInternalOptions) {
USE_REAL_FILE_SYSTEM();
CompilerCacheConfig config = {};
config.enabled = false;
auto tempCompilerCache = std::make_unique<CompilerCache>(config);
@@ -76,6 +78,7 @@ TEST_F(ClCompilerInterfaceTest, WhenBuildIsInvokedThenFclReceivesListOfExtension
}
TEST_F(ClCompilerInterfaceTest, WhenCompileIsInvokedThenFclReceivesListOfExtensionsInInternalOptions) {
USE_REAL_FILE_SYSTEM();
std::string receivedInternalOptions;
MockCompilerDebugVars fclDebugVars;

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/local_work_size.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
@@ -853,6 +854,7 @@ TEST_P(PerformanceHintEnqueueKernelBadSizeTest, GivenBadLocalWorkGroupSizeWhenEn
}
HWTEST_F(PerformanceHintEnqueueKernelPrintfTest, GivenKernelWithPrintfWhenEnqueueKernelIsCalledWithWorkDim3ThenContextProvidesProperHint) {
USE_REAL_FILE_SYSTEM();
size_t preferredWorkGroupSize[3];
auto maxWorkGroupSize = static_cast<uint32_t>(pPlatform->getClDevice(0)->getSharedDeviceInfo().maxWorkGroupSize);
if (debugManager.flags.EnableComputeWorkSizeND.get()) {

View File

@@ -32,6 +32,7 @@ struct HelloWorldKernelFixture : public ProgramFixture {
using ProgramFixture::setUp;
void setUp(ClDevice *pDevice, const char *kernelFilenameStr, const char *kernelNameStr) {
USE_REAL_FILE_SYSTEM();
setUp(pDevice, kernelFilenameStr, kernelNameStr, nullptr);
}
void setUp(ClDevice *pDevice, const char *kernelFilenameStr, const char *kernelNameStr, const char *options) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,6 +18,7 @@ struct ClGetKernelWorkGroupInfoTest : public ApiFixture<>,
typedef ApiFixture BaseClass;
void SetUp() override {
USE_REAL_FILE_SYSTEM();
BaseClass::setUp();
std::unique_ptr<char[]> pSource = nullptr;

View File

@@ -19,6 +19,7 @@
namespace NEO {
void ProgramFixture::createProgramWithSource(Context *pContext,
const std::string &sourceFileName) {
USE_REAL_FILE_SYSTEM();
cleanup();
cl_int retVal = CL_SUCCESS;
std::string testFile;
@@ -58,6 +59,7 @@ void ProgramFixture::createProgramFromBinary(Context *pContext,
const std::string &binaryFileName,
cl_int &retVal,
const std::string &options) {
USE_REAL_FILE_SYSTEM();
retVal = CL_SUCCESS;
std::string testFile;

View File

@@ -87,6 +87,7 @@ class SimpleArgNonUniformKernelFixture : public ProgramFixture {
protected:
void setUp(ClDevice *device, Context *context) {
USE_REAL_FILE_SYSTEM();
ProgramFixture::setUp();
createProgramFromBinary(

View File

@@ -665,6 +665,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceThenGTPinContextCallbackIsCalle
}
TEST_F(GTPinTests, givenUninitializedGTPinInterfaceThenGTPinKernelCreateCallbackIsNotCalled) {
USE_REAL_FILE_SYSTEM();
cl_kernel kernel = nullptr;
cl_program pProgram = nullptr;
cl_device_id device = (cl_device_id)pDevice;
@@ -734,7 +735,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenContextIsCreatedThenCorrect
}
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCallbacksAreCalled) {
USE_REAL_FILE_SYSTEM();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
@@ -890,7 +891,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCa
}
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGTPinCallbacksAreCalled) {
USE_REAL_FILE_SYSTEM();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
@@ -1048,7 +1049,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGT
}
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenTheSameKerneIsExecutedTwiceThenGTPinCreateKernelCallbackIsCalledOnce) {
USE_REAL_FILE_SYSTEM();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
@@ -1221,6 +1222,7 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
USE_REAL_FILE_SYSTEM();
gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate;
@@ -1344,7 +1346,7 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe
}
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKernelSubmitRelatedNotificationsAreCalled) {
USE_REAL_FILE_SYSTEM();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
@@ -1545,7 +1547,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKerne
}
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveralTimesThenCorrectBuffersAreMadeResident) {
USE_REAL_FILE_SYSTEM();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
@@ -1730,6 +1732,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveral
}
TEST_F(GTPinTests, givenKernelWithSSHThenVerifyThatSSHResizeWorksWell) {
USE_REAL_FILE_SYSTEM();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) {
auto &gtpinHelper = pDevice->getGTPinGfxCoreHelper();
@@ -1854,6 +1857,7 @@ TEST_F(GTPinTests, givenKernelWithoutAllocatedSSHThenGTPinStillCanAllocateNewSSH
}
TEST_F(GTPinTests, givenKernelThenVerifyThatKernelCodeSubstitutionWorksWell) {
USE_REAL_FILE_SYSTEM();
cl_kernel kernel = nullptr;
cl_program pProgram = nullptr;
cl_device_id device = (cl_device_id)pDevice;
@@ -2287,6 +2291,7 @@ TEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBuffe
}
HWTEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBufferIsAllocatedInSharedMemoryThenSetSurfaceStateForTheBufferAndMakeItResident) {
USE_REAL_FILE_SYSTEM();
auto &gtpinHelper = pDevice->getGTPinGfxCoreHelper();
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
if (!gtpinHelper.canUseSharedAllocation(pDevice->getHardwareInfo()) ||
@@ -2565,4 +2570,4 @@ TEST(GTPinInitNotifyTests, givenAvailablePlatformsAndEnvironmentVariableSetWhenT
platformsImpl->clear();
}
} // namespace ULT
} // namespace ULT

View File

@@ -137,6 +137,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, HardwareCommandsTest, WhenMediaStateFlushIsCreate
}
HWTEST_F(HardwareCommandsTest, WhenCrossThreadDataIsCreatedThenOnlyRequiredSpaceOnIndirectHeapIsAllocated) {
USE_REAL_FILE_SYSTEM();
REQUIRE_IMAGES_OR_SKIP(defaultHwInfo);
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
CommandQueueHw<FamilyType> cmdQ(pContext, pClDevice, 0, false);

View File

@@ -1,10 +1,11 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/file_io.h"
#include "shared/test/common/mocks/mock_device.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
@@ -18,6 +19,7 @@ using namespace NEO;
class PatchedKernelTest : public ::testing::Test {
public:
void SetUp() override {
USE_REAL_FILE_SYSTEM();
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get(), rootDeviceIndex));
context.reset(new MockContext(device.get()));
program.reset(Program::createBuiltInFromSource<MockProgram>("FillBufferBytes", context.get(), context->getDevices(), &retVal));

View File

@@ -57,6 +57,7 @@ struct IOQTaskTestsMt : public HelloWorldTest<HelloWorldFixtureFactory> {
};
TEST_F(IOQTaskTestsMt, GivenBlockingAndBlockedOnUserEventWhenReadingBufferThenTaskCountAndTaskLevelAreIncremented) {
USE_REAL_FILE_SYSTEM();
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
auto alignedReadPtr = alignedMalloc(BufferDefaults::sizeInBytes, MemoryConstants::cacheLineSize);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,6 +23,7 @@ struct OOQTaskTypedTestsMt : public HelloWorldTest<OOQFixtureFactory> {
typedef OOQTaskTypedTestsMt<EnqueueKernelHelper<>> OOQTaskTestsMt;
TEST_F(OOQTaskTestsMt, GivenBlockingAndBlockedOnUserEventWhenReadingBufferThenTaskCountIsIncrementedAndTaskLevelIsUnchanged) {
USE_REAL_FILE_SYSTEM();
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
auto alignedReadPtr = alignedMalloc(BufferDefaults::sizeInBytes, MemoryConstants::cacheLineSize);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -64,6 +64,7 @@ TEST_F(MockEventTests, GivenEventCreatedFromUserEventsThatIsNotSignaledThenDoNot
}
TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsCompletedAfterBlockedPathIsChosenThenBlockingFlagDoesNotCauseStall) {
USE_REAL_FILE_SYSTEM();
std::unique_ptr<Buffer> srcBuffer(BufferHelper<>::create());
std::unique_ptr<char[]> dst(new char[srcBuffer->getSize()]);
@@ -85,6 +86,7 @@ TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsC
}
TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsCompletedAfterUpdateFromCompletionStampThenBlockingFlagDoesNotCauseStall) {
USE_REAL_FILE_SYSTEM();
std::unique_ptr<Buffer> srcBuffer(BufferHelper<>::create());
std::unique_ptr<char[]> dst(new char[srcBuffer->getSize()]);
@@ -112,6 +114,7 @@ TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsC
}
HWTEST_F(EventTests, givenOneThreadUpdatingUserEventAnotherWaitingOnFinishWhenFinishIsCalledThenItWaitsForCorrectTaskCount) {
USE_REAL_FILE_SYSTEM();
MockCommandQueueHw<FamilyType> mockCmdQueue(context, pClDevice, nullptr);
std::unique_ptr<Buffer> srcBuffer(BufferHelper<>::create());
std::unique_ptr<char[]> dst(new char[srcBuffer->getSize()]);

View File

@@ -1,10 +1,11 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/string.h"
#include "shared/source/kernel/implicit_args_helper.h"
#include "shared/source/memory_manager/allocations_list.h"
@@ -55,6 +56,7 @@ class ProgramDataTestBase : public testing::Test,
void buildAndDecodeProgramPatchList();
void SetUp() override {
USE_REAL_FILE_SYSTEM();
PlatformFixture::setUp();
pClDevice = pPlatform->getClDevice(0);
rootDeviceIndex = pClDevice->getRootDeviceIndex();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/helpers/file_io.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/fixtures/context_fixture.h"
@@ -32,6 +33,7 @@ struct ProgramFromBinaryFixture : public ClDeviceFixture,
ProgramFromBinaryFixture::setUp("CopyBuffer_simd32", "CopyBuffer");
}
void setUp(const char *binaryFileName, const char *kernelName) {
USE_REAL_FILE_SYSTEM();
this->binaryFileName = binaryFileName;
this->kernelName = kernelName;
ClDeviceFixture::setUp();
@@ -74,6 +76,7 @@ class ProgramSimpleFixture : public ClDeviceFixture,
public:
void setUp() {
USE_REAL_FILE_SYSTEM();
ClDeviceFixture::setUp();
cl_device_id device = pClDevice;

View File

@@ -730,6 +730,8 @@ TEST_F(MinimumProgramFixture, givenApplicationContextMarkedAsNonZebinWhenBuildin
}
TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSuccessOrCorrectErrorCodeIsReturned) {
USE_REAL_FILE_SYSTEM();
KernelBinaryHelper kbHelper(binaryFileName, true);
auto device = pPlatform->getClDevice(0);
@@ -832,6 +834,7 @@ TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc
}
TEST_F(ProgramFromSourceTest, GivenDuplicateOptionsWhenCreatingWithSourceThenBuildSucceeds) {
USE_REAL_FILE_SYSTEM();
KernelBinaryHelper kbHelper(binaryFileName, false);
retVal = pProgram->build(pProgram->getDevices(), nullptr);
@@ -851,6 +854,7 @@ TEST_F(ProgramFromSourceTest, GivenDuplicateOptionsWhenCreatingWithSourceThenBui
}
TEST_F(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesAndExtraExtensionsAreNotAdded) {
USE_REAL_FILE_SYSTEM();
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
@@ -868,6 +872,8 @@ TEST_F(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesAndExtraExtensionsA
}
TEST_F(ProgramFromSourceTest, givenFp64EmulationEnabledWhenBuildingProgramThenExtraExtensionsAreAdded) {
USE_REAL_FILE_SYSTEM();
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = static_cast<ClDevice *>(devices[0]);
pClDevice->getExecutionEnvironment()->setFP64EmulationEnabled();
@@ -884,6 +890,8 @@ TEST_F(ProgramFromSourceTest, givenFp64EmulationEnabledWhenBuildingProgramThenEx
}
TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC20ThenExtraExtensionsAreAdded) {
USE_REAL_FILE_SYSTEM();
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
@@ -904,6 +912,8 @@ TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC20ThenExtraExtension
}
TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesAreAdded) {
USE_REAL_FILE_SYSTEM();
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
@@ -926,6 +936,8 @@ TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesAreAdd
}
TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesAreAddedOnlyOnce) {
USE_REAL_FILE_SYSTEM();
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pClDevice = pContext->getDevice(0);
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
@@ -1020,6 +1032,7 @@ TEST_F(ProgramFromSourceTest, WhenCompilingProgramWithOpenClC30ThenFeaturesAreAd
}
TEST_F(ProgramFromSourceTest, GivenDumpZEBinWhenBuildingProgramFromSourceThenZebinIsDumped) {
USE_REAL_FILE_SYSTEM();
DebugManagerStateRestore restorer;
debugManager.flags.DumpZEBin.set(1);
@@ -1068,6 +1081,8 @@ class Callback {
std::map<const void *, uint32_t> Callback::watchList;
TEST_F(ProgramFromSourceTest, GivenDifferentCommpilerOptionsWhenBuildingProgramThenKernelHashesAreDifferent) {
USE_REAL_FILE_SYSTEM();
KernelBinaryHelper kbHelper(binaryFileName, true);
auto rootDeviceIndex = pContext->getDevice(0)->getRootDeviceIndex();
@@ -1134,6 +1149,8 @@ TEST_F(ProgramFromSourceTest, GivenEmptyProgramWhenCreatingProgramThenInvalidVal
}
TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenCompilingProgramThenSuccessOrCorrectErrorCodeIsReturned) {
USE_REAL_FILE_SYSTEM();
createProgramWithSource(
pContext,
sourceFileName);
@@ -1256,6 +1273,8 @@ TEST_F(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave
}
TEST_F(ProgramTests, GivenFlagsWhenLinkingProgramThenBuildOptionsHaveBeenApplied) {
USE_REAL_FILE_SYSTEM();
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pClDevice));
pProgram->sourceCode = "__kernel mock() {}";
@@ -1286,6 +1305,8 @@ TEST_F(ProgramTests, GivenFlagsWhenLinkingProgramThenBuildOptionsHaveBeenApplied
}
TEST_F(ProgramFromSourceTest, GivenAdvancedOptionsWhenCreatingProgramThenSuccessIsReturned) {
USE_REAL_FILE_SYSTEM();
std::string testFile;
size_t sourceSize = 0;
@@ -1338,6 +1359,8 @@ TEST_F(ProgramFromSourceTest, GivenAdvancedOptionsWhenCreatingProgramThenSuccess
}
TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenLinkingProgramThenSuccessOrCorrectErrorCodeIsReturned) {
USE_REAL_FILE_SYSTEM();
createProgramWithSource(
pContext,
sourceFileName);
@@ -1406,6 +1429,8 @@ TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenLinkingProgramThenSucce
}
TEST_F(ProgramFromSourceTest, GivenInvalidOptionsWhenCreatingLibraryThenCorrectErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
cl_program program = pProgram;
// Order of following microtests is important - do not change.
@@ -1836,6 +1861,8 @@ TEST_F(ProgramTests, givenSkipLastExplicitArgWhenContainsStatefulAccessIsCalledT
}
TEST_F(ProgramTests, givenStatefulAndStatelessAccessesWhenProgramBuildIsCalledThenCorrectResultIsReturned) {
USE_REAL_FILE_SYSTEM();
DebugManagerStateRestore restorer;
const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
@@ -2164,6 +2191,8 @@ TEST_F(ProgramTests, givenExistingGlobalSurfacesWhenProcessGenBinaryThenCleanupT
}
TEST_F(ProgramTests, GivenNoCompilerInterfaceRootDeviceEnvironmentWhenRebuildingBinaryThenOutOfHostMemoryErrorIsReturned) {
USE_REAL_FILE_SYSTEM();
auto pDevice = pContext->getDevice(0);
auto executionEnvironment = pDevice->getExecutionEnvironment();
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment = std::make_unique<NoCompilerInterfaceRootDeviceEnvironment>(*executionEnvironment);
@@ -2414,6 +2443,8 @@ TEST(isValidSpirvBinary, whenBinaryDoesNotContainLllvMagicThenBinaryIsNotValidLL
}
TEST_F(ProgramTests, WhenLinkingTwoValidSpirvProgramsThenValidProgramIsReturned) {
USE_REAL_FILE_SYSTEM();
const uint32_t spirv[16] = {0x03022307};
cl_int errCode = CL_SUCCESS;
@@ -2485,6 +2516,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPat
}
TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledThenRebuildWarningIsIssued) {
USE_REAL_FILE_SYSTEM();
const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))};
uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329};
program->irBinary = makeCopy(spirv, sizeof(spirv));
@@ -2501,6 +2534,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledThenRebuildWarningI
}
TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledButSuppressFlagIsEnabledThenRebuildWarningIsNotIssued) {
USE_REAL_FILE_SYSTEM();
const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))};
uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329};
program->irBinary = makeCopy(spirv, sizeof(spirv));
@@ -2520,6 +2555,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledButSuppressFlagIsEn
}
TEST_F(ProgramTests, givenProgramWithSpirvWhenRecompileIsCalledThenRebuildWarningIsIssued) {
USE_REAL_FILE_SYSTEM();
const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))};
uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329};
program->irBinary = makeCopy(spirv, sizeof(spirv));
@@ -2536,6 +2573,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRecompileIsCalledThenRebuildWarnin
}
TEST_F(ProgramTests, givenProgramWithSpirvWhenRecompileIsCalledButSuppressFlagIsEnabledThenRebuildWarningIsNotIssued) {
USE_REAL_FILE_SYSTEM();
const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))};
uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329};
program->irBinary = makeCopy(spirv, sizeof(spirv));
@@ -3088,6 +3127,8 @@ struct DebugDataGuard {
};
TEST_F(ProgramBinTest, GivenBuildWithDebugDataThenBuildDataAvailableViaGetInfo) {
USE_REAL_FILE_SYSTEM();
DebugDataGuard debugDataGuard;
const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n";
@@ -3175,6 +3216,8 @@ TEST_F(ProgramBinTest, givenNoDebugDataAvailableThenDebugDataIsNotAvailableViaGe
}
TEST_F(ProgramBinTest, GivenDebugDataAvailableWhenLinkingProgramThenDebugDataIsStoredInProgram) {
USE_REAL_FILE_SYSTEM();
DebugDataGuard debugDataGuard;
const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n";
@@ -3233,6 +3276,8 @@ class MockCompilerInterfaceWithGtpinParam : public CompilerInterface {
};
TEST_F(ProgramBinTest, GivenSourceKernelWhenLinkingProgramThenGtpinInitInfoIsPassed) {
USE_REAL_FILE_SYSTEM();
void *pIgcInitPtr = reinterpret_cast<void *>(0x1234);
gtpinSetIgcInit(pIgcInitPtr);
const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n";
@@ -3300,6 +3345,8 @@ TEST(ProgramCallbackTest, whenInvokeCallbackIsCalledThenFunctionIsProperlyInvoke
}
TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreAndProcessBinaryOnlyOncePerRootDevice) {
USE_REAL_FILE_SYSTEM();
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -3358,6 +3405,8 @@ TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreAndProcessBin
}
TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreKernelInfoPerEachRootDevice) {
USE_REAL_FILE_SYSTEM();
MockProgram *pProgram = nullptr;
std::unique_ptr<char[]> pSource = nullptr;
size_t sourceSize = 0;
@@ -3963,4 +4012,4 @@ TEST(ProgramGenerateDefaultArgsMetadataTests, whenGeneratingDefaultMetadataForSa
buildInfo.kernelInfoArray.clear();
buildInfo.unpackedDeviceBinary.release();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#pragma once
#include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/helpers/file_io.h"
#include "shared/test/common/fixtures/memory_management_fixture.h"
#include "shared/test/common/helpers/kernel_binary_helper.h"
@@ -31,6 +32,7 @@ class ProgramFromSourceTest : public ContextFixture,
protected:
void SetUp() override {
USE_REAL_FILE_SYSTEM();
sourceFileName = "CopyBuffer_simd16.cl";
binaryFileName = "CopyBuffer_simd16";
kernelName = "CopyBuffer";

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,6 +11,7 @@
#include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/engine_node_helper.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/utilities/tag_allocator.h"
@@ -223,6 +224,7 @@ using PvcMultiRootDeviceCommandStreamReceiverBufferTests = MultiRootDeviceFixtur
HWTEST_EXCLUDE_PRODUCT(MultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices, IGFX_PVC);
PVCTEST_F(PvcMultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentOnPvcWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices) {
USE_REAL_FILE_SYSTEM();
REQUIRE_SVM_OR_SKIP(device1);
REQUIRE_SVM_OR_SKIP(device2);