[Beignet] [PATCH 2/2] Query the driver directly for compute units and subslice
jeff.mcgee at intel.com
jeff.mcgee at intel.com
Mon Mar 2 15:42:39 PST 2015
From: Jeff McGee <jeff.mcgee at intel.com>
Values of device max compute units and max subslice obtained
directly from the driver should be more accurate than our own
ID-based lookup values. This is particularly important when a
single device ID may encompass more than one configuration. If
the driver cannot provide a valid value for the given device,
we fallback on the ID-based lookup value.
Signed-off-by: Jeff McGee <jeff.mcgee at intel.com>
---
src/intel/intel_driver.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index d61988c..d99fea9 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -757,10 +757,8 @@ static int intel_buffer_set_tiling(cl_buffer bo,
static void
intel_update_device_info(cl_device_id device)
{
-#ifdef HAS_USERPTR
intel_driver_t *driver;
- const size_t sz = 4096;
- void *host_ptr;
+ unsigned int eu_total, subslice_total;
driver = intel_driver_new();
assert(driver != NULL);
@@ -769,6 +767,10 @@ intel_update_device_info(cl_device_id device)
return;
}
+#ifdef HAS_USERPTR
+ const size_t sz = 4096;
+ void *host_ptr;
+
host_ptr = cl_aligned_malloc(sz, 4096);
if (host_ptr != NULL) {
cl_buffer bo = intel_buffer_alloc_userptr((cl_buffer_mgr)driver->bufmgr,
@@ -781,12 +783,18 @@ intel_update_device_info(cl_device_id device)
}
else
device->host_unified_memory = CL_FALSE;
+#endif
+
+ /* Prefer driver-queried value if supported */
+ if (!drm_intel_get_eu_total(driver->fd, &eu_total))
+ device->max_compute_unit = eu_total;
+ if (!drm_intel_get_subslice_total(driver->fd, &subslice_total))
+ device->sub_slice_count = subslice_total;
intel_driver_context_destroy(driver);
intel_driver_close(driver);
intel_driver_terminate(driver);
intel_driver_delete(driver);
-#endif
}
LOCAL void
--
2.3.0
More information about the Beignet
mailing list