@@ -783,65 +783,4 @@ struct FastpathWithFallbackIntegrationTests : public FastpathTestBase,
783783 }
784784};
785785
786- // Tests the real execution path from Fastpath -> Fallback.
787- // Still mocks the Hip & Sys boundaries.
788- TEST_P (FastpathWithFallbackIntegrationTests, FallbackRetriesFailedIo)
789- {
790- StrictMock<MHip> mhip;
791- StrictMock<MSys> msys;
792-
793- auto fallback_backend = std::make_shared<Fallback>();
794- auto fastpath_backend = std::make_shared<Fastpath>();
795- fastpath_backend->register_fallback_backend (fallback_backend);
796-
797- const int DEFAULT_BUFFERED_FD = DEFAULT_UNBUFFERED_FD.value () + 1 ;
798-
799- EXPECT_CALL (mcfg, fastpath ()).WillOnce (Return (true ));
800- EXPECT_CALL (mcfg, fallback ()).Times (2 ).WillRepeatedly (Return (true ));
801- EXPECT_CALL (mhip, hipInit).WillOnce (Return ());
802-
803- // Called by both Fastpath and Fallback
804- EXPECT_CALL (*mbuffer, getBuffer).WillRepeatedly (Return (DEFAULT_BUFFER_ADDR));
805- EXPECT_CALL (*mbuffer, getLength).Times (2 ).WillRepeatedly (Return (DEFAULT_BUFFER_LENGTH));
806- // Called only by Fastpath
807- EXPECT_CALL (*mfile, getUnbufferedFd).WillOnce (Return (DEFAULT_UNBUFFERED_FD));
808- // Called only by Fallback
809- EXPECT_CALL (*mbuffer, getType).WillOnce (Return (hipMemoryTypeDevice));
810- EXPECT_CALL (*mfile, getBufferedFd).WillRepeatedly (Return (DEFAULT_BUFFERED_FD));
811- EXPECT_CALL (mhip, hipMemcpy).WillRepeatedly (Return ());
812- EXPECT_CALL (msys, mmap).WillOnce (Return (reinterpret_cast <void *>(0x12345678 )));
813- EXPECT_CALL (msys, munmap).WillOnce (Return ());
814- switch (_get_param_io_type ()) {
815- case IoType::Read:
816- // Called by Fastpath
817- EXPECT_CALL (mhip, hipAmdFileRead).WillOnce (Rethrow (_get_param_exc_ptr ()));
818- // Called by Fallback
819- EXPECT_CALL (msys, pread).WillRepeatedly (ReturnArg<2 >());
820- break ;
821- case IoType::Write:
822- // Called by Fastpath
823- EXPECT_CALL (mhip, hipAmdFileWrite).WillOnce (Rethrow (_get_param_exc_ptr ()));
824- // Called by Fallback
825- EXPECT_CALL (mhip, hipStreamSynchronize).WillRepeatedly (Return ());
826- EXPECT_CALL (msys, fdatasync).WillRepeatedly (Return ());
827- EXPECT_CALL (msys, pwrite).WillRepeatedly (ReturnArg<2 >());
828- break ;
829- default :
830- FAIL () << " Invalid IoType" ;
831- }
832-
833- ssize_t num_bytes = fastpath_backend->io (_get_param_io_type (), mfile, mbuffer, DEFAULT_IO_SIZE, 0 , 0 );
834- ASSERT_EQ (num_bytes, DEFAULT_IO_SIZE);
835- }
836-
837- // Using std::exception_ptr is more straightforward here than storing a pointer
838- // to a derived std::exception type, which would require careful handling when
839- // setting expectations. Note that Throw() does not accept std::exception_ptr,
840- // but the public (though undocumented) Rethrow() action does support it.
841- INSTANTIATE_TEST_SUITE_P (
842- FastpathTest, FastpathWithFallbackIntegrationTests,
843- Combine (Values(IoType::Read, IoType::Write),
844- Values(std::make_exception_ptr(std::system_error(ENODEV, generic_category())),
845- std::make_exception_ptr(std::system_error(EREMOTEIO, generic_category())))));
846-
847786HIPFILE_WARN_NO_GLOBAL_CTOR_ON
0 commit comments