Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions unified-runtime/test/adapters/level_zero/enqueue_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct urL0EnqueueAllocMultiQueueMultiDeviceTest
std::vector<ur_queue_handle_t> queues;
};

UUR_DEVICE_TEST_SUITE_WITH_PARAM(
UUR_MULTI_QUEUE_TYPE_TEST_SUITE_WITH_PARAM(
urL0EnqueueAllocTest,
::testing::ValuesIn({
EnqueueAllocTestParam{urEnqueueUSMHostAllocExp,
Expand All @@ -170,13 +170,11 @@ UUR_DEVICE_TEST_SUITE_WITH_PARAM(
EnqueueAllocTestParam{urEnqueueUSMDeviceAllocExp,
uur::GetDeviceUSMDeviceSupport},
}),
uur::deviceTestWithParamPrinter<EnqueueAllocTestParam>);
uur::deviceTestWithParamPrinterMulti<EnqueueAllocTestParam>);

TEST_P(urL0EnqueueAllocTest, Success) {
const auto enqueueUSMAllocFunc =
std::get<1>(this->GetParam()).enqueueUSMAllocFunc;
const auto checkUSMSupportFunc =
std::get<1>(this->GetParam()).checkUSMSupportFunc;
const auto enqueueUSMAllocFunc = getParam().enqueueUSMAllocFunc;
const auto checkUSMSupportFunc = getParam().checkUSMSupportFunc;

ur_device_usm_access_capability_flags_t USMSupport = 0;
ASSERT_SUCCESS(checkUSMSupportFunc(device, USMSupport));
Expand All @@ -200,10 +198,8 @@ TEST_P(urL0EnqueueAllocTest, Success) {
}

TEST_P(urL0EnqueueAllocTest, SuccessReuse) {
const auto enqueueUSMAllocFunc =
std::get<1>(this->GetParam()).enqueueUSMAllocFunc;
const auto checkUSMSupportFunc =
std::get<1>(this->GetParam()).checkUSMSupportFunc;
const auto enqueueUSMAllocFunc = getParam().enqueueUSMAllocFunc;
const auto checkUSMSupportFunc = getParam().checkUSMSupportFunc;

ur_device_usm_access_capability_flags_t USMSupport = 0;
ASSERT_SUCCESS(checkUSMSupportFunc(device, USMSupport));
Expand Down Expand Up @@ -238,10 +234,8 @@ TEST_P(urL0EnqueueAllocTest, SuccessReuse) {
}

TEST_P(urL0EnqueueAllocTest, SuccessFromPool) {
const auto enqueueUSMAllocFunc =
std::get<1>(this->GetParam()).enqueueUSMAllocFunc;
const auto checkUSMSupportFunc =
std::get<1>(this->GetParam()).checkUSMSupportFunc;
const auto enqueueUSMAllocFunc = getParam().enqueueUSMAllocFunc;
const auto checkUSMSupportFunc = getParam().checkUSMSupportFunc;

ur_device_usm_access_capability_flags_t USMSupport = 0;
ASSERT_SUCCESS(checkUSMSupportFunc(device, USMSupport));
Expand Down Expand Up @@ -269,10 +263,8 @@ TEST_P(urL0EnqueueAllocTest, SuccessFromPool) {
}

TEST_P(urL0EnqueueAllocTest, SuccessWithKernel) {
const auto enqueueUSMAllocFunc =
std::get<1>(this->GetParam()).enqueueUSMAllocFunc;
const auto checkUSMSupportFunc =
std::get<1>(this->GetParam()).checkUSMSupportFunc;
const auto enqueueUSMAllocFunc = getParam().enqueueUSMAllocFunc;
const auto checkUSMSupportFunc = getParam().checkUSMSupportFunc;

ur_device_usm_access_capability_flags_t USMSupport = 0;
ASSERT_SUCCESS(checkUSMSupportFunc(device, USMSupport));
Expand All @@ -294,10 +286,8 @@ TEST_P(urL0EnqueueAllocTest, SuccessWithKernel) {
}

TEST_P(urL0EnqueueAllocTest, SuccessWithKernelRepeat) {
const auto enqueueUSMAllocFunc =
std::get<1>(this->GetParam()).enqueueUSMAllocFunc;
const auto checkUSMSupportFunc =
std::get<1>(this->GetParam()).checkUSMSupportFunc;
const auto enqueueUSMAllocFunc = getParam().enqueueUSMAllocFunc;
const auto checkUSMSupportFunc = getParam().checkUSMSupportFunc;

ur_device_usm_access_capability_flags_t USMSupport = 0;
ASSERT_SUCCESS(checkUSMSupportFunc(device, USMSupport));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using urEnqueueMemBufferMapTestWithParamL0 =
uur::urMemBufferQueueTestWithParam<uur::mem_buffer_test_parameters_t>;

UUR_DEVICE_TEST_SUITE_WITH_PARAM(
UUR_MULTI_QUEUE_TYPE_TEST_SUITE_WITH_PARAM(
urEnqueueMemBufferMapTestWithParamL0,
::testing::ValuesIn(uur::mem_buffer_test_parameters),
uur::printMemBufferTestString<urEnqueueMemBufferMapTestWithParamL0>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "ze_helpers.hpp"

using namespace std::chrono_literals;
using urLevelZeroEventNativeHandleTest = uur::urQueueTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urLevelZeroEventNativeHandleTest);
using urLevelZeroEventNativeHandleTest = uur::urMultiQueueTypeTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(urLevelZeroEventNativeHandleTest);

#define TEST_MEMCPY_SIZE 4096

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#include "ze_api.h"
#include <uur/fixtures.h>

using urLevelZeroKernelNativeHandleTest = uur::urQueueTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urLevelZeroKernelNativeHandleTest);
using urLevelZeroKernelNativeHandleTest = uur::urMultiQueueTypeTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(
urLevelZeroKernelNativeHandleTest);

TEST_P(urLevelZeroKernelNativeHandleTest, OwnedHandleRelease) {
ze_context_handle_t native_context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#include "ze_api.h"
#include <uur/fixtures.h>

using urMemBufferCreateWithNativeHandleTest = uur::urQueueTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urMemBufferCreateWithNativeHandleTest);
using urMemBufferCreateWithNativeHandleTest = uur::urMultiQueueTypeTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(
urMemBufferCreateWithNativeHandleTest);

TEST_P(urMemBufferCreateWithNativeHandleTest, SharedBufferIsUsedDirectly) {
UUR_KNOWN_FAILURE_ON(uur::LevelZero{});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <uur/fixtures.h>

using urLevelZeroProgramLinkTest = uur::urProgramTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urLevelZeroProgramLinkTest);
UUR_DEVICE_TEST_SUITE_WITH_DEFAULT_QUEUE(urLevelZeroProgramLinkTest);

TEST_P(urLevelZeroProgramLinkTest, InvalidLinkOptionsPrintedInLog) {
ur_program_handle_t linked_program = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct urEnqueueKernelLaunchTest : uur::urKernelExecutionTest {
size_t global_offset = 0;
size_t n_dimensions = 1;
};
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEnqueueKernelLaunchTest);
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(urEnqueueKernelLaunchTest);

TEST_P(urEnqueueKernelLaunchTest, DeferredKernelRelease) {
ur_mem_handle_t buffer = nullptr;
Expand Down
81 changes: 64 additions & 17 deletions unified-runtime/test/conformance/enqueue/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#ifndef UUR_ENQUEUE_RECT_HELPERS_H_INCLUDED
#define UUR_ENQUEUE_RECT_HELPERS_H_INCLUDED

#include "ur_api.h"
#include <cstring>
#include <sstream>
#include <uur/fixtures.h>

namespace uur {
Expand All @@ -31,8 +33,33 @@ printRectTestString(const testing::TestParamInfo<typename T::ParamType> &info) {
// ParamType will be std::tuple<ur_device_handle_t, test_parameters_t>
const auto device_handle = std::get<0>(info.param).device;
const auto platform_device_name = GetPlatformAndDeviceName(device_handle);
const auto &test_name = std::get<1>(info.param).name;
return platform_device_name + "__" + test_name;

std::stringstream ss;
auto param_tuple = std::get<1>(info.param);
auto test_name = std::get<0>(param_tuple).name;
auto queue_mode = std::get<1>(param_tuple);

ss << platform_device_name << "__" << test_name << "__" << queue_mode;

return ss.str();
}

template <typename T>
inline std::string printRectTestStringMultiQueue(
const testing::TestParamInfo<typename T::ParamType> &info) {
// ParamType will be std::tuple<ur_device_handle_t, test_parameters_t>
const auto device_handle = std::get<0>(info.param).device;
const auto platform_device_name = GetPlatformAndDeviceName(device_handle);
auto paramTuple = std::get<1>(info.param);
auto param = std::get<0>(paramTuple);

auto queueMode = std::get<1>(paramTuple);

std::stringstream test_name;
test_name << platform_device_name;
test_name << param.name << "__" << queueMode;

return test_name.str();
}

// Performs host side equivalent of urEnqueueMemBufferReadRect,
Expand Down Expand Up @@ -74,13 +101,18 @@ print2DTestString(const testing::TestParamInfo<typename T::ParamType> &info) {
const auto platform_device_name =
uur::GetPlatformAndDeviceName(device_handle);
std::stringstream test_name;
const auto src_kind = std::get<1>(std::get<1>(info.param));
const auto dst_kind = std::get<2>(std::get<1>(info.param));
test_name << platform_device_name << "__pitch__"
<< std::get<0>(std::get<1>(info.param)).pitch << "__width__"
<< std::get<0>(std::get<1>(info.param)).width << "__height__"
<< std::get<0>(std::get<1>(info.param)).height << "__src__"
<< src_kind << "__dst__" << dst_kind;

auto paramTuple = std::get<1>(info.param);
auto param = std::get<0>(paramTuple);
auto queueMode = std::get<1>(paramTuple);
const auto src_kind = std::get<1>(param);
const auto dst_kind = std::get<2>(param);
TestParameters2D testParams = std::get<0>(param);
test_name << platform_device_name << "__pitch__" << testParams.pitch
<< "__width__" << testParams.width << "__height__"
<< testParams.height << "__src__" << src_kind << "__dst__"
<< dst_kind << "__" << queueMode;

return test_name.str();
}

Expand Down Expand Up @@ -122,10 +154,16 @@ inline std::string printMemBufferTestString(
const auto device_handle = std::get<0>(info.param).device;
const auto platform_device_name = GetPlatformAndDeviceName(device_handle);

auto paramTuple = std::get<1>(info.param);
auto param = std::get<0>(paramTuple);
auto queueMode = std::get<1>(paramTuple);

std::stringstream ss;
ss << std::get<1>(info.param).count;
ss << param.count;
ss << "_";
ss << std::get<1>(info.param).mem_flag;
ss << param.mem_flag;
ss << "__";
ss << queueMode;

return platform_device_name + "__" + ss.str();
}
Expand All @@ -138,22 +176,31 @@ inline std::string printMemBufferMapWriteTestString(
const auto device_handle = std::get<0>(info.param).device;
const auto platform_device_name = GetPlatformAndDeviceName(device_handle);

auto paramTuple = std::get<1>(info.param);
auto param = std::get<0>(paramTuple);
auto queueMode = std::get<1>(paramTuple);

std::stringstream ss;
ss << std::get<1>(info.param).map_flag;
ss << param.map_flag << "__" << queueMode;

return platform_device_name + "__" + ss.str();
}

template <typename T>
inline std::string
printFillTestString(const testing::TestParamInfo<typename T::ParamType> &info) {
inline std::string printFillTestStringMultiQueueType(
const testing::TestParamInfo<typename T::ParamType> &info) {
const auto device_handle = std::get<0>(info.param).device;
const auto platform_device_name =
uur::GetPlatformAndDeviceName(device_handle);
auto paramTuple = std::get<1>(info.param);
auto param = std::get<0>(paramTuple);

auto queueMode = std::get<1>(paramTuple);

std::stringstream test_name;
test_name << platform_device_name << "__size__"
<< std::get<1>(info.param).size << "__patternSize__"
<< std::get<1>(info.param).pattern_size;
test_name << platform_device_name << "__size__" << param.size
<< "__patternSize__" << param.pattern_size << "__" << queueMode;

return test_name.str();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
using urEnqueueDeviceGetGlobalVariableReadWithParamTest =
uur::urGlobalVariableWithParamTest<uur::BoolTestParam>;

UUR_DEVICE_TEST_SUITE_WITH_PARAM(
UUR_MULTI_QUEUE_TYPE_TEST_SUITE_WITH_PARAM(
urEnqueueDeviceGetGlobalVariableReadWithParamTest,
testing::ValuesIn(uur::BoolTestParam::makeBoolParam("Blocking")),
uur::deviceTestWithParamPrinter<uur::BoolTestParam>);
uur::deviceTestWithParamPrinterMulti<uur::BoolTestParam>);

TEST_P(urEnqueueDeviceGetGlobalVariableReadWithParamTest, Success) {
bool is_blocking = getParam().value;
Expand Down Expand Up @@ -44,7 +44,8 @@ TEST_P(urEnqueueDeviceGetGlobalVariableReadWithParamTest, Success) {
}

using urEnqueueDeviceGetGlobalVariableReadTest = uur::urGlobalVariableTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEnqueueDeviceGetGlobalVariableReadTest);
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(
urEnqueueDeviceGetGlobalVariableReadTest);

TEST_P(urEnqueueDeviceGetGlobalVariableReadTest, InvalidNullHandleQueue) {
ASSERT_EQ_RESULT(urEnqueueDeviceGlobalVariableRead(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
using urEnqueueDeviceGetGlobalVariableWriteWithParamTest =
uur::urGlobalVariableWithParamTest<uur::BoolTestParam>;

UUR_DEVICE_TEST_SUITE_WITH_PARAM(
UUR_MULTI_QUEUE_TYPE_TEST_SUITE_WITH_PARAM(
urEnqueueDeviceGetGlobalVariableWriteWithParamTest,
testing::ValuesIn(uur::BoolTestParam::makeBoolParam("Blocking")),
uur::deviceTestWithParamPrinter<uur::BoolTestParam>);
uur::deviceTestWithParamPrinterMulti<uur::BoolTestParam>);

TEST_P(urEnqueueDeviceGetGlobalVariableWriteWithParamTest, Success) {
bool is_blocking = getParam().value;
Expand Down Expand Up @@ -46,7 +46,8 @@ TEST_P(urEnqueueDeviceGetGlobalVariableWriteWithParamTest, Success) {
}

using urEnqueueDeviceGetGlobalVariableWriteTest = uur::urGlobalVariableTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEnqueueDeviceGetGlobalVariableWriteTest);
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(
urEnqueueDeviceGetGlobalVariableWriteTest);

TEST_P(urEnqueueDeviceGetGlobalVariableWriteTest, InvalidNullHandleQueue) {
ASSERT_EQ_RESULT(urEnqueueDeviceGlobalVariableWrite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ struct urEnqueueEventsWaitWithBarrierOrderingTest : uur::urProgramTest {
ur_mem_handle_t buffer = nullptr;
};

UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEnqueueEventsWaitWithBarrierOrderingTest);
UUR_INSTANTIATE_DEVICE_TEST_SUITE_MULTI_QUEUE(
urEnqueueEventsWaitWithBarrierOrderingTest);

TEST_P(urEnqueueEventsWaitWithBarrierTest, Success) {
UUR_KNOWN_FAILURE_ON(uur::LevelZero{}, uur::NativeCPU{});
Expand Down
Loading
Loading