mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
feature: add support for L0 v1.14 API
Related-To: NEO-14560 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c7b736f493
commit
7611d376f9
@@ -42,7 +42,7 @@ const std::vector<std::pair<std::string, uint32_t>> DriverHandleImp::extensionsS
|
||||
{ZE_DEVICE_VECTOR_SIZES_EXT_NAME, ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_1_0},
|
||||
{ZE_MUTABLE_COMMAND_LIST_EXP_NAME, ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_1},
|
||||
{ZE_RTAS_EXT_NAME, ZE_RTAS_BUILDER_EXT_VERSION_1_0},
|
||||
{ZE_DRIVER_DDI_HANDLES_EXT_NAME, ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_0},
|
||||
{ZE_DRIVER_DDI_HANDLES_EXT_NAME, ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_1},
|
||||
{ZE_EU_COUNT_EXT_NAME, ZE_EU_COUNT_EXT_VERSION_1_0},
|
||||
{ZE_RECORD_REPLAY_GRAPH_EXP_NAME, ZE_RECORD_REPLAY_GRAPH_EXP_VERSION_1_0},
|
||||
|
||||
|
||||
@@ -67,5 +67,6 @@ void globalDriverTeardown() {
|
||||
globalDriverDispatch.core.isValidFlag = false;
|
||||
globalDriverDispatch.tools.isValidFlag = false;
|
||||
globalDriverDispatch.sysman.isValidFlag = false;
|
||||
globalDriverDispatch.runtime.isValidFlag = false;
|
||||
}
|
||||
} // namespace L0
|
||||
|
||||
@@ -19,13 +19,6 @@
|
||||
#endif
|
||||
|
||||
namespace LevelZeroBlackBoxTests {
|
||||
decltype(&zerGetDefaultContext) zerGetDefaultContextFunc = nullptr;
|
||||
decltype(&zeDeviceSynchronize) zeDeviceSynchronizeFunc = nullptr;
|
||||
decltype(&zeCommandListAppendLaunchKernelWithArguments) zeCommandListAppendLaunchKernelWithArgumentsFunc = nullptr;
|
||||
decltype(&zeCommandListAppendLaunchKernelWithParameters) zeCommandListAppendLaunchKernelWithParametersFunc = nullptr;
|
||||
decltype(&zerTranslateIdentifierToDeviceHandle) zerTranslateIdentifierToDeviceHandleFunc = nullptr;
|
||||
decltype(&zerTranslateDeviceHandleToIdentifier) zerTranslateDeviceHandleToIdentifierFunc = nullptr;
|
||||
decltype(&zerGetLastErrorDescription) zerGetLastErrorDescriptionFunc = nullptr;
|
||||
pfnZexCounterBasedEventCreate2 zexCounterBasedEventCreate2Func = nullptr;
|
||||
|
||||
struct LoadedDriverExtensions {
|
||||
@@ -502,16 +495,7 @@ std::vector<ze_device_handle_t> zelloInitContextAndGetDevices(ze_context_handle_
|
||||
SUCCESS_OR_TERMINATE(zeInitDrivers(&driverCount, &driverHandle, &desc));
|
||||
testDriverHandle = driverHandle;
|
||||
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zerGetDefaultContext", reinterpret_cast<void **>(&zerGetDefaultContextFunc)));
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zeDeviceSynchronize", reinterpret_cast<void **>(&zeDeviceSynchronizeFunc)));
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zeCommandListAppendLaunchKernelWithArguments", reinterpret_cast<void **>(&zeCommandListAppendLaunchKernelWithArgumentsFunc)));
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zeCommandListAppendLaunchKernelWithParameters", reinterpret_cast<void **>(&zeCommandListAppendLaunchKernelWithParametersFunc)));
|
||||
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zerTranslateIdentifierToDeviceHandle", reinterpret_cast<void **>(&zerTranslateIdentifierToDeviceHandleFunc)));
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zerTranslateDeviceHandleToIdentifier", reinterpret_cast<void **>(&zerTranslateDeviceHandleToIdentifierFunc)));
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetExtensionFunctionAddress(driverHandle, "zerGetLastErrorDescription", reinterpret_cast<void **>(&zerGetLastErrorDescriptionFunc)));
|
||||
|
||||
context = zerGetDefaultContextFunc();
|
||||
context = zerGetDefaultContext();
|
||||
if (!context) {
|
||||
const char *description = nullptr;
|
||||
SUCCESS_OR_TERMINATE(zeDriverGetLastErrorDescription(driverHandle, &description));
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "level_zero/driver_experimental/zex_event.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
#include <level_zero/ze_intel_gpu.h>
|
||||
#include <level_zero/zer_api.h>
|
||||
|
||||
#include <bitset>
|
||||
#include <fstream>
|
||||
@@ -22,13 +23,6 @@
|
||||
namespace LevelZeroBlackBoxTests {
|
||||
template <bool terminateOnFailure, typename ResulT>
|
||||
inline void validate(ResulT result, const char *message);
|
||||
extern decltype(&zerGetDefaultContext) zerGetDefaultContextFunc;
|
||||
extern decltype(&zeDeviceSynchronize) zeDeviceSynchronizeFunc;
|
||||
extern decltype(&zeCommandListAppendLaunchKernelWithArguments) zeCommandListAppendLaunchKernelWithArgumentsFunc;
|
||||
extern decltype(&zeCommandListAppendLaunchKernelWithParameters) zeCommandListAppendLaunchKernelWithParametersFunc;
|
||||
extern decltype(&zerTranslateIdentifierToDeviceHandle) zerTranslateIdentifierToDeviceHandleFunc;
|
||||
extern decltype(&zerTranslateDeviceHandleToIdentifier) zerTranslateDeviceHandleToIdentifierFunc;
|
||||
extern decltype(&zerGetLastErrorDescription) zerGetLastErrorDescriptionFunc;
|
||||
} // namespace LevelZeroBlackBoxTests
|
||||
|
||||
#define SUCCESS_OR_TERMINATE(CALL) LevelZeroBlackBoxTests::validate<true>(CALL, #CALL)
|
||||
|
||||
@@ -19,7 +19,7 @@ void executeKernelAndValidate(ze_context_handle_t context, uint32_t deviceIdentf
|
||||
std::cout << "Testing for device " << deviceIdentfier << std::endl;
|
||||
}
|
||||
ze_command_list_handle_t cmdList;
|
||||
auto device = LevelZeroBlackBoxTests::zerTranslateIdentifierToDeviceHandleFunc(deviceIdentfier);
|
||||
auto device = zerTranslateIdentifierToDeviceHandle(deviceIdentfier);
|
||||
SUCCESS_OR_TERMINATE(zeCommandListCreateImmediate(context, device, &defaultIntelCommandQueueDesc, &cmdList));
|
||||
|
||||
constexpr ze_group_count_t groupCounts{16, 1, 1};
|
||||
@@ -90,9 +90,9 @@ void executeKernelAndValidate(ze_context_handle_t context, uint32_t deviceIdentf
|
||||
&initValues // initial values for output sums
|
||||
};
|
||||
|
||||
SUCCESS_OR_TERMINATE(LevelZeroBlackBoxTests::zeCommandListAppendLaunchKernelWithArgumentsFunc(cmdList, kernel, groupCounts, groupSizes, kernelArgs, nullptr, nullptr, 0, nullptr));
|
||||
SUCCESS_OR_TERMINATE(zeCommandListAppendLaunchKernelWithArguments(cmdList, kernel, groupCounts, groupSizes, kernelArgs, nullptr, nullptr, 0, nullptr));
|
||||
|
||||
SUCCESS_OR_TERMINATE(LevelZeroBlackBoxTests::zeDeviceSynchronizeFunc(device));
|
||||
SUCCESS_OR_TERMINATE(zeDeviceSynchronize(device));
|
||||
|
||||
// Validate
|
||||
outputValidationSuccessful = true;
|
||||
@@ -138,16 +138,16 @@ int main(int argc, char *argv[]) {
|
||||
ze_context_handle_t context = nullptr;
|
||||
const char *errorMsg = nullptr;
|
||||
auto devices = LevelZeroBlackBoxTests::zelloInitContextAndGetDevices(context);
|
||||
SUCCESS_OR_TERMINATE(LevelZeroBlackBoxTests::zerGetLastErrorDescriptionFunc(&errorMsg));
|
||||
SUCCESS_OR_TERMINATE(zerGetLastErrorDescription(&errorMsg));
|
||||
|
||||
if (errorMsg != nullptr && errorMsg[0] != 0) {
|
||||
std::cerr << "Error initializing context: " << (errorMsg ? errorMsg : "Unknown error") << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t deviceOrdinal = LevelZeroBlackBoxTests::zerTranslateDeviceHandleToIdentifierFunc(devices[0]);
|
||||
uint32_t deviceOrdinal = zerTranslateDeviceHandleToIdentifier(devices[0]);
|
||||
|
||||
SUCCESS_OR_TERMINATE(LevelZeroBlackBoxTests::zerGetLastErrorDescriptionFunc(&errorMsg));
|
||||
SUCCESS_OR_TERMINATE(zerGetLastErrorDescription(&errorMsg));
|
||||
|
||||
if (errorMsg != nullptr && errorMsg[0] != 0) {
|
||||
std::cerr << "Error zerTranslateDeviceHandleToIdentifier: " << errorMsg << std::endl;
|
||||
|
||||
@@ -16,6 +16,7 @@ void L0::UltConfigListenerL0::OnTestStart(const ::testing::TestInfo &testInfo) {
|
||||
globalDriverDispatch.core.isValidFlag = true;
|
||||
globalDriverDispatch.tools.isValidFlag = true;
|
||||
globalDriverDispatch.sysman.isValidFlag = true;
|
||||
globalDriverDispatch.runtime.isValidFlag = true;
|
||||
globalDriverHandles->clear();
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ void L0::UltConfigListenerL0::OnTestEnd(const ::testing::TestInfo &testInfo) {
|
||||
globalDriverDispatch.core.isValidFlag = false;
|
||||
globalDriverDispatch.tools.isValidFlag = false;
|
||||
globalDriverDispatch.sysman.isValidFlag = false;
|
||||
globalDriverDispatch.runtime.isValidFlag = false;
|
||||
EXPECT_TRUE(globalDriverHandles->empty());
|
||||
EXPECT_EQ(nullptr, L0::Sysman::globalSysmanDriver);
|
||||
|
||||
|
||||
@@ -200,12 +200,14 @@ TEST_F(GlobalTearDownTests, givenGlobalDriverDispatchWhenGlobalSetupAndTeardownA
|
||||
EXPECT_TRUE(globalDriverDispatch.core.isValidFlag);
|
||||
EXPECT_TRUE(globalDriverDispatch.tools.isValidFlag);
|
||||
EXPECT_TRUE(globalDriverDispatch.sysman.isValidFlag);
|
||||
EXPECT_TRUE(globalDriverDispatch.runtime.isValidFlag);
|
||||
|
||||
globalDriverTeardown();
|
||||
|
||||
EXPECT_FALSE(globalDriverDispatch.core.isValidFlag);
|
||||
EXPECT_FALSE(globalDriverDispatch.tools.isValidFlag);
|
||||
EXPECT_FALSE(globalDriverDispatch.sysman.isValidFlag);
|
||||
EXPECT_FALSE(globalDriverDispatch.runtime.isValidFlag);
|
||||
}
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -1843,7 +1843,7 @@ TEST_F(DriverExtensionsTest, givenDriverHandleWhenAskingForExtensionsThenReturnC
|
||||
verifyExtensionDefinition(ZE_DEVICE_VECTOR_SIZES_EXT_NAME, ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_1_0);
|
||||
verifyExtensionDefinition(ZE_MUTABLE_COMMAND_LIST_EXP_NAME, ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_1);
|
||||
verifyExtensionDefinition(ZE_RTAS_EXT_NAME, ZE_RTAS_BUILDER_EXT_VERSION_1_0);
|
||||
verifyExtensionDefinition(ZE_DRIVER_DDI_HANDLES_EXT_NAME, ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_0);
|
||||
verifyExtensionDefinition(ZE_DRIVER_DDI_HANDLES_EXT_NAME, ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_1);
|
||||
verifyExtensionDefinition(ZE_EU_COUNT_EXT_NAME, ZE_EU_COUNT_EXT_VERSION_1_0);
|
||||
verifyExtensionDefinition(ZE_RECORD_REPLAY_GRAPH_EXP_NAME, ZE_RECORD_REPLAY_GRAPH_EXP_VERSION_1_0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user