Files
TheRock/rocm-libraries/projects/hipdnn/tests/test_plugins/TestPluginConstants.hpp
T
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

206 lines
6.7 KiB
C++

// Copyright © Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
#pragma once
#include "TestPluginEngineIdMap.hpp"
#include <filesystem>
#include <hipdnn_data_sdk/utilities/PlatformUtils.hpp>
#include <stdexcept>
#include <string>
namespace hipdnn_tests::plugin_constants
{
// Test plugin directory constants relative to backend library location
inline const std::string& getTestPluginDefaultDir()
{
static const std::string s_defaultDir
= (std::filesystem::path(".") / "test_plugins" / "default").string();
return s_defaultDir;
}
inline const std::string& getTestPluginCustomDir()
{
static const std::string s_customDir
= (std::filesystem::path(".") / "test_plugins" / "custom").string();
return s_customDir;
}
// Compose full plugin path with existence checking
inline std::string getTestCustomFilepathForPlugin(const char* pluginName)
{
namespace fs = std::filesystem;
const fs::path pluginFile = fs::path(getTestPluginCustomDir())
/ hipdnn_data_sdk::utilities::getLibraryName(pluginName);
return pluginFile.string();
}
inline std::string testDefaultGoodPluginPath()
{
namespace fs = std::filesystem;
return (fs::path(getTestPluginDefaultDir())
/ hipdnn_data_sdk::utilities::getLibraryName(TEST_GOOD_DEFAULT_PLUGIN_NAME))
.string();
}
inline const std::string& testGoodPluginPath()
{
static const std::string s_testGoodPluginPath
= getTestCustomFilepathForPlugin(TEST_GOOD_PLUGIN_NAME);
return s_testGoodPluginPath;
}
inline const std::string& testExecuteFailsPluginPath()
{
static const std::string s_testExecuteFailsPluginPath
= getTestCustomFilepathForPlugin(TEST_EXECUTE_FAILS_PLUGIN_NAME);
return s_testExecuteFailsPluginPath;
}
inline const std::string& testNoApplicableEnginesAPluginPath()
{
static const std::string s_testNoApplicableEnginesPluginPath
= getTestCustomFilepathForPlugin(TEST_NO_APPLICABLE_ENGINES_A_PLUGIN_NAME);
return s_testNoApplicableEnginesPluginPath;
}
inline const std::string& testNoApplicableEnginesBPluginPath()
{
static const std::string s_testNoApplicableEnginesPluginPath
= getTestCustomFilepathForPlugin(TEST_NO_APPLICABLE_ENGINES_B_PLUGIN_NAME);
return s_testNoApplicableEnginesPluginPath;
}
inline const std::string& testDuplicateIdAPluginPath()
{
static const std::string s_testDuplicateIdAPluginPath
= getTestCustomFilepathForPlugin(TEST_DUPLICATE_ID_A_PLUGIN_NAME);
return s_testDuplicateIdAPluginPath;
}
inline const std::string& testDuplicateIdBPluginPath()
{
static const std::string s_testDuplicateIdBPluginPath
= getTestCustomFilepathForPlugin(TEST_DUPLICATE_ID_B_PLUGIN_NAME);
return s_testDuplicateIdBPluginPath;
}
inline const std::string& testIncompleteApiPluginPath()
{
static const std::string s_testIncompleteApiPluginPath
= getTestCustomFilepathForPlugin(TEST_INCOMPLETE_API_PLUGIN_NAME);
return s_testIncompleteApiPluginPath;
}
inline const std::string& testKnobsPluginPath()
{
static const std::string s_testKnobsPluginPath
= getTestCustomFilepathForPlugin(TEST_KNOBS_PLUGIN_NAME);
return s_testKnobsPluginPath;
}
inline const std::string& testKnobConstraintValidationPluginPath()
{
static const std::string s_testKnobConstraintValidationPluginPath
= getTestCustomFilepathForPlugin(TEST_KNOB_CONSTRAINT_VALIDATION_PLUGIN_NAME);
return s_testKnobConstraintValidationPluginPath;
}
inline const std::string& testIncompatibleVersionPluginPath()
{
static const std::string s_testIncompatibleVersionPluginPath
= getTestCustomFilepathForPlugin(TEST_INCOMPATIBLE_VERSION_PLUGIN_NAME);
return s_testIncompatibleVersionPluginPath;
}
// Override-execute fake-plugin paths.
inline const std::string& testOverrideImplementingPluginPath()
{
static const std::string s_path
= getTestCustomFilepathForPlugin(TEST_OVERRIDE_IMPLEMENTING_PLUGIN_NAME);
return s_path;
}
// Runtime pass-by-value fake reports K_PASS_BY_VALUE_MIN_API_VERSION ("1.2.0").
inline const std::string& testPassByValuePluginPath()
{
static const std::string s_path
= getTestCustomFilepathForPlugin(TEST_PASS_BY_VALUE_PLUGIN_NAME);
return s_path;
}
// Runtime pass-by-value RECORDER fake reports "1.2.0" and records the host scalar
// it resolves from device_buffers at execute, for delivery verification.
#ifdef TEST_PASS_BY_VALUE_RECORDER_PLUGIN_NAME
inline const std::string& testPassByValueRecorderPluginPath()
{
static const std::string s_path
= getTestCustomFilepathForPlugin(TEST_PASS_BY_VALUE_RECORDER_PLUGIN_NAME);
return s_path;
}
#endif
inline const std::string& testOverrideOmittingPluginPath()
{
static const std::string s_path
= getTestCustomFilepathForPlugin(TEST_OVERRIDE_OMITTING_PLUGIN_NAME);
return s_path;
}
inline const std::string& testVersionLiarPluginPath()
{
static const std::string s_path = getTestCustomFilepathForPlugin(TEST_VERSION_LIAR_PLUGIN_NAME);
return s_path;
}
inline const std::string& testSecondOverridePluginPath()
{
static const std::string s_path
= getTestCustomFilepathForPlugin(TEST_SECOND_OVERRIDE_PLUGIN_NAME);
return s_path;
}
inline const std::string& testMalformedVersionPluginPath()
{
static const std::string s_path
= getTestCustomFilepathForPlugin(TEST_MALFORMED_VERSION_PLUGIN_NAME);
return s_path;
}
inline const std::string& testVersionZeroPluginPath()
{
static const std::string s_path = getTestCustomFilepathForPlugin(TEST_VERSION_ZERO_PLUGIN_NAME);
return s_path;
}
// Heuristic test plugins. Policy name registered by test_good_heuristic_plugin --
// callers that need a specific policy should set HIPDNN_HEUR_POLICY_ORDER to
// this value via a scoped env guard.
inline const char* testGoodHeuristicPolicyName()
{
return "TestGoodHeuristicPolicy";
}
inline const std::string& testGoodHeuristicPluginPath()
{
static const std::string s_testGoodHeuristicPluginPath
= getTestCustomFilepathForPlugin(TEST_GOOD_HEURISTIC_PLUGIN_NAME);
return s_testGoodHeuristicPluginPath;
}
// The autotune plugin is consumed only by the frontend autotune integration
// tests. Only targets that define TEST_AUTOTUNE_PLUGIN_NAME (the frontend test
// target) get this accessor; the backend test target deliberately carries no
// autotune-plugin wiring, so the macro is absent there and this is compiled out.
#ifdef TEST_AUTOTUNE_PLUGIN_NAME
inline const std::string& testAutotunePluginPath()
{
static const std::string s_testAutotunePluginPath
= getTestCustomFilepathForPlugin(TEST_AUTOTUNE_PLUGIN_NAME);
return s_testAutotunePluginPath;
}
#endif
} // namespace hipdnn_tests::plugin_constants