SWDEV-504084 - Added multidevice testcases for hipModuleGetFunction/Global
Change-Id: I53d6d63f93c800efa2ec0ff2be5ae593756549e0
[ROCm/hip-tests commit: cddb658314]
This commit is contained in:
committed by
Rakesh Roy
parent
4947316122
commit
2be5ef4dfb
@@ -71,4 +71,21 @@ TEST_CASE("Unit_hipModuleGetFunction_Negative_Parameters") {
|
||||
SECTION("kname == __device__ kernel") {
|
||||
HIP_CHECK_ERROR(hipModuleGetFunction(&kernel, GetModule(), "DeviceKernel"), hipErrorNotFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test description: Loading kernel function from different device than the one on which the module
|
||||
// is loaded
|
||||
TEST_CASE("Unit_hipModuleGetFunction_DiffDevice") {
|
||||
int numDevices = 0;
|
||||
HIP_CHECK(hipGetDeviceCount(&numDevices));
|
||||
if (numDevices < 2) {
|
||||
SUCCEED("skipped the testcase as no of devices is less than 2");
|
||||
return;
|
||||
}
|
||||
|
||||
hipFunction_t kernel = nullptr;
|
||||
auto module = GetModule();
|
||||
HIP_CHECK(hipSetDevice(1));
|
||||
HIP_CHECK(hipModuleGetFunction(&kernel, module, "GlobalKernel"));
|
||||
REQUIRE(kernel != nullptr);
|
||||
}
|
||||
|
||||
@@ -142,4 +142,22 @@ TEST_CASE("Unit_hipModuleGetGlobal_Negative_Name_Is_Empty_String") {
|
||||
TEST_CASE("Unit_hipModuleGetGlobal_Negative_Dptr_And_Bytes_Are_Nullptr") {
|
||||
hipModule_t module = GetModule();
|
||||
HIP_CHECK_ERROR(hipModuleGetGlobal(nullptr, nullptr, module, "int_var"), hipErrorInvalidValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Test description: Loading device ptr from different device than the one on which the module
|
||||
// is loaded
|
||||
TEST_CASE("Unit_hipModuleGetGlobal_DiffDevice") {
|
||||
int numDevices = 0;
|
||||
HIP_CHECK(hipGetDeviceCount(&numDevices));
|
||||
if (numDevices < 2) {
|
||||
SUCCEED("skipped the testcase as no of devices is less than 2");
|
||||
return;
|
||||
}
|
||||
auto module = GetModule();
|
||||
HIP_CHECK(hipSetDevice(1));
|
||||
hipDeviceptr_t global;
|
||||
size_t global_size = 0;
|
||||
HIP_CHECK(hipModuleGetGlobal(&global, &global_size, module, "int_var"));
|
||||
REQUIRE(global != 0);
|
||||
REQUIRE(sizeof(int) == global_size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user