Skip to content

Commit 32efe80

Browse files
add batch queues workarounds and skips
1 parent c79c8ea commit 32efe80

File tree

5 files changed

+93
-10
lines changed

5 files changed

+93
-10
lines changed

unified-runtime/test/adapters/level_zero/v2/command_list_cache_test.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "uur/fixtures.h"
1717
#include "uur/raii.h"
18+
#include "uur/utils.h"
1819

1920
#include <gtest/gtest.h>
2021
#include <map>
@@ -186,6 +187,7 @@ TEST_P(CommandListCacheTest, ImmediateCommandListsHaveProperAttributes) {
186187
TEST_P(CommandListCacheTest, CommandListsAreReusedByQueues) {
187188
static constexpr int NumQueuesPerType = 5;
188189
size_t NumUniqueQueueTypes = 0;
190+
bool isBatched = false;
189191

190192
for (int I = 0; I < NumQueuesPerType; I++) {
191193
NumUniqueQueueTypes = 0;
@@ -216,6 +218,8 @@ TEST_P(CommandListCacheTest, CommandListsAreReusedByQueues) {
216218
ASSERT_EQ(urQueueCreate(context, device, &QueueProps, Queue.ptr()),
217219
UR_RESULT_SUCCESS);
218220

221+
ASSERT_NO_FATAL_FAILURE(uur::isQueueBatched(Queue, &isBatched));
222+
219223
Queues.emplace_back(Queue);
220224
}
221225
}
@@ -227,7 +231,13 @@ TEST_P(CommandListCacheTest, CommandListsAreReusedByQueues) {
227231

228232
ASSERT_EQ(context->getCommandListCache().getNumImmediateCommandLists(),
229233
NumUniqueQueueTypes);
230-
ASSERT_EQ(context->getCommandListCache().getNumRegularCommandLists(), 0);
234+
235+
if (isBatched) {
236+
ASSERT_EQ(context->getCommandListCache().getNumRegularCommandLists(),
237+
NumUniqueQueueTypes);
238+
} else {
239+
ASSERT_EQ(context->getCommandListCache().getNumRegularCommandLists(), 0);
240+
}
231241
}
232242
}
233243

unified-runtime/test/adapters/level_zero/v2/event_pool_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "event_provider_counter.hpp"
2525
#include "event_provider_normal.hpp"
2626
#include "queue_handle.hpp"
27+
#include "uur/checks.h"
2728
#include "uur/fixtures.h"
2829
#include "ze_api.h"
2930

@@ -277,6 +278,13 @@ TEST_P(EventPoolTestWithQueue, WithTimestamp) {
277278
GTEST_SKIP() << "Profiling needs to be enabled";
278279
}
279280

281+
// bool isBatched = false;
282+
// ASSERT_NO_FATAL_FAILURE(isBatchedQueue(&isBatched));
283+
// if (isBatched) {
284+
// UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});
285+
// }
286+
SKIP_IF_BATCHED_QUEUE(queue);
287+
ASSERT_TRUE(false);
280288
auto zeEvent = createZeEvent(context, device);
281289

282290
ur_event_handle_t hEvent;

unified-runtime/test/conformance/enqueue/urEnqueueTimestampRecording.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,32 @@
44
//
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66

7+
#include "uur/checks.h"
8+
#include <gtest/gtest.h>
79
#include <uur/fixtures.h>
810
#include <uur/known_failure.h>
911

1012
struct urEnqueueTimestampRecordingExpTest : uur::urQueueTest {
1113
void SetUp() override {
1214
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
1315

14-
ur_queue_flags_t queueFlags{};
15-
ASSERT_SUCCESS(urQueueGetInfo(queue, UR_QUEUE_INFO_FLAGS,
16-
sizeof(ur_queue_flags_t), &queueFlags,
17-
nullptr));
18-
19-
if (queueFlags & UR_QUEUE_FLAG_SUBMISSION_BATCHED) {
20-
UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});
21-
}
22-
16+
// ur_queue_flags_t queueFlags{};
17+
// ASSERT_SUCCESS(urQueueGetInfo(queue, UR_QUEUE_INFO_FLAGS,
18+
// sizeof(ur_queue_flags_t), &queueFlags,
19+
// nullptr));
20+
21+
// if (queueFlags & UR_QUEUE_FLAG_SUBMISSION_BATCHED) {
22+
// UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});
23+
// }
24+
// bool isBatched = false;
25+
// ASSERT_NO_FATAL_FAILURE(isBatchedQueue(&isBatched));
26+
// // ASSERT_FALSE(true);
27+
// if (isBatched) {
28+
// UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});
29+
// }
30+
// ASSERT_TRUE(false);
31+
SKIP_IF_BATCHED_QUEUE(queue);
32+
// ASSERT_TRUE(false);
2333
bool timestamp_recording_support = false;
2434
ASSERT_SUCCESS(
2535
uur::GetTimestampRecordingSupport(device, timestamp_recording_support));

unified-runtime/test/conformance/testing/include/uur/fixtures.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,21 @@ struct urQueueTest : urContextTest {
407407
ur_queue_properties_t queue_properties = {UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
408408
nullptr, 0};
409409
ur_queue_handle_t queue = nullptr;
410+
411+
// void isBatchedQueue(bool *info) {
412+
// ur_queue_flags_t queueFlags{};
413+
// // ASSERT_TRUE(false);
414+
// ASSERT_SUCCESS(urQueueGetInfo(queue, UR_QUEUE_INFO_FLAGS,
415+
// sizeof(ur_queue_flags_t), &queueFlags,
416+
// nullptr));
417+
418+
// if (queueFlags & UR_QUEUE_FLAG_SUBMISSION_BATCHED) {
419+
// // UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});
420+
// *info = true;
421+
// } else {
422+
// *info = false;
423+
// }
424+
// }
410425
};
411426

412427
struct urHostPipeTest : urQueueTest {
@@ -478,6 +493,21 @@ template <class T> struct urQueueTestWithParam : urContextTestWithParam<T> {
478493
ur_queue_properties_t queue_properties = {UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
479494
nullptr, 0};
480495
ur_queue_handle_t queue = nullptr;
496+
497+
// void isBatchedQueue(bool *info) {
498+
// ur_queue_flags_t queueFlags{};
499+
// // ASSERT_TRUE(false);
500+
// ASSERT_SUCCESS(urQueueGetInfo(queue, UR_QUEUE_INFO_FLAGS,
501+
// sizeof(ur_queue_flags_t), &queueFlags,
502+
// nullptr));
503+
504+
// if (queueFlags & UR_QUEUE_FLAG_SUBMISSION_BATCHED) {
505+
// // UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{});
506+
// *info = true;
507+
// } else {
508+
// *info = false;
509+
// }
510+
// }
481511
};
482512

483513
template <class T>

unified-runtime/test/conformance/testing/include/uur/utils.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,31 @@ getDriverVersion(ur_device_handle_t hDevice) {
489489
} \
490490
} while (0)
491491

492+
#define SKIP_IF_BATCHED_QUEUE(queue) \
493+
do { \
494+
ur_queue_flags_t queueFlags{}; \
495+
ASSERT_EQ(urQueueGetInfo(queue, UR_QUEUE_INFO_FLAGS, \
496+
sizeof(ur_queue_flags_t), &queueFlags, nullptr), \
497+
UR_RESULT_SUCCESS); \
498+
\
499+
if (queueFlags & UR_QUEUE_FLAG_SUBMISSION_BATCHED) { \
500+
UUR_KNOWN_FAILURE_ON(uur::LevelZeroV2{}); \
501+
} else { \
502+
} \
503+
} while (0)
504+
505+
inline void isQueueBatched(ur_queue_handle_t queue, bool *info) {
506+
ur_queue_flags_t queueFlags{};
507+
ASSERT_EQ(urQueueGetInfo(queue, UR_QUEUE_INFO_FLAGS, sizeof(ur_queue_flags_t),
508+
&queueFlags, nullptr),
509+
UR_RESULT_SUCCESS);
510+
if (queueFlags & UR_QUEUE_FLAG_SUBMISSION_BATCHED) {
511+
*info = true;
512+
} else {
513+
*info = false;
514+
}
515+
}
516+
492517
// Is this a Data Center GPU Max series (aka PVC)?
493518
// TODO: change to use
494519
// https://spec.oneapi.io/level-zero/latest/core/api.html#ze-device-ip-version-ext-t

0 commit comments

Comments
 (0)