SWDEV-439004, SWDEV-440021 - Fix GL Interop & Unit_hipP2pLinkTypeAndHopFunc testcases
- hipGLDeviceListNextFrame is not supported yet
- Initialize GL interop before calling interop related APIs
- Skip GL interop tests when display is not connected
- Load librocm_smi64.so from /opt/rocm/lib/
Change-Id: Ie4879c18317aa377a95d6f2d0d5314d4adf38649
[ROCm/hip-tests commit: d7789d328c]
Этот коммит содержится в:
коммит произвёл
Rakesh Roy
родитель
96db0dbd8d
Коммит
2bcd9b782f
@@ -257,20 +257,8 @@
|
||||
"Unit_atomicExch_system_Positive_Host_And_Peer_GPUs - float",
|
||||
"Unit_atomicExch_system_Positive_Host_And_Peer_GPUs - double",
|
||||
"=== SWDEV-439004: Below tests failing randomly in CQE staging ===",
|
||||
"Unit_hipGLGetDevices_Positive_Basic",
|
||||
"Unit_hipGLGetDevices_Positive_Parameters",
|
||||
"Unit_hipGLGetDevices_Negative_Parameters",
|
||||
"Unit_hipGraphicsGLRegisterBuffer_Positive_Basic",
|
||||
"Unit_hipGraphicsGLRegisterBuffer_Positive_Register_Twice",
|
||||
"Unit_hipGraphicsGLRegisterBuffer_Negative_Parameters",
|
||||
"Unit_hipGraphicsGLRegisterImage_Positive_Basic",
|
||||
"Unit_hipGraphicsGLRegisterImage_Positive_Register_Twice",
|
||||
"Unit_hipGraphicsGLRegisterImage_Negative_Parameters",
|
||||
"Unit_hipGraphicsMapResources_Positive_Basic",
|
||||
"Unit_hipGraphicsMapResources_Negative_Parameters",
|
||||
"Unit_hipGraphicsSubResourceGetMappedArray_Positive_Basic",
|
||||
"Unit_hipGraphicsSubResourceGetMappedArray_Negative_Parameters",
|
||||
"Unit_hipGraphicsResourceGetMappedPointer_Positive_Basic",
|
||||
"Unit_hipGraphicsResourceGetMappedPointer_Positive_Parameters",
|
||||
"Unit_hipGraphicsResourceGetMappedPointer_Negative_Parameters",
|
||||
"Unit_hipGraphicsUnmapResources_Negative_Parameters",
|
||||
|
||||
@@ -78,6 +78,20 @@ class GLImageObject {
|
||||
};
|
||||
|
||||
static std::once_flag glut_init_flag;
|
||||
static void GlutError(const char *fmt, va_list ap)
|
||||
{
|
||||
// Print what error occurred
|
||||
fprintf(stderr, "GlutError:");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
// Mark this test as skipped because this error could be
|
||||
// due to system doesn't have display connected, e.g: Jenkins CI machine
|
||||
HipTest::HIP_SKIP_TEST("GLUT Init Failed");
|
||||
|
||||
glutExit();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
class GLUTContextScopeGuard {
|
||||
public:
|
||||
@@ -101,7 +115,7 @@ class GLUTContextScopeGuard {
|
||||
static char proc_name[] = "";
|
||||
static std::array<char*, 2> glut_argv = {proc_name, nullptr};
|
||||
static int glut_argc = 1;
|
||||
|
||||
glutInitErrorFunc(&GlutError);
|
||||
glutInit(&glut_argc, glut_argv.data());
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitWindowSize(512, 512);
|
||||
|
||||
@@ -41,10 +41,16 @@ TEST_CASE("Unit_hipGLGetDevices_Positive_Basic") {
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, device_list));
|
||||
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
if (device_list == hipGLDeviceListNextFrame) {
|
||||
HIP_CHECK_ERROR(hipGLGetDevices(&gl_device_count, gl_devices.data(),
|
||||
device_count, device_list), hipErrorNotSupported);
|
||||
REQUIRE(gl_device_count == 0);
|
||||
REQUIRE(gl_devices.at(0) == -1);
|
||||
} else {
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, device_list));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipGLGetDevices_Positive_Parameters") {
|
||||
@@ -56,18 +62,21 @@ TEST_CASE("Unit_hipGLGetDevices_Positive_Parameters") {
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
SECTION("pHipDeviceCount == nullptr") {
|
||||
HIP_CHECK(hipGLGetDevices(nullptr, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
HIP_CHECK_ERROR(hipGLGetDevices(nullptr, gl_devices.data(),
|
||||
device_count, hipGLDeviceListAll), hipErrorInvalidValue);
|
||||
REQUIRE(gl_devices.at(0) == -1);
|
||||
}
|
||||
|
||||
SECTION("pHipDevices == nullptr") {
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, nullptr, device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
HIP_CHECK_ERROR(hipGLGetDevices(&gl_device_count, nullptr,
|
||||
device_count, hipGLDeviceListAll), hipErrorInvalidValue);
|
||||
REQUIRE(gl_device_count == 0);
|
||||
}
|
||||
|
||||
SECTION("hipDeviceCount == 0") {
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), 0, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
HIP_CHECK_ERROR(hipGLGetDevices(&gl_device_count, gl_devices.data(),
|
||||
0, hipGLDeviceListAll), hipErrorInvalidValue);
|
||||
REQUIRE(gl_device_count == 0);
|
||||
REQUIRE(gl_devices.at(0) == -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,15 @@ constexpr std::array<unsigned int, 3> kFlags{hipGraphicsRegisterFlagsNone,
|
||||
TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Basic") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
const auto flags = GENERATE(from_range(begin(kFlags), end(kFlags)));
|
||||
|
||||
GLBufferObject vbo;
|
||||
@@ -49,6 +58,15 @@ TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Basic") {
|
||||
TEST_CASE("Unit_hipGraphicsGLRegisterBuffer_Positive_Register_Twice") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
hipGraphicsResource *vbo_resource_1, *vbo_resource_2;
|
||||
|
||||
@@ -36,6 +36,15 @@ constexpr std::array<unsigned int, 5> kFlags{
|
||||
TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Basic") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
const auto flags = GENERATE(from_range(begin(kFlags), end(kFlags)));
|
||||
|
||||
GLImageObject tex;
|
||||
@@ -49,6 +58,14 @@ TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Basic") {
|
||||
|
||||
TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Register_Twice") {
|
||||
GLContextScopeGuard gl_context;
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLImageObject tex;
|
||||
|
||||
|
||||
@@ -29,6 +29,15 @@ THE SOFTWARE.
|
||||
TEST_CASE("Unit_hipGraphicsMapResources_Positive_Basic") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
GLImageObject tex;
|
||||
|
||||
@@ -54,6 +63,15 @@ TEST_CASE("Unit_hipGraphicsMapResources_Positive_Basic") {
|
||||
TEST_CASE("Unit_hipGraphicsMapResources_Negative_Parameters") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
hipGraphicsResource* vbo_resource;
|
||||
|
||||
+27
@@ -29,6 +29,15 @@ THE SOFTWARE.
|
||||
TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Basic") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
hipGraphicsResource* vbo_resource;
|
||||
@@ -54,6 +63,15 @@ TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Basic") {
|
||||
TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Parameters") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
hipGraphicsResource* vbo_resource;
|
||||
@@ -84,6 +102,15 @@ TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Positive_Parameters") {
|
||||
TEST_CASE("Unit_hipGraphicsResourceGetMappedPointer_Negative_Parameters") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
hipGraphicsResource* vbo_resource;
|
||||
|
||||
+18
@@ -29,6 +29,15 @@ THE SOFTWARE.
|
||||
TEST_CASE("Unit_hipGraphicsSubResourceGetMappedArray_Positive_Basic") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLImageObject tex;
|
||||
|
||||
hipGraphicsResource* tex_resource;
|
||||
@@ -51,6 +60,15 @@ TEST_CASE("Unit_hipGraphicsSubResourceGetMappedArray_Positive_Basic") {
|
||||
TEST_CASE("Unit_hipGraphicsSubResourceGetMappedArray_Negative_Parameters") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLImageObject tex;
|
||||
|
||||
hipGraphicsResource* tex_resource;
|
||||
|
||||
@@ -29,6 +29,15 @@ THE SOFTWARE.
|
||||
TEST_CASE("Unit_hipGraphicsUnmapResources_Negative_Parameters") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
hipGraphicsResource* vbo_resource;
|
||||
@@ -42,7 +51,7 @@ TEST_CASE("Unit_hipGraphicsUnmapResources_Negative_Parameters") {
|
||||
}
|
||||
|
||||
SECTION("resources == nullptr") {
|
||||
HIP_CHECK_ERROR(hipGraphicsUnmapResources(1, nullptr, 0), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGraphicsUnmapResources(1, nullptr, 0), hipErrorUnknown);
|
||||
}
|
||||
|
||||
SECTION("not mapped resource") {
|
||||
|
||||
@@ -29,6 +29,15 @@ THE SOFTWARE.
|
||||
TEST_CASE("Unit_hipGraphicsUnregisterResource_Negative_Parameters") {
|
||||
GLContextScopeGuard gl_context;
|
||||
|
||||
const int device_count = HipTest::getDeviceCount();
|
||||
unsigned int gl_device_count = 0;
|
||||
std::vector<int> gl_devices(device_count, -1);
|
||||
|
||||
// Initialize GL interop
|
||||
HIP_CHECK(hipGLGetDevices(&gl_device_count, gl_devices.data(), device_count, hipGLDeviceListAll));
|
||||
REQUIRE(gl_device_count == 1);
|
||||
REQUIRE(gl_devices.at(0) == 0);
|
||||
|
||||
GLBufferObject vbo;
|
||||
|
||||
SECTION("already unregistered resource") {
|
||||
|
||||
@@ -215,7 +215,7 @@ bool testhipLinkTypeHopcountDevice(int numDevices) {
|
||||
rsmi_status_t (*fntopo_init)(uint64_t);
|
||||
rsmi_status_t (*fntopo_shut_down)();
|
||||
|
||||
lib_rocm_smi_hdl = dlopen("/opt/rocm/rocm_smi/lib/librocm_smi64.so",
|
||||
lib_rocm_smi_hdl = dlopen("/opt/rocm/lib/librocm_smi64.so",
|
||||
RTLD_LAZY);
|
||||
REQUIRE(lib_rocm_smi_hdl);
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user