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
25 changes: 23 additions & 2 deletions conformance_tests/core/test_copy/src/test_copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,12 +1140,31 @@ INSTANTIATE_TEST_SUITE_P(
class AppendMemoryCopyRegionWithSharedSystem
: public ::testing::Test,
public ::testing::WithParamInterface<
std::tuple<size_t, size_t, size_t, bool>> {
std::tuple<size_t, size_t, size_t, bool, bool>> {
protected:
void RunMemoryCopyRegionTest() {

is_immediate = std::get<3>(GetParam());
cmd_bundle = lzt::create_command_bundle(is_immediate);
use_copy_engine = std::get<4>(GetParam());

auto cmd_queue_group_props = get_command_queue_group_properties(
zeDevice::get_instance()->get_device());

const ze_command_queue_group_property_flags_t queue_group_flags_set =
use_copy_engine
? ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY
: (ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE |
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
const ze_command_queue_group_property_flags_t queue_group_flags_not_set =
use_copy_engine ? ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE : 0;
auto ordinal =
lzt::get_queue_ordinal(cmd_queue_group_props, queue_group_flags_set,
queue_group_flags_not_set);
ASSERT_TRUE(ordinal);

auto cmd_bundle = lzt::create_command_bundle(
lzt::get_default_context(), zeDevice::get_instance()->get_device(), 0,
*ordinal, is_immediate);

// Set up memory buffers for test
// Device memory has to be copied in so
Expand Down Expand Up @@ -1233,6 +1252,7 @@ class AppendMemoryCopyRegionWithSharedSystem
size_t columns;
size_t slices;
bool is_immediate;
bool use_copy_engine;
size_t memory_size;
};

Expand Down Expand Up @@ -1346,6 +1366,7 @@ INSTANTIATE_TEST_SUITE_P(MemoryCopies, AppendMemoryCopyRegionWithSharedSystem,
::testing::Values(8, 64), // Cols
::testing::Values(1, 8,
64), // Slices
::testing::Bool(),
::testing::Bool()));

class zeCommandListAppendMemoryCopyTests : public ::testing::Test {
Expand Down
7 changes: 7 additions & 0 deletions utils/utils/include/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <vector>
#include <memory>
#include <map>
#include <optional>

#include <level_zero/zet_api.h>
#include <level_zero/zes_api.h>
Expand Down Expand Up @@ -91,6 +92,12 @@ uint32_t get_device_count(ze_driver_handle_t driver);
uint32_t get_driver_handle_count();
uint32_t get_sub_device_count(ze_device_handle_t device);

std::optional<uint32_t>
get_queue_ordinal(const std::vector<ze_command_queue_group_properties_t>
&cmd_queue_group_props,
ze_command_queue_group_property_flags_t include_flags,
ze_command_queue_group_property_flags_t exclude_flags);

void print_driver_version();
void print_driver_overview(const ze_driver_handle_t driver);
void print_driver_overview(const std::vector<ze_driver_handle_t> driver);
Expand Down
14 changes: 14 additions & 0 deletions utils/utils/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,20 @@ void sort_devices(std::vector<ze_device_handle_t> &devices) {
});
}

std::optional<uint32_t>
get_queue_ordinal(const std::vector<ze_command_queue_group_properties_t>
&cmd_queue_group_props,
ze_command_queue_group_property_flags_t include_flags,
ze_command_queue_group_property_flags_t exclude_flags) {
for (uint32_t i = 0; i < cmd_queue_group_props.size(); i++) {
if ((cmd_queue_group_props[i].flags & include_flags) == include_flags &&
(cmd_queue_group_props[i].flags & exclude_flags) == 0) {
return i;
}
}
return std::nullopt;
}

void print_driver_version(ze_driver_handle_t driver) {
ze_driver_properties_t properties = {};

Expand Down