Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

94 lines
2.7 KiB
C++

// Copyright © Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
#include "hipdnn_plugin_sdk/PluginApi.h"
#include "version.h"
#include <HipblasltPlugin.hpp>
#include <array>
#include <gtest/gtest.h>
#include <hipdnn_data_sdk/logging/LogLevel.hpp>
#include <iostream>
namespace
{
void testLoggingCallback(hipdnnSeverity_t severity, const char* msg)
{
(void)severity;
// std::cout << msg << "\n"; // uncomment to see formatted log messages during tests.
// It does not use the true callback yet since the plugin is not yet loaded.
(void)msg;
}
class TestHipblasltPluginApi : public ::testing::Test
{
protected:
void SetUp() override
{
ASSERT_EQ(hipdnnPluginSetLoggingCallbackImpl(testLoggingCallback),
HIPDNN_PLUGIN_STATUS_SUCCESS);
}
};
} // namespace
TEST_F(TestHipblasltPluginApi, GetNameSuccess)
{
const char* name = nullptr;
EXPECT_EQ(hipdnnPluginGetNameImpl(&name), HIPDNN_PLUGIN_STATUS_SUCCESS);
EXPECT_STREQ(name, "hipblaslt_plugin");
}
TEST_F(TestHipblasltPluginApi, GetNameNullptr)
{
EXPECT_EQ(hipdnnPluginGetNameImpl(nullptr), HIPDNN_PLUGIN_STATUS_BAD_PARAM);
}
TEST_F(TestHipblasltPluginApi, GetVersionSuccess)
{
const char* version = nullptr;
EXPECT_EQ(hipdnnPluginGetVersionImpl(&version), HIPDNN_PLUGIN_STATUS_SUCCESS);
EXPECT_STREQ(version, HIPBLASLT_PROVIDER_VERSION_STRING);
}
TEST_F(TestHipblasltPluginApi, GetVersionNullptr)
{
EXPECT_EQ(hipdnnPluginGetVersionImpl(nullptr), HIPDNN_PLUGIN_STATUS_BAD_PARAM);
}
TEST_F(TestHipblasltPluginApi, GetTypeSuccess)
{
hipdnnPluginType_t type;
EXPECT_EQ(hipdnnPluginGetTypeImpl(&type), HIPDNN_PLUGIN_STATUS_SUCCESS);
EXPECT_EQ(type, HIPDNN_PLUGIN_TYPE_ENGINE);
}
TEST_F(TestHipblasltPluginApi, GetTypeNullptr)
{
EXPECT_EQ(hipdnnPluginGetTypeImpl(nullptr), HIPDNN_PLUGIN_STATUS_BAD_PARAM);
}
TEST_F(TestHipblasltPluginApi, GetLastErrorStringSuccess)
{
const char* errorStr = nullptr;
hipdnnPluginGetLastErrorStringImpl(&errorStr);
ASSERT_NE(errorStr, nullptr);
EXPECT_GE(strlen(errorStr), 0u);
}
TEST_F(TestHipblasltPluginApi, GetLastErrorStringNullptr)
{
EXPECT_NO_THROW(hipdnnPluginGetLastErrorStringImpl(nullptr));
}
TEST_F(TestHipblasltPluginApi, SetLogLevelSuccess)
{
EXPECT_EQ(hipdnnPluginSetLogLevelImpl(HIPDNN_SEV_INFO), HIPDNN_PLUGIN_STATUS_SUCCESS);
EXPECT_TRUE(hipdnn_data_sdk::logging::isLogLevelEnabled(HIPDNN_SEV_INFO));
}
TEST_F(TestHipblasltPluginApi, SetLogLevelFiltersLowerSeverity)
{
ASSERT_EQ(hipdnnPluginSetLogLevelImpl(HIPDNN_SEV_WARN), HIPDNN_PLUGIN_STATUS_SUCCESS);
EXPECT_TRUE(hipdnn_data_sdk::logging::isLogLevelEnabled(HIPDNN_SEV_WARN));
EXPECT_FALSE(hipdnn_data_sdk::logging::isLogLevelEnabled(HIPDNN_SEV_INFO));
}