From f8f41145dac9e5f20cff16942eba9f3c5e5ee899 Mon Sep 17 00:00:00 2001 From: Chenggang Zhao Date: Sat, 11 Oct 2025 09:14:00 +0800 Subject: [PATCH] Use CUDA runtime API to get device prop instead of ATen --- csrc/jit/device_runtime.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/csrc/jit/device_runtime.hpp b/csrc/jit/device_runtime.hpp index 6ffd26f..dc207c4 100644 --- a/csrc/jit/device_runtime.hpp +++ b/csrc/jit/device_runtime.hpp @@ -36,8 +36,13 @@ public: } std::shared_ptr get_prop() { - if (cached_prop == nullptr) - cached_prop = std::make_shared(*at::cuda::getCurrentDeviceProperties()); + if (cached_prop == nullptr) { + int device_idx; + cudaDeviceProp prop; + DG_CUDA_RUNTIME_CHECK(cudaGetDevice(&device_idx)); + DG_CUDA_RUNTIME_CHECK(cudaGetDeviceProperties(&prop, device_idx)); + cached_prop = std::make_shared(prop); + } return cached_prop; }