[Mesa-dev] [PATCH 2/2] Added missing address space checking of kernel parameters

Jonathan Charest jcharest+mesa-dev at gmail.com
Mon Jul 22 06:24:56 PDT 2013


To have non-static buffers in local memory, it is necessary to pass them
as arguments to the kernel.

For r600, the correct lds size must be set to the SQ_LDS_ALLOC register.
The correct size is the clover size plus the size reported by the
compiler.

---
 src/gallium/drivers/r600/evergreen_compute.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c
b/src/gallium/drivers/r600/evergreen_compute.c
index f76fc9c..9b2bae3 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -211,8 +211,7 @@ void *evergreen_create_compute_state(
 #endif

 	shader->ctx = (struct r600_context*)ctx;
-	/* XXX: We ignore cso->req_local_mem, because we compute this value
-	 * ourselves on a per-kernel basis. */
+	shader->local_size = cso->req_local_mem;
 	shader->private_size = cso->req_private_mem;
 	shader->input_size = cso->req_input_mem;

@@ -334,7 +333,7 @@ static void evergreen_emit_direct_dispatch(
 	unsigned wave_divisor = (16 * num_pipes);
 	int group_size = 1;
 	int grid_size = 1;
-	unsigned lds_size = shader->active_kernel->bc.nlds_dw;
+	unsigned lds_size = shader->local_size / 4 +
shader->active_kernel->bc.nlds_dw;

 	/* Calculate group_size/grid_size */
 	for (i = 0; i < 3; i++) {
-- 1.8.3.2



More information about the mesa-dev mailing list