[Beignet] [PATCH V2] ocl20/runtime: take the first 64KB page table entries.

Ruiling Song ruiling.song at intel.com
Wed Dec 16 22:23:54 PST 2015


After we take first 64KB page table entries. we would make sure
the global memory will not be allocated in the range [0, 64KB].
this is needed, so that we can easily differentiate local/global
address space.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 src/intel/intel_gpgpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/intel/intel_gpgpu.c b/src/intel/intel_gpgpu.c
index 110c36f..277073d 100644
--- a/src/intel/intel_gpgpu.c
+++ b/src/intel/intel_gpgpu.c
@@ -953,8 +953,16 @@ intel_gpgpu_state_init(intel_gpgpu_t *gpgpu,
 
   /* make sure aux buffer is page aligned */
   size_aux = ALIGN(size_aux, 4096);
+  // we need to take the first 64KB page table entry, so that global memory and
+  // local memory address space are separated. we may need a better way to do this.
+  if (size_aux < 64*1024) size_aux = 64*1024;
 
   bo = dri_bo_alloc(gpgpu->drv->bufmgr, "AUX_BUFFER", size_aux, 4096);
+  drm_intel_bo_set_softpin_offset(bo, 0);
+  // don't reuse it, that would make two bo trying to bind to same address,
+  // which is un-reasonable.
+  drm_intel_bo_disable_reuse(bo);
+
   if (!bo || dri_bo_map(bo, 1) != 0) {
     fprintf(stderr, "%s:%d: %s.\n", __FILE__, __LINE__, strerror(errno));
     if (bo)
-- 
2.4.1



More information about the Beignet mailing list