[Bugfix] Fix WSL circular import from pin_memory warning_once (#48444)

Signed-off-by: AlejandroParedesLT <alejandroparedeslatorre@gmail.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
Alejandro Paredes La Torre
2026-07-20 18:30:55 -07:00
committed by GitHub
co-authored by Shengqi Chen
parent 0d9210a502
commit 0a684ab0c0
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -290,7 +290,8 @@ class CudaPlatformBase(Platform):
# kernel with limited pinned memory support for CUDA.
version = _get_wsl_kernel_version()
if version is None or version < (4, 19, 121):
logger.warning_once(
# warning_once() causes a circular import on WSL, see #48397.
logger.warning(
"Using 'pin_memory=False' as WSL is detected and the "
"WSL2 kernel version is below 4.19.121. This may slow "
"down performance. Please run `wsl --update`."
+2 -1
View File
@@ -991,7 +991,8 @@ class Platform:
# Pinned memory support under WSL depends on the vendor and driver
# version. Conservative default: return False. Platform subclasses
# that can verify support (e.g. CudaPlatformBase) override this.
logger.warning_once(
# warning_once() causes a circular import on WSL, see #48397.
logger.warning(
"Using 'pin_memory=False' as WSL is detected. "
"This may slow down performance."
)