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:
Mateusz Jablonski
2018-04-24 13:06:49 +02:00
committed by sys_ocldev
parent 103fe670bd
commit 180de340d8
25 changed files with 124 additions and 259 deletions

View File

@ -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;
}
};
}

View File

@ -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;