Skip to content

Commit b32f726

Browse files
feature: Enable support for reporting bfloat16 conversion support for L0
Related-To: NEO-14316 Signed-off-by: Neil R. Spruit <[email protected]>
1 parent bc68b70 commit b32f726

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

level_zero/core/source/driver/driver_handle_imp.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "shared/source/memory_manager/unified_memory_manager.h"
2424
#include "shared/source/os_interface/os_interface.h"
2525
#include "shared/source/os_interface/os_library.h"
26+
#include "shared/source/release_helper/release_helper.h"
2627
#include "shared/source/utilities/logger.h"
2728

2829
#include "level_zero/core/source/builtin/builtin_functions_lib.h"
@@ -155,12 +156,30 @@ ze_result_t DriverHandleImp::getExtensionProperties(uint32_t *pCount,
155156

156157
std::vector<std::pair<std::string, uint32_t>> additionalExtensions;
157158

159+
bool isBfloat16Supported = false;
160+
bool isBindlessHeapsSupported = false;
158161
for (const auto device : devices) {
162+
if (device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper()) {
163+
if (device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper()->isBFloat16ConversionSupported()) {
164+
isBfloat16Supported = true;
165+
}
166+
}
159167
if (device->getNEODevice()->getRootDeviceEnvironment().getBindlessHeapsHelper()) {
160-
additionalExtensions.emplace_back(ZE_BINDLESS_IMAGE_EXP_NAME, ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT);
168+
isBindlessHeapsSupported = true;
169+
}
170+
if (isBfloat16Supported && isBindlessHeapsSupported) {
161171
break;
162172
}
163173
}
174+
175+
if (isBindlessHeapsSupported) {
176+
additionalExtensions.emplace_back(ZE_BINDLESS_IMAGE_EXP_NAME, ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT);
177+
}
178+
179+
if (isBfloat16Supported) {
180+
additionalExtensions.emplace_back(ZE_BFLOAT16_CONVERSIONS_EXT_NAME, ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_1_0);
181+
}
182+
164183
devices[0]->getL0GfxCoreHelper().appendPlatformSpecificExtensions(additionalExtensions, devices[0]->getProductHelper(), devices[0]->getHwInfo());
165184

166185
if (devices[0]->getL0GfxCoreHelper().synchronizedDispatchSupported() && devices[0]->isImplicitScalingCapable()) {

level_zero/core/test/unit_tests/sources/driver/test_driver.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "shared/test/common/mocks/mock_execution_environment.h"
2626
#include "shared/test/common/mocks/mock_io_functions.h"
2727
#include "shared/test/common/mocks/mock_os_library.h"
28+
#include "shared/test/common/mocks/mock_release_helper.h"
2829
#include "shared/test/common/mocks/mock_sip.h"
2930
#include "shared/test/common/mocks/ult_device_factory.h"
3031
#include "shared/test/common/test_macros/hw_test.h"
@@ -151,6 +152,13 @@ TEST_F(DriverVersionTest, givenCallToGetExtensionPropertiesThenSupportedExtensio
151152
if (device->getNEODevice()->getRootDeviceEnvironment().getBindlessHeapsHelper()) {
152153
additionalExtensions.emplace_back(ZE_BINDLESS_IMAGE_EXP_NAME, ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT);
153154
}
155+
auto mockReleaseHelperVal = std::unique_ptr<MockReleaseHelper>(new MockReleaseHelper());
156+
mockReleaseHelperVal->bFloat16Support = true;
157+
auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironmentRef();
158+
rootDeviceEnvironment.releaseHelper.reset(mockReleaseHelperVal.release());
159+
if (device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper()->isBFloat16ConversionSupported()) {
160+
additionalExtensions.emplace_back(ZE_BFLOAT16_CONVERSIONS_EXT_NAME, ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_1_0);
161+
}
154162
if (!device->getProductHelper().isDcFlushAllowed()) {
155163
additionalExtensions.emplace_back(ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_NAME, ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_VERSION_CURRENT);
156164
}

shared/test/common/mocks/mock_release_helper.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class MockReleaseHelper : public ReleaseHelper {
2121
ADDMETHOD_CONST_NOBASE(isPipeControlPriorToPipelineSelectWaRequired, bool, false, ());
2222
ADDMETHOD_CONST_NOBASE(isProgramAllStateComputeCommandFieldsWARequired, bool, false, ());
2323
ADDMETHOD_CONST_NOBASE(isSplitMatrixMultiplyAccumulateSupported, bool, false, ());
24-
ADDMETHOD_CONST_NOBASE(isBFloat16ConversionSupported, bool, false, ());
2524
ADDMETHOD_CONST_NOBASE(isAuxSurfaceModeOverrideRequired, bool, false, ());
2625
ADDMETHOD_CONST_NOBASE(isResolvingSubDeviceIDNeeded, bool, false, ());
2726
ADDMETHOD_CONST_NOBASE(isDirectSubmissionSupported, bool, false, ());
@@ -48,5 +47,10 @@ class MockReleaseHelper : public ReleaseHelper {
4847
static SizeToPreferredSlmValueArray sizeToPreferredSlmValue = {};
4948
return sizeToPreferredSlmValue;
5049
}
50+
51+
bool isBFloat16ConversionSupported() const override {
52+
return bFloat16Support;
53+
}
54+
bool bFloat16Support = false;
5155
};
5256
} // namespace NEO

0 commit comments

Comments
 (0)