Skip to content

Commit 09c62ca

Browse files
pwilmaCompute-Runtime-Automation
authored andcommitted
Possibility to apply additional build options
Change-Id: Ic654f57b462e32f464db9df94aed1061bc5a7bac
1 parent de022cc commit 09c62ca

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

runtime/program/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#
2-
# Copyright (C) 2018 Intel Corporation
2+
# Copyright (C) 2018-2019 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
#
66

77
set(RUNTIME_SRCS_PROGRAM
88
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/additional_options.cpp
910
${CMAKE_CURRENT_SOURCE_DIR}/block_kernel_manager.cpp
1011
${CMAKE_CURRENT_SOURCE_DIR}/block_kernel_manager.h
1112
${CMAKE_CURRENT_SOURCE_DIR}/build.cpp
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (C) 2017-2019 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "runtime/program/program.h"
9+
10+
namespace OCLRT {
11+
void Program::applyAdditionalOptions() {
12+
}
13+
}; // namespace OCLRT

runtime/program/build.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -57,6 +57,7 @@ cl_int Program::build(
5757

5858
options = (buildOptions) ? buildOptions : "";
5959
extractInternalOptions(options);
60+
applyAdditionalOptions();
6061

6162
CompilerInterface *pCompilerInterface = this->executionEnvironment.getCompilerInterface();
6263
if (!pCompilerInterface) {

runtime/program/program.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -266,6 +266,7 @@ class Program : public BaseObject<_cl_program> {
266266
void updateNonUniformFlag(const Program **inputProgram, size_t numInputPrograms);
267267

268268
void extractInternalOptions(std::string &options);
269+
MOCKABLE_VIRTUAL void applyAdditionalOptions();
269270

270271
MOCKABLE_VIRTUAL bool appendKernelDebugOptions();
271272
void notifyDebuggerWithSourceCode(std::string &filename);

unit_tests/program/program_tests.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -2926,3 +2926,22 @@ TEST_F(ProgramTests, givenProgramWhenUnknownInternalOptionsArePassedThenTheyAreN
29262926
EXPECT_EQ(0u, pProgram.getInternalOptions().length());
29272927
EXPECT_TRUE(buildOptions == internalOption);
29282928
}
2929+
2930+
class AdditionalOptionsMockProgram : public MockProgram {
2931+
public:
2932+
AdditionalOptionsMockProgram() : MockProgram(executionEnvironment) {}
2933+
void applyAdditionalOptions() override {
2934+
applyAdditionalOptionsCalled++;
2935+
MockProgram::applyAdditionalOptions();
2936+
}
2937+
uint32_t applyAdditionalOptionsCalled = 0;
2938+
ExecutionEnvironment executionEnvironment;
2939+
};
2940+
2941+
TEST_F(ProgramTests, givenProgramWhenBuiltThenAdditionalOptionsAreApplied) {
2942+
AdditionalOptionsMockProgram program;
2943+
cl_device_id device = pDevice;
2944+
2945+
program.build(1, &device, nullptr, nullptr, nullptr, false);
2946+
EXPECT_EQ(1u, program.applyAdditionalOptionsCalled);
2947+
}

0 commit comments

Comments
 (0)