Clean up cuDNN compatible version check.

This became simpler, now that the minimum supported version is cuDNN 7.

PiperOrigin-RevId: 319260739
Change-Id: I16548b2fed93491b2cee4099039faaf15987cb99
This commit is contained in:
Christian Sigg 2020-07-01 11:15:50 -07:00 committed by TensorFlower Gardener
parent 82adecb5a5
commit 51e5f4319b
2 changed files with 5 additions and 18 deletions
tensorflow/stream_executor/cuda

View File

@ -23,17 +23,13 @@ bool IsSourceCompatibleWithCudnnLibrary(CudnnVersion source_version,
// Major version is neither forward or backward compatible and therefore major
// versions needs to match between source and library.
//
// Minor version is backward-compatible beginning with CuDNN 7 and therefore
// minor version of library needs to be same or higher.
// Minor version is backward-compatible and therefore minor version of library
// needs to be same or higher.
//
// Patch releases are always forward and backward compatible and therefore
// need not match.
if (loaded_version.major_version != source_version.major_version) {
return false;
}
return ((loaded_version.minor_version == source_version.minor_version) ||
(source_version.major_version >= 7 &&
loaded_version.minor_version >= source_version.minor_version));
return loaded_version.major_version == source_version.major_version &&
loaded_version.minor_version >= source_version.minor_version;
}
} // namespace gpu

View File

@ -46,7 +46,7 @@ TEST(IsSourceCompatibleWithCudnnLibraryTest, Basic) {
/*loaded_version=*/CudnnVersion(7, 0, 14)));
// Returns true if the loaded version is equal or higher because minor version
// are backward compatible with CuDNN version 7.
// are backward compatible.
EXPECT_TRUE(IsSourceCompatibleWithCudnnLibrary(
/*source_version=*/CudnnVersion(7, 0, 14),
/*loaded_version=*/CudnnVersion(7, 1, 14)));
@ -56,15 +56,6 @@ TEST(IsSourceCompatibleWithCudnnLibraryTest, Basic) {
EXPECT_FALSE(IsSourceCompatibleWithCudnnLibrary(
/*source_version=*/CudnnVersion(7, 1, 15),
/*loaded_version=*/CudnnVersion(7, 0, 14)));
// Returns false if minor versions are not matching for version 6. Before
// version 7, minor versions are also neither forward or backward compatible.
EXPECT_FALSE(IsSourceCompatibleWithCudnnLibrary(
/*source_version=*/CudnnVersion(6, 0, 14),
/*loaded_version=*/CudnnVersion(6, 1, 15)));
EXPECT_FALSE(IsSourceCompatibleWithCudnnLibrary(
/*source_version=*/CudnnVersion(6, 1, 14),
/*loaded_version=*/CudnnVersion(6, 0, 14)));
}
} // namespace