[Platform] Replace torch.cuda.mem_get_info with torch.accelerator.get_memory_info (#44825)

Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
Signed-off-by: Kunshang Ji <jikunshang95@gmail.com>
This commit is contained in:
Kunshang Ji
2026-06-30 14:39:52 +08:00
committed by GitHub
parent 0feca7ffa8
commit fb42e5219e
17 changed files with 56 additions and 52 deletions
+1 -1
View File
@@ -1285,7 +1285,7 @@ def test_token_logprobs_large_batch_int64_row_offset():
batch_size = 2**31 // vocab_size + 64 # batch_size * vocab_size > 2**31
# logits (the large input) plus small logprob/rank outputs; ~1 GB headroom.
required_bytes = batch_size * vocab_size * 4 + (1 << 30)
if torch.cuda.mem_get_info()[0] < required_bytes:
if torch.accelerator.get_memory_info()[0] < required_bytes:
pytest.skip(f"needs ~{required_bytes / 1e9:.0f} GB of free GPU memory")
logits = torch.randn(batch_size, vocab_size, device=device, dtype=torch.float32)
+1 -1
View File
@@ -426,7 +426,7 @@ class TestTritonTopkTopp:
# logits is modified in place; the only extra device memory is the
# per-SM scratch buffer (~num_sm * vocab), so allow ~1 GB of headroom.
required_bytes = batch_size * vocab_size * 4 + (1 << 30)
if torch.cuda.mem_get_info()[0] < required_bytes:
if torch.accelerator.get_memory_info()[0] < required_bytes:
pytest.skip(f"needs ~{required_bytes / 1e9:.0f} GB of free GPU memory")
logits = torch.randn(