mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Define variable with binary name suffix
use this variable in tests as it is set once in main.cpp create function to get binary kernel filename Change-Id: Ibf7b4c2d390caefda4a5d7fc4667006e7f2edde8
This commit is contained in:

committed by
sys_ocldev

parent
103fe670bd
commit
180de340d8
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -22,17 +22,12 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "cl_api_tests.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/program/program.h"
|
||||
#include "unit_tests/helpers/kernel_binary_helper.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
#include "unit_tests/helpers/memory_management.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
@ -97,11 +92,8 @@ TEST_F(clBuildProgramTests, FromBinaryBasic) {
|
||||
cl_int binaryStatus = CL_SUCCESS;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
@ -145,11 +137,8 @@ TEST_F(clBuildProgramTests, GivenProgramCreatedFromBinaryWhenBuildProgramWithOpt
|
||||
cl_int binaryStatus = CL_SUCCESS;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
@ -204,11 +193,8 @@ TEST_F(clBuildProgramTests, FromBinarySpir) {
|
||||
size_t binarySize = 0;
|
||||
|
||||
KernelBinaryHelper kbHeler("CopyBuffer_simd8", false);
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bc");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bc");
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -23,8 +23,6 @@
|
||||
#include "cl_api_tests.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
@ -50,11 +48,8 @@ TEST_F(clCloneKernelTests, returnsSuccess) {
|
||||
cl_int binaryStatus = CL_SUCCESS;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -23,8 +23,6 @@
|
||||
#include "cl_api_tests.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
|
||||
@ -40,11 +38,8 @@ TEST_F(clCreateKernelTests, returnsSuccess) {
|
||||
cl_int binaryStatus = CL_SUCCESS;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
@ -118,11 +113,8 @@ TEST_F(clCreateKernelTests, invalidParams) {
|
||||
cl_int binaryStatus = CL_SUCCESS;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -23,8 +23,6 @@
|
||||
#include "cl_api_tests.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
@ -32,11 +30,8 @@ using namespace OCLRT;
|
||||
struct clCreateKernelsInProgramTests : public api_tests {
|
||||
void SetUp() override {
|
||||
api_tests::SetUp();
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
auto binarySize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -23,8 +23,6 @@
|
||||
#include "cl_api_tests.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
@ -40,11 +38,9 @@ TEST_F(clCreateProgramWithBinaryTests, returnsSuccess) {
|
||||
cl_int binaryStatus = CL_INVALID_VALUE;
|
||||
void *pBinary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
ASSERT_EQ(true, fileExists(testFile));
|
||||
|
||||
binarySize = loadDataFromFile(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -23,8 +23,6 @@
|
||||
#include "cl_api_tests.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
@ -44,11 +42,8 @@ TEST_F(clReleaseKernelTests, retainAndrelease) {
|
||||
cl_int binaryStatus = CL_SUCCESS;
|
||||
void *binary = nullptr;
|
||||
size_t binarySize = 0;
|
||||
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".bin");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(testFile.c_str(), binary);
|
||||
|
||||
|
@ -64,17 +64,14 @@ class RunKernelFixture : public CommandEnqueueAUBFixture {
|
||||
|
||||
protected:
|
||||
Program *CreateProgramFromBinary(
|
||||
const std::string &BinaryFileName) {
|
||||
std::string testFile;
|
||||
const std::string &binaryFileName) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
testFile.append(testFiles);
|
||||
testFile.append(BinaryFileName);
|
||||
EXPECT_EQ(true, fileExists(testFile));
|
||||
EXPECT_EQ(true, fileExists(binaryFileName));
|
||||
|
||||
void *pSource = nullptr;
|
||||
size_t sourceSize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
binaryFileName.c_str(),
|
||||
pSource);
|
||||
|
||||
EXPECT_NE(0u, sourceSize);
|
||||
@ -99,39 +96,5 @@ class RunKernelFixture : public CommandEnqueueAUBFixture {
|
||||
|
||||
return pProgram;
|
||||
}
|
||||
|
||||
Program *CreateProgramFromSource(
|
||||
const std::string &SourceFileName) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
std::string testFile;
|
||||
|
||||
testFile.append(testFiles);
|
||||
testFile.append(SourceFileName);
|
||||
EXPECT_EQ(true, fileExists(testFile));
|
||||
|
||||
void *pSource = nullptr;
|
||||
size_t sourceSize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
pSource);
|
||||
|
||||
EXPECT_NE(0u, sourceSize);
|
||||
EXPECT_NE(nullptr, pSource);
|
||||
|
||||
Program *pProgram = nullptr;
|
||||
|
||||
pProgram = Program::create(
|
||||
context,
|
||||
1,
|
||||
(const char **)(&pSource),
|
||||
&sourceSize,
|
||||
retVal);
|
||||
|
||||
EXPECT_NE(nullptr, pProgram);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
deleteDataReadFromFile(pSource);
|
||||
|
||||
return pProgram;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -20,13 +20,8 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
#include "unit_tests/fixtures/run_kernel_fixture.h"
|
||||
#include "unit_tests/fixtures/two_walker_fixture.h"
|
||||
#include "unit_tests/aub_tests/fixtures/run_kernel_fixture.h"
|
||||
#include "CL/cl_ext.h"
|
||||
#include "CL/cl.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
@ -56,10 +51,9 @@ SKLTEST_F(AUBRunKernelIntegrateTest, ooqExecution) {
|
||||
cl_event *event2 = nullptr;
|
||||
cl_int retVal = CL_FALSE;
|
||||
|
||||
// we would need real compiler for this
|
||||
//Program* pProgram = CreateProgramFromSource( "simple_kernels.cl" );
|
||||
|
||||
Program *pProgram = CreateProgramFromBinary(std::string("simple_kernels_") + pDevice->getProductAbbrev() + ".bin");
|
||||
std::string kernelFilename;
|
||||
retrieveBinaryKernelFilename(kernelFilename, "simple_kernels_", ".bin");
|
||||
Program *pProgram = CreateProgramFromBinary(kernelFilename);
|
||||
ASSERT_NE(nullptr, pProgram);
|
||||
|
||||
cl_device_id device = pDevice;
|
||||
@ -284,8 +278,9 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
|
||||
const int MV_BUFFER_SIZE = testWidth * mbHeight / 4;
|
||||
const int RESIDUALS_BUFFER_SIZE = MV_BUFFER_SIZE;
|
||||
|
||||
Program *pProgram = CreateProgramFromBinary(
|
||||
std::string("vme_kernels_") + pDevice->getProductAbbrev() + ".bin");
|
||||
std::string kernelFilename;
|
||||
retrieveBinaryKernelFilename(kernelFilename, "vme_kernels_", ".bin");
|
||||
Program *pProgram = CreateProgramFromBinary(kernelFilename);
|
||||
ASSERT_NE(nullptr, pProgram);
|
||||
|
||||
cl_device_id device = pDevice;
|
||||
|
@ -142,9 +142,8 @@ TEST(DebugSip, DISABLED_givenBuiltInsWhenDbgCsrSipIsRequestedThanCorrectSipKerne
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
auto product = mockDevice->getProductAbbrev();
|
||||
std::string name = "sip_dummy_kernel_debug";
|
||||
std::string builtInFileRoot = testFiles + getDebugSipKernelNameWithBitnessAndProductSuffix(name, product);
|
||||
std::string builtInFileRoot = testFiles + getDebugSipKernelNameWithBitnessAndProductSuffix(name, binaryNameSuffix.c_str());
|
||||
std::string builtInGenFile = builtInFileRoot;
|
||||
builtInGenFile.append(".gen");
|
||||
|
||||
|
@ -242,7 +242,7 @@ struct PerformanceHintEnqueueKernelTest : public PerformanceHintEnqueueTest,
|
||||
void SetUp() override {
|
||||
PerformanceHintEnqueueTest::SetUp();
|
||||
cl_device_id device = pPlatform->getDevice(0);
|
||||
CreateProgramFromBinary<Program>(context, &device, std::string("CopyBuffer_simd32"));
|
||||
CreateProgramFromBinary<Program>(context, &device, "CopyBuffer_simd32");
|
||||
retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
kernel = Kernel::create<MockKernel>(pProgram, *pProgram->getKernelInfo("CopyBuffer"), &retVal);
|
||||
@ -278,7 +278,7 @@ struct PerformanceHintEnqueueKernelPrintfTest : public PerformanceHintEnqueueTes
|
||||
void SetUp() override {
|
||||
PerformanceHintEnqueueTest::SetUp();
|
||||
cl_device_id device = pPlatform->getDevice(0);
|
||||
CreateProgramFromBinary<Program>(context, &device, std::string("printf"));
|
||||
CreateProgramFromBinary<Program>(context, &device, "printf");
|
||||
retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
kernel = Kernel::create(pProgram, *pProgram->getKernelInfo("test"), &retVal);
|
||||
|
@ -40,6 +40,12 @@ TEST_F(DeviceTest, Create) {
|
||||
EXPECT_NE(nullptr, pDevice);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenDeviceWhenGetProductAbbrevThenReturnsHardwarePrefix) {
|
||||
const auto productAbbrev = pDevice->getProductAbbrev();
|
||||
const auto hwPrefix = hardwarePrefix[pDevice->getHardwareInfo().pPlatform->eProductFamily];
|
||||
EXPECT_EQ(hwPrefix, productAbbrev);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, getCommandStreamReceiver) {
|
||||
EXPECT_NE(nullptr, &pDevice->getCommandStreamReceiver());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -21,8 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "unit_tests/fixtures/built_in_fixture.h"
|
||||
#include "unit_tests/helpers/kernel_binary_helper.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
@ -43,18 +41,8 @@ void BuiltInFixture::SetUp(Device *pDevice) {
|
||||
MockCompilerDebugVars fclDebugVars;
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
std::string builtInFileRoot = testFiles + KernelBinaryHelper::BUILT_INS;
|
||||
std::string builtInBcFile = builtInFileRoot + "_";
|
||||
std::string builtInGenFile = builtInFileRoot + "_";
|
||||
|
||||
auto product = pDevice->getProductAbbrev();
|
||||
builtInBcFile.append(product);
|
||||
builtInGenFile.append(product);
|
||||
builtInBcFile.append(".bc");
|
||||
builtInGenFile.append(".gen");
|
||||
|
||||
fclDebugVars.fileName = builtInBcFile;
|
||||
igcDebugVars.fileName = builtInGenFile;
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, KernelBinaryHelper::BUILT_INS + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, KernelBinaryHelper::BUILT_INS + "_", ".gen");
|
||||
|
||||
gEnvironment->fclPushDebugVars(fclDebugVars);
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -22,9 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "gtest/gtest.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "runtime/program/program.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -31,16 +31,10 @@ void ProgramFixture::CreateProgramFromBinary(cl_context context,
|
||||
cl_int &retVal,
|
||||
const std::string &options) {
|
||||
Cleanup();
|
||||
std::string testFile;
|
||||
retVal = CL_SUCCESS;
|
||||
Context *pContext = castToObject<Context>(context);
|
||||
|
||||
testFile.append(testFiles);
|
||||
testFile.append(binaryFileName);
|
||||
testFile.append("_");
|
||||
testFile.append(pContext->getDevice(0)->getProductAbbrev());
|
||||
testFile.append(".bin");
|
||||
testFile.append(options);
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, binaryFileName + "_", ".bin", options);
|
||||
|
||||
knownSourceSize = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -22,7 +22,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "runtime/device/device.h"
|
||||
#include "unit_tests/global_environment.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
|
||||
@ -33,27 +32,16 @@ struct CommandStreamFixture;
|
||||
// helper functions to enforce MockCompiler input files
|
||||
inline void overwriteBuiltInBinaryName(
|
||||
Device *pDevice,
|
||||
const char *filename,
|
||||
const std::string &filename,
|
||||
bool appendOptionsToFileName = false) {
|
||||
// set mock compiler to return expected kernel...
|
||||
MockCompilerDebugVars fclDebugVars;
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
std::string builtInFileRoot = testFiles;
|
||||
builtInFileRoot.append(filename);
|
||||
std::string builtInBcFile = builtInFileRoot + "_";
|
||||
std::string builtInGenFile = builtInFileRoot + "_";
|
||||
|
||||
auto product = pDevice->getProductAbbrev();
|
||||
builtInBcFile.append(product);
|
||||
builtInGenFile.append(product);
|
||||
builtInBcFile.append(".bc");
|
||||
builtInGenFile.append(".gen");
|
||||
|
||||
fclDebugVars.fileName = builtInBcFile;
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".bc");
|
||||
fclDebugVars.appendOptionsToFileName = appendOptionsToFileName;
|
||||
|
||||
igcDebugVars.fileName = builtInGenFile;
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, filename + "_", ".gen");
|
||||
igcDebugVars.appendOptionsToFileName = appendOptionsToFileName;
|
||||
|
||||
gEnvironment->fclPushDebugVars(fclDebugVars);
|
||||
|
@ -41,9 +41,8 @@ GEN9TEST_F(gen9SipTests, DISABLED_givenDebugCsrSipKernelWithLocalMemoryWhenAsked
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
auto product = mockDevice->getProductAbbrev();
|
||||
std::string name = "sip_dummy_kernel_debug";
|
||||
std::string builtInFileRoot = testFiles + getDebugSipKernelNameWithBitnessAndProductSuffix(name, product);
|
||||
std::string builtInFileRoot = testFiles + getDebugSipKernelNameWithBitnessAndProductSuffix(name, binaryNameSuffix.c_str());
|
||||
std::string builtInGenFile = builtInFileRoot;
|
||||
builtInGenFile.append(".gen");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -35,18 +35,8 @@ KernelBinaryHelper::KernelBinaryHelper(const std::string &name, bool appendOptio
|
||||
MockCompilerDebugVars fclDebugVars;
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
std::string builtInFileRoot = testFiles + name + "_";
|
||||
std::string builtInBcFile = builtInFileRoot;
|
||||
std::string builtInGenFile = builtInFileRoot;
|
||||
|
||||
auto product = hardwarePrefix[productFamily];
|
||||
builtInBcFile.append(product);
|
||||
builtInGenFile.append(product);
|
||||
builtInBcFile.append(".bc");
|
||||
builtInGenFile.append(".gen");
|
||||
|
||||
fclDebugVars.fileName = builtInBcFile;
|
||||
igcDebugVars.fileName = builtInGenFile;
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, name + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, name + "_", ".gen");
|
||||
|
||||
fclDebugVars.appendOptionsToFileName = appendOptionsToFileName;
|
||||
igcDebugVars.appendOptionsToFileName = appendOptionsToFileName;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -28,3 +28,16 @@ std::string testFiles("test_files/x64/");
|
||||
std::string testFiles("test_files/x86/");
|
||||
#endif
|
||||
std::string clFiles("test_files/");
|
||||
std::string binaryNameSuffix("");
|
||||
|
||||
void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options) {
|
||||
if (outputFilename.length() > 0) {
|
||||
outputFilename.clear();
|
||||
}
|
||||
outputFilename.reserve(2 * testFiles.length());
|
||||
outputFilename.append(testFiles);
|
||||
outputFilename.append(kernelName);
|
||||
outputFilename.append(binaryNameSuffix);
|
||||
outputFilename.append(extension);
|
||||
outputFilename.append(options);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -25,3 +25,6 @@
|
||||
|
||||
extern std::string testFiles;
|
||||
extern std::string clFiles;
|
||||
extern std::string binaryNameSuffix;
|
||||
|
||||
void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options = "");
|
||||
|
@ -271,23 +271,6 @@ int main(int argc, char **argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// we look for test files always relative to binary location
|
||||
// this simplifies multi-process execution and using different
|
||||
// working directories
|
||||
std::string nTestFiles = getRunPath(argv[0]);
|
||||
nTestFiles.append("/");
|
||||
nTestFiles.append(hardwarePrefix[productFamily]);
|
||||
nTestFiles.append("/");
|
||||
nTestFiles.append(testFiles);
|
||||
testFiles = nTestFiles;
|
||||
|
||||
std::string nClFiles = getRunPath(argv[0]);
|
||||
nClFiles.append("/");
|
||||
nClFiles.append(hardwarePrefix[productFamily]);
|
||||
nClFiles.append("/");
|
||||
nClFiles.append(clFiles);
|
||||
clFiles = nClFiles;
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
if (_chdir(hardwarePrefix[productFamily])) {
|
||||
@ -302,12 +285,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
uint32_t threadsPerEu = 7;
|
||||
PLATFORM platform;
|
||||
std::string baseFile = nTestFiles + "15895692906525787409_";
|
||||
baseFile = baseFile + hardwarePrefix[productFamily];
|
||||
|
||||
auto fclMockFile = baseFile + ".bc";
|
||||
auto igcMockFile = baseFile + ".gen";
|
||||
|
||||
auto hardwareInfo = hardwareInfoTable[productFamily];
|
||||
if (!hardwareInfo) {
|
||||
return -1;
|
||||
@ -340,6 +317,22 @@ int main(int argc, char **argv) {
|
||||
device.pSysInfo = >SystemInfo;
|
||||
device.capabilityTable = hardwareInfo->capabilityTable;
|
||||
|
||||
binaryNameSuffix.append(hardwarePrefix[productFamily]);
|
||||
|
||||
std::string nBinaryKernelFiles = getRunPath(argv[0]);
|
||||
nBinaryKernelFiles.append("/");
|
||||
nBinaryKernelFiles.append(binaryNameSuffix);
|
||||
nBinaryKernelFiles.append("/");
|
||||
nBinaryKernelFiles.append(testFiles);
|
||||
testFiles = nBinaryKernelFiles;
|
||||
|
||||
std::string nClFiles = getRunPath(argv[0]);
|
||||
nClFiles.append("/");
|
||||
nClFiles.append(hardwarePrefix[productFamily]);
|
||||
nClFiles.append("/");
|
||||
nClFiles.append(clFiles);
|
||||
clFiles = nClFiles;
|
||||
|
||||
auto pDevices = new const HardwareInfo *[numDevices];
|
||||
for (decltype(numDevices) i = 0; i < numDevices; ++i) {
|
||||
pDevices[i] = &device;
|
||||
@ -365,10 +358,10 @@ int main(int argc, char **argv) {
|
||||
MockCompilerDebugVars fclDebugVars;
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
fclDebugVars.fileName = fclMockFile;
|
||||
igcDebugVars.fileName = igcMockFile;
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, "15895692906525787409_", ".bc");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "15895692906525787409_", ".gen");
|
||||
|
||||
gEnvironment->setMockFileNames(fclMockFile, igcMockFile);
|
||||
gEnvironment->setMockFileNames(fclDebugVars.fileName, igcDebugVars.fileName);
|
||||
gEnvironment->setDefaultDebugVars(fclDebugVars, igcDebugVars, device);
|
||||
|
||||
// globally override-disable preemption to speed-up test execution
|
||||
|
@ -44,10 +44,8 @@ std::vector<char> MockSipKernel::getDummyGenBinary() {
|
||||
return dummyBinaryForSip;
|
||||
}
|
||||
std::vector<char> MockSipKernel::getBinary() {
|
||||
std::string testFile(testFiles);
|
||||
testFile.append("CopyBuffer_simd8_");
|
||||
testFile.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
testFile.append(".gen");
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".gen");
|
||||
|
||||
void *binary = nullptr;
|
||||
auto binarySize = loadDataFromFile(testFile.c_str(), binary);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -36,8 +36,8 @@ class Environment : public ::testing::Environment {
|
||||
void SetInputFileName(
|
||||
const std::string filename) {
|
||||
|
||||
igcDebugVars.fileName = testFiles + filename + "_" + devicePrefix + ".gen";
|
||||
fclDebugVars.fileName = testFiles + filename + "_" + devicePrefix + ".bc";
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, filename + "_", ".gen");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".bc");
|
||||
|
||||
OCLRT::setIgcDebugVars(igcDebugVars);
|
||||
OCLRT::setFclDebugVars(fclDebugVars);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -95,6 +95,7 @@ int main(int argc, char **argv) {
|
||||
nTestFiles.append("/");
|
||||
nTestFiles.append(testFiles);
|
||||
testFiles = nTestFiles;
|
||||
binaryNameSuffix.append(devicePrefix);
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -21,8 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/program/program.h"
|
||||
#include "runtime/helpers/string.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
@ -60,10 +58,8 @@ TEST_F(ProcessElfBinaryTests, InvalidBinary) {
|
||||
TEST_F(ProcessElfBinaryTests, ValidBinary) {
|
||||
uint32_t binaryVersion;
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
cl_int retVal = processElfBinary(pBinary, binarySize, binaryVersion);
|
||||
@ -138,10 +134,8 @@ class ProcessElfBinaryTestsWithBinaryType : public Program,
|
||||
TEST_P(ProcessElfBinaryTestsWithBinaryType, GivenBinaryTypeWhenResolveProgramThenProgramIsProperlyResolved) {
|
||||
uint32_t binaryVersion;
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
cl_int retVal = processElfBinary(pBinary, binarySize, binaryVersion);
|
||||
@ -182,10 +176,8 @@ INSTANTIATE_TEST_CASE_P(ResolveBinaryTests,
|
||||
TEST_F(ProcessElfBinaryTests, BackToBack) {
|
||||
uint32_t binaryVersion;
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
cl_int retVal = processElfBinary(pBinary, binarySize, binaryVersion);
|
||||
@ -195,12 +187,10 @@ TEST_F(ProcessElfBinaryTests, BackToBack) {
|
||||
EXPECT_NE(0u, binaryVersion);
|
||||
deleteDataReadFromFile(pBinary);
|
||||
|
||||
filePath = testFiles;
|
||||
filePath.append("simple_arg_int_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath2;
|
||||
retrieveBinaryKernelFilename(filePath2, "simple_arg_int_", ".bin");
|
||||
|
||||
binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
binarySize = loadDataFromFile(filePath2.c_str(), pBinary);
|
||||
retVal = processElfBinary(pBinary, binarySize, binaryVersion);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@ -212,10 +202,8 @@ TEST_F(ProcessElfBinaryTests, BackToBack) {
|
||||
TEST_F(ProcessElfBinaryTests, BuildOptionsEmpty) {
|
||||
uint32_t binaryVersion;
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("simple_kernels_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "simple_kernels_", ".bin");
|
||||
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
cl_int retVal = processElfBinary(pBinary, binarySize, binaryVersion);
|
||||
@ -230,10 +218,8 @@ TEST_F(ProcessElfBinaryTests, BuildOptionsEmpty) {
|
||||
TEST_F(ProcessElfBinaryTests, BuildOptionsNotEmpty) {
|
||||
uint32_t binaryVersion;
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("simple_kernels_opts_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "simple_kernels_opts_", ".bin");
|
||||
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
cl_int retVal = processElfBinary(pBinary, binarySize, binaryVersion);
|
||||
|
@ -2181,10 +2181,8 @@ TEST_F(ProgramTests, ValidBinaryWithIGCVersionEqual0) {
|
||||
|
||||
// Load a binary program file
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
EXPECT_NE(0u, binarySize);
|
||||
|
||||
@ -2255,10 +2253,8 @@ TEST_F(ProgramTests, RebuildBinaryButNoCompilerInterface) {
|
||||
|
||||
// Load a binary program file
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
EXPECT_NE(0u, binarySize);
|
||||
|
||||
@ -2312,10 +2308,8 @@ TEST_F(ProgramTests, RebuildBinaryWithRebuildError) {
|
||||
|
||||
// Load a binary program file
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
EXPECT_NE(0u, binarySize);
|
||||
|
||||
@ -2452,10 +2446,8 @@ TEST_F(ProgramTests, RebuildBinaryWithProcessGenBinaryError) {
|
||||
|
||||
// Load a binary program file
|
||||
void *pBinary = nullptr;
|
||||
std::string filePath = testFiles;
|
||||
filePath.append("CopyBuffer_simd8_");
|
||||
filePath.append(hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]);
|
||||
filePath.append(".bin");
|
||||
std::string filePath;
|
||||
retrieveBinaryKernelFilename(filePath, "CopyBuffer_simd8_", ".bin");
|
||||
size_t binarySize = loadDataFromFile(filePath.c_str(), pBinary);
|
||||
EXPECT_NE(0u, binarySize);
|
||||
|
||||
|
Reference in New Issue
Block a user