diff --git a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux index 2c0bdf05ad..b0243dd2a7 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux @@ -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", diff --git a/projects/hip-tests/catch/unit/gl_interop/gl_interop_common.hh b/projects/hip-tests/catch/unit/gl_interop/gl_interop_common.hh index 9cb31a848e..969bbcbb1f 100644 --- a/projects/hip-tests/catch/unit/gl_interop/gl_interop_common.hh +++ b/projects/hip-tests/catch/unit/gl_interop/gl_interop_common.hh @@ -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 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); diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGLGetDevices.cc b/projects/hip-tests/catch/unit/gl_interop/hipGLGetDevices.cc index e9ab9c8854..83387b8562 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGLGetDevices.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGLGetDevices.cc @@ -41,10 +41,16 @@ TEST_CASE("Unit_hipGLGetDevices_Positive_Basic") { unsigned int gl_device_count = 0; std::vector 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 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); } } diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterBuffer.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterBuffer.cc index 0022a88cff..531ca1152b 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterBuffer.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterBuffer.cc @@ -35,6 +35,15 @@ constexpr std::array 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 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 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; diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterImage.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterImage.cc index 0f0546d71b..f2c62ca25a 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterImage.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsGLRegisterImage.cc @@ -36,6 +36,15 @@ constexpr std::array kFlags{ TEST_CASE("Unit_hipGraphicsGLRegisterImage_Positive_Basic") { GLContextScopeGuard gl_context; + const int device_count = HipTest::getDeviceCount(); + unsigned int gl_device_count = 0; + std::vector 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 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; diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsMapResources.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsMapResources.cc index 26babfaf1c..285f35cff4 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsMapResources.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsMapResources.cc @@ -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 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 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; diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc index 8bdd5c16c8..8061d4bf41 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsResourceGetMappedPointer.cc @@ -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 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 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 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; diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsSubResourceGetMappedArray.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsSubResourceGetMappedArray.cc index 1a48e782b2..ef2fd0808f 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsSubResourceGetMappedArray.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsSubResourceGetMappedArray.cc @@ -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 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 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; diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnmapResources.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnmapResources.cc index 529e8d597f..48d3add85c 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnmapResources.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnmapResources.cc @@ -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 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") { diff --git a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc index 10fc1f92b3..7a74042a91 100644 --- a/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc +++ b/projects/hip-tests/catch/unit/gl_interop/hipGraphicsUnregisterResource.cc @@ -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 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") { diff --git a/projects/hip-tests/catch/unit/p2p/hipP2pLinkTypeAndHopFunc.cc b/projects/hip-tests/catch/unit/p2p/hipP2pLinkTypeAndHopFunc.cc index fcd114634f..9cc2d7c080 100644 --- a/projects/hip-tests/catch/unit/p2p/hipP2pLinkTypeAndHopFunc.cc +++ b/projects/hip-tests/catch/unit/p2p/hipP2pLinkTypeAndHopFunc.cc @@ -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);