Skip to content

Commit 436f0d8

Browse files
abagusettyAbhishek Bagusetty
andauthored
[SYCL][CUDA][HIP] Add support for intel extension free-memory (#6709)
The support is added for NVIDIA and AMD devices. Co-authored-by: Abhishek Bagusetty <[email protected]>
1 parent c058380 commit 436f0d8

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,16 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
18871887
result.c_str());
18881888
}
18891889

1890+
case PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY: {
1891+
size_t FreeMemory = 0;
1892+
size_t TotalMemory = 0;
1893+
sycl::detail::pi::assertion(cuMemGetInfo(&FreeMemory, &TotalMemory) ==
1894+
CUDA_SUCCESS,
1895+
"failed cuMemGetInfo() API.");
1896+
return getInfo(param_value_size, param_value, param_value_size_ret,
1897+
FreeMemory);
1898+
}
1899+
18901900
// TODO: Investigate if this information is available on CUDA.
18911901
case PI_DEVICE_INFO_PCI_ADDRESS:
18921902
case PI_DEVICE_INFO_GPU_EU_COUNT:

sycl/plugins/hip/pi_hip.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,16 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
17791779
props.arch.hasSharedInt64Atomics);
17801780
}
17811781

1782+
case PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY: {
1783+
size_t FreeMemory = 0;
1784+
size_t TotalMemory = 0;
1785+
sycl::detail::pi::assertion(hipMemGetInfo(&FreeMemory, &TotalMemory) ==
1786+
hipSuccess,
1787+
"failed hipMemGetInfo() API.");
1788+
return getInfo(param_value_size, param_value, param_value_size_ret,
1789+
FreeMemory);
1790+
}
1791+
17821792
// TODO: Implement.
17831793
case PI_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES:
17841794
// TODO: Investigate if this information is available on HIP.

0 commit comments

Comments
 (0)