sycl: size the expert cache from the DRM fdinfo when xe reports 0 free card memory (#1545)
On an Arc A770 16 GB on the xe driver, Level Zero has no ext_intel_free_memory and get_memory_info reports 0 free with the right total. device_free_bytes() kept the 0 (the #1440 fdinfo path only replaces a figure that is too high), so --expert-cache auto sized the caches from 0 bytes. A 0 with a known total is now read as unknown: on Linux the card's total less this process's DRM fdinfo figure is used, the same source the A750/i915 path uses. Anything that reports a non-zero free figure is unchanged; off Linux the 0 stands.
This commit is contained in:
1 parent
c106e9629a
commit
ddcc5f56dc
1 file changed
+13
@@ -74,6 +74,19 @@ size_t device_free_bytes() try {
|
||||
You may need to adjust the code.
|
||||
*/
|
||||
dpct::get_current_device().get_memory_info(free_b, total_b);
|
||||
// An Arc on the xe driver whose Level Zero has no ext_intel_free_memory reports 0 free (Arc A770 16 GB, xe, #1545):
|
||||
// --expert-cache auto then sized its caches from 0 bytes. 0 with a known total means "the driver does not know", so on
|
||||
// Linux (xe is Linux-only) the card's total less what this process holds (the DRM fdinfo, as for the A750/i915 below)
|
||||
// is used instead. Like that figure it does not see other processes' memory. Elsewhere the 0 stands.
|
||||
#if defined(__linux__)
|
||||
if (free_b == 0 && total_b > 0)
|
||||
if (const unsigned long long own = own_drm_local_bytes(); own < total_b) {
|
||||
static std::atomic<bool> said{false};
|
||||
if (!said.exchange(true))
|
||||
std::fprintf(stderr, "strata: the driver reports no free card memory (xe without ext_intel_free_memory); sizing from the DRM fdinfo (this process holds %.2f GiB)\n", (double) own / 1073741824.0);
|
||||
free_b = (size_t) (total_b - own);
|
||||
}
|
||||
#endif
|
||||
// #1440: own_drm_local_bytes() sums every DRM fd of the process, i.e. both cards on a layer split, and would charge the
|
||||
// first card's cache to the second. With more than one GPU it runs only where the driver reports the whole card as
|
||||
// free (Arc A750/i915); a one-GPU run keeps the figure it always had.
|
||||
|
||||
Reference in new issue
Block a user