[llvm] [offload] add KNOWN_FAILURE_ON unittest macro (PR #196275)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 03:45:58 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Piotr Balcer (pbalcer)
<details>
<summary>Changes</summary>
... and disable failing level-zero tests, to be reenabled once the plugin is fully functional.
Here is the passrate for the level-zero plugin unit tests:
```
Total Discovered Tests: 645
Skipped: 74 (11.47%)
Passed : 571 (88.53%)
```
We are actively working on fixing the issues marked as known failures here.
---
Full diff: https://github.com/llvm/llvm-project/pull/196275.diff
8 Files Affected:
- (modified) offload/unittests/OffloadAPI/common/Fixtures.hpp (+11)
- (modified) offload/unittests/OffloadAPI/event/olGetEventElapsedTime.cpp (+1)
- (modified) offload/unittests/OffloadAPI/kernel/olCalculateOptimalOccupancy.cpp (+6-1)
- (modified) offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp (+10)
- (modified) offload/unittests/OffloadAPI/memory/olMemFill.cpp (+5)
- (modified) offload/unittests/OffloadAPI/queue/olDestroyQueue.cpp (+2)
- (modified) offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp (+12-2)
- (modified) offload/unittests/OffloadAPI/symbol/olGetSymbolInfo.cpp (+2)
``````````diff
diff --git a/offload/unittests/OffloadAPI/common/Fixtures.hpp b/offload/unittests/OffloadAPI/common/Fixtures.hpp
index 6f9961e2c6d58..142ba330fd37e 100644
--- a/offload/unittests/OffloadAPI/common/Fixtures.hpp
+++ b/offload/unittests/OffloadAPI/common/Fixtures.hpp
@@ -61,6 +61,17 @@
} while (0)
#endif
+#define KNOWN_FAILURE_ON(...) \
+ do { \
+ ol_platform_backend_t CurBackend = this->getPlatformBackend(); \
+ for (ol_platform_backend_t B : \
+ std::initializer_list<ol_platform_backend_t>{__VA_ARGS__}) { \
+ if (CurBackend == B) { \
+ GTEST_SKIP() << "Skipping known failure." \
+ } \
+ } \
+ } while (0)
+
#define RETURN_ON_FATAL_FAILURE(...) \
__VA_ARGS__; \
if (this->HasFatalFailure() || this->IsSkipped()) { \
diff --git a/offload/unittests/OffloadAPI/event/olGetEventElapsedTime.cpp b/offload/unittests/OffloadAPI/event/olGetEventElapsedTime.cpp
index aca2dccff72fe..0263adb6197ea 100644
--- a/offload/unittests/OffloadAPI/event/olGetEventElapsedTime.cpp
+++ b/offload/unittests/OffloadAPI/event/olGetEventElapsedTime.cpp
@@ -16,6 +16,7 @@ namespace {
struct olGetEventElapsedTimeTest : OffloadQueueTest {
void SetUp() override {
RETURN_ON_FATAL_FAILURE(OffloadQueueTest::SetUp());
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
ASSERT_TRUE(TestEnvironment::loadDeviceBinary("foo", Device, DeviceBin));
ASSERT_SUCCESS(olCreateProgram(Device, DeviceBin->getBufferStart(),
diff --git a/offload/unittests/OffloadAPI/kernel/olCalculateOptimalOccupancy.cpp b/offload/unittests/OffloadAPI/kernel/olCalculateOptimalOccupancy.cpp
index 17fa383cac3f4..d5a7b87c67096 100644
--- a/offload/unittests/OffloadAPI/kernel/olCalculateOptimalOccupancy.cpp
+++ b/offload/unittests/OffloadAPI/kernel/olCalculateOptimalOccupancy.cpp
@@ -10,7 +10,12 @@
#include <OffloadAPI.h>
#include <gtest/gtest.h>
-using olCalculateOptimalOccupancyTest = OffloadKernelTest;
+struct olCalculateOptimalOccupancyTest : OffloadKernelTest {
+ void SetUp() override {
+ RETURN_ON_FATAL_FAILURE(OffloadKernelTest::SetUp());
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+ }
+};
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olCalculateOptimalOccupancyTest);
TEST_P(olCalculateOptimalOccupancyTest, Success) {
diff --git a/offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp b/offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp
index 166b8dabff0d8..b279d1c683f47 100644
--- a/offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp
+++ b/offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp
@@ -107,6 +107,8 @@ TEST_P(olLaunchKernelFooTest, Success) {
}
TEST_P(olLaunchKernelFooTest, SuccessThreaded) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
threadify([&](size_t) {
void *Mem;
ASSERT_SUCCESS(olMemAlloc(Device, OL_ALLOC_TYPE_MANAGED,
@@ -170,6 +172,8 @@ TEST_P(olLaunchKernelFooTest, SuccessSynchronous) {
}
TEST_P(olLaunchKernelLocalMemTest, Success) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
LaunchArgs.NumGroups.x = 4;
LaunchArgs.DynSharedMemory = 64 * sizeof(uint32_t);
@@ -195,6 +199,8 @@ TEST_P(olLaunchKernelLocalMemTest, Success) {
}
TEST_P(olLaunchKernelLocalMemReductionTest, Success) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
LaunchArgs.NumGroups.x = 4;
LaunchArgs.DynSharedMemory = 64 * sizeof(uint32_t);
@@ -218,6 +224,8 @@ TEST_P(olLaunchKernelLocalMemReductionTest, Success) {
}
TEST_P(olLaunchKernelLocalMemStaticTest, Success) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
LaunchArgs.NumGroups.x = 4;
LaunchArgs.DynSharedMemory = 0;
@@ -272,6 +280,8 @@ TEST_P(olLaunchKernelGlobalTest, InvalidNotAKernel) {
}
TEST_P(olLaunchKernelGlobalCtorTest, Success) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
void *Mem;
ASSERT_SUCCESS(olMemAlloc(Device, OL_ALLOC_TYPE_MANAGED,
LaunchArgs.GroupSize.x * sizeof(uint32_t), &Mem));
diff --git a/offload/unittests/OffloadAPI/memory/olMemFill.cpp b/offload/unittests/OffloadAPI/memory/olMemFill.cpp
index a84ed3d78eccf..c7c0e5b8f2846 100644
--- a/offload/unittests/OffloadAPI/memory/olMemFill.cpp
+++ b/offload/unittests/OffloadAPI/memory/olMemFill.cpp
@@ -11,6 +11,11 @@
#include <gtest/gtest.h>
struct olMemFillTest : OffloadQueueTest {
+ void SetUp() override {
+ RETURN_ON_FATAL_FAILURE(OffloadQueueTest::SetUp());
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+ }
+
template <typename PatternTy, PatternTy PatternVal, size_t Size,
bool Block = false>
void test_body() {
diff --git a/offload/unittests/OffloadAPI/queue/olDestroyQueue.cpp b/offload/unittests/OffloadAPI/queue/olDestroyQueue.cpp
index aa9e372ede2c8..5ea106c726436 100644
--- a/offload/unittests/OffloadAPI/queue/olDestroyQueue.cpp
+++ b/offload/unittests/OffloadAPI/queue/olDestroyQueue.cpp
@@ -19,6 +19,8 @@ TEST_P(olDestroyQueueTest, Success) {
}
TEST_P(olDestroyQueueTest, SuccessDelayedResolution) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
ManuallyTriggeredTask Manual;
ASSERT_SUCCESS(Manual.enqueue(Queue));
ASSERT_SUCCESS(olDestroyQueue(Queue));
diff --git a/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp b/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
index aa86750f6adf9..910d34a6c33b1 100644
--- a/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
+++ b/offload/unittests/OffloadAPI/queue/olLaunchHostFunction.cpp
@@ -11,10 +11,20 @@
#include <gtest/gtest.h>
#include <thread>
-struct olLaunchHostFunctionTest : OffloadQueueTest {};
+struct olLaunchHostFunctionTest : OffloadQueueTest {
+ void SetUp() override {
+ RETURN_ON_FATAL_FAILURE(OffloadQueueTest::SetUp());
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+ }
+};
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olLaunchHostFunctionTest);
-struct olLaunchHostFunctionKernelTest : OffloadKernelTest {};
+struct olLaunchHostFunctionKernelTest : OffloadKernelTest {
+ void SetUp() override {
+ RETURN_ON_FATAL_FAILURE(OffloadKernelTest::SetUp());
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+ }
+};
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olLaunchHostFunctionKernelTest);
TEST_P(olLaunchHostFunctionTest, Success) {
diff --git a/offload/unittests/OffloadAPI/symbol/olGetSymbolInfo.cpp b/offload/unittests/OffloadAPI/symbol/olGetSymbolInfo.cpp
index ed8f4716974cd..a633d6e394056 100644
--- a/offload/unittests/OffloadAPI/symbol/olGetSymbolInfo.cpp
+++ b/offload/unittests/OffloadAPI/symbol/olGetSymbolInfo.cpp
@@ -52,6 +52,8 @@ TEST_P(olGetSymbolInfoKernelTest, InvalidSize) {
}
TEST_P(olGetSymbolInfoGlobalTest, SuccessSize) {
+ KNOWN_FAILURE_ON(OL_PLATFORM_BACKEND_LEVEL_ZERO);
+
size_t RetrievedSize = 0;
ASSERT_SUCCESS(olGetSymbolInfo(Global, OL_SYMBOL_INFO_GLOBAL_VARIABLE_SIZE,
sizeof(RetrievedSize), &RetrievedSize));
``````````
</details>
https://github.com/llvm/llvm-project/pull/196275
More information about the llvm-commits
mailing list