SWDEV-519340 - Enable and fix hipModuleLoad test (#607)

Этот коммит содержится в:
systems-assistant[bot]
2025-11-12 09:28:49 +01:00
коммит произвёл GitHub
родитель 3ad7c20961
Коммит f99baf5481
15 изменённых файлов: 66 добавлений и 41 удалений
+10 -14
Просмотреть файл
@@ -24,23 +24,19 @@ THE SOFTWARE.
#include <hip_test_common.hh>
#include <hip/hip_runtime_api.h>
static hipModule_t GetModule() {
HIP_CHECK(hipFree(nullptr));
static const auto mg = ModuleGuard::LoadModule("get_function_module.code");
return mg.module();
}
TEST_CASE("Unit_hipModuleGetFunction_Positive_Basic") {
auto mg = ModuleGuard::InitModule("get_function_module.code");
hipFunction_t kernel = nullptr;
HIP_CHECK(hipModuleGetFunction(&kernel, GetModule(), "GlobalKernel"));
HIP_CHECK(hipModuleGetFunction(&kernel, mg.module(), "GlobalKernel"));
REQUIRE(kernel != nullptr);
}
TEST_CASE("Unit_hipModuleGetFunction_Negative_Parameters") {
auto mg = ModuleGuard::InitModule("get_function_module.code");
hipFunction_t kernel = nullptr;
SECTION("function == nullptr") {
HIP_CHECK_ERROR(hipModuleGetFunction(nullptr, GetModule(), "GlobalKernel"),
HIP_CHECK_ERROR(hipModuleGetFunction(nullptr, mg.module(), "GlobalKernel"),
hipErrorInvalidValue);
}
@@ -53,23 +49,23 @@ TEST_CASE("Unit_hipModuleGetFunction_Negative_Parameters") {
#endif
SECTION("kname == nullptr") {
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, GetModule(), nullptr), hipErrorInvalidValue);
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, mg.module(), nullptr), hipErrorInvalidValue);
}
// Disabled on AMD due to defect - EXSWHTEC-155
#if HT_NVIDIA
SECTION("kname == empty string") {
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, GetModule(), ""), hipErrorInvalidValue);
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, mg.module(), ""), hipErrorInvalidValue);
}
#endif
SECTION("kname == non existent kernel") {
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, GetModule(), "NonExistentKernel"),
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, mg.module(), "NonExistentKernel"),
hipErrorNotFound);
}
SECTION("kname == __device__ kernel") {
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, GetModule(), "DeviceKernel"), hipErrorNotFound);
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, mg.module(), "DeviceKernel"), hipErrorNotFound);
}
}
@@ -83,9 +79,9 @@ TEST_CASE("Unit_hipModuleGetFunction_DiffDevice") {
return;
}
auto mg = ModuleGuard::InitModule("get_function_module.code");
hipFunction_t kernel = nullptr;
auto module = GetModule();
HIP_CHECK(hipSetDevice(1));
HIP_CHECK(hipModuleGetFunction(&kernel, module, "GlobalKernel"));
HIP_CHECK(hipModuleGetFunction(&kernel, mg.module(), "GlobalKernel"));
REQUIRE(kernel != nullptr);
}