Skip to content

Commit 102bceb

Browse files
committed
Adding bindless compilation toggles
Change-Id: I35e37e9319a660fe0e4588f7abdc821557948b18
1 parent 6dddcbd commit 102bceb

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

runtime/os_interface/debug_variables_base.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ DECLARE_DEBUG_VARIABLE(bool, AddClGlSharing, false, "Add cl-gl extension")
105105
DECLARE_DEBUG_VARIABLE(bool, EnableFormatQuery, false, "Enable sharing format querying")
106106
DECLARE_DEBUG_VARIABLE(bool, EnableFreeMemory, false, "Enable freeMemory in memory manager")
107107
DECLARE_DEBUG_VARIABLE(bool, ForceSamplerLowFilteringPrecision, false, "Force Low Filtering Precision Sampler mode")
108+
DECLARE_DEBUG_VARIABLE(bool, UseBindlessBuffers, false, "Force compiler to use bindless buffer addressing instead of stateful one")
109+
DECLARE_DEBUG_VARIABLE(bool, UseBindlessImages, false, "Force compiler to use bindless image addressing instead of stateful one")
108110
DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_motion_estimation extension")
109111
DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelAdvancedVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_advanced_motion_estimation extension")
110112
DECLARE_DEBUG_VARIABLE(int32_t, EnableBlitterOperationsSupport, -1, "-1: default, 0: disable, 1: enable")

runtime/program/program.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ Program::Program(ExecutionEnvironment &executionEnvironment, Context *context, b
7979
DebugManager.flags.DisableStatelessToStatefulOptimization.get()) {
8080
internalOptions += "-cl-intel-greater-than-4GB-buffer-required ";
8181
}
82+
83+
if (DebugManager.flags.UseBindlessBuffers.get()) {
84+
internalOptions += "-cl-intel-use-bindless-buffers ";
85+
}
86+
87+
if (DebugManager.flags.UseBindlessImages.get()) {
88+
internalOptions += "-cl-intel-use-bindless-images ";
89+
}
90+
8291
kernelDebugEnabled = pDevice->isSourceLevelDebuggerActive();
8392

8493
auto enableStatelessToStatefullWithOffset = pDevice->getHardwareCapabilities().isStatelesToStatefullWithOffsetSupported;

unit_tests/program/program_tests.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,42 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsWhenStatelessToStateful
17631763
}
17641764
}
17651765

1766+
TEST_F(ProgramTests, WhenCreatingProgramThenBindlessIsEnabledOnlyIfDebugFlagIsEnabled) {
1767+
using namespace testing;
1768+
DebugManagerStateRestore restorer;
1769+
1770+
{
1771+
EXPECT_FALSE(DebugManager.flags.UseBindlessBuffers.get());
1772+
EXPECT_FALSE(DebugManager.flags.UseBindlessImages.get());
1773+
MockProgram programNoBindless(*pDevice->getExecutionEnvironment(), pContext, false);
1774+
EXPECT_THAT(programNoBindless.getInternalOptions(), Not(HasSubstr(std::string("-cl-intel-use-bindless-buffers"))));
1775+
EXPECT_THAT(programNoBindless.getInternalOptions(), Not(HasSubstr(std::string("-cl-intel-use-bindless-images"))));
1776+
}
1777+
1778+
{
1779+
DebugManager.flags.UseBindlessBuffers.set(true);
1780+
MockProgram programNoBindless(*pDevice->getExecutionEnvironment(), pContext, false);
1781+
EXPECT_THAT(programNoBindless.getInternalOptions(), HasSubstr(std::string("-cl-intel-use-bindless-buffers ")));
1782+
EXPECT_THAT(programNoBindless.getInternalOptions(), Not(HasSubstr(std::string("-cl-intel-use-bindless-images"))));
1783+
}
1784+
1785+
{
1786+
DebugManager.flags.UseBindlessBuffers.set(false);
1787+
DebugManager.flags.UseBindlessImages.set(true);
1788+
MockProgram programNoBindless(*pDevice->getExecutionEnvironment(), pContext, false);
1789+
EXPECT_THAT(programNoBindless.getInternalOptions(), Not(HasSubstr(std::string("-cl-intel-use-bindless-buffers"))));
1790+
EXPECT_THAT(programNoBindless.getInternalOptions(), HasSubstr(std::string("-cl-intel-use-bindless-images ")));
1791+
}
1792+
1793+
{
1794+
DebugManager.flags.UseBindlessBuffers.set(true);
1795+
DebugManager.flags.UseBindlessImages.set(true);
1796+
MockProgram programNoBindless(*pDevice->getExecutionEnvironment(), pContext, false);
1797+
EXPECT_THAT(programNoBindless.getInternalOptions(), HasSubstr(std::string("-cl-intel-use-bindless-buffers ")));
1798+
EXPECT_THAT(programNoBindless.getInternalOptions(), HasSubstr(std::string("-cl-intel-use-bindless-images ")));
1799+
}
1800+
}
1801+
17661802
TEST_F(ProgramTests, givenDeviceThatSupportsSharedSystemMemoryAllocationWhenProgramIsCompiledThenItForcesStatelessCompilation) {
17671803
pDevice->deviceInfo.sharedSystemMemCapabilities = CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL;
17681804
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false);

unit_tests/test_files/igdrcl.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,6 @@ AllocateSharedAllocationsWithCpuAndGpuStorage = -1
123123
EnableSharedSystemUsmSupport = -1
124124
ForcePerDssBackedBufferProgramming = 0
125125
ForceSamplerLowFilteringPrecision = 0
126+
UseBindlessBuffers = 0
127+
UseBindlessImages = 0
126128
PrintProgramBinaryProcessingTime = 0

0 commit comments

Comments
 (0)