[Mesa-dev] [PATCH 3/3] r600, radeonsi: Copy implicit args provided by clover

Jan Vesely jan.vesely at rutgers.edu
Wed Aug 6 14:36:19 PDT 2014


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 src/gallium/drivers/r600/evergreen_compute.c | 14 ++++++++------
 src/gallium/drivers/r600/evergreen_compute.h |  1 -
 src/gallium/drivers/radeonsi/si_compute.c    |  6 +++---
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index d50f343..37910fb 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -268,11 +268,12 @@ static void evergreen_bind_compute_state(struct pipe_context *ctx_, void *state)
  *             (x,y,z)
  * DWORDS 9+ : Kernel parameters
  */
-void evergreen_compute_upload_input(
+static void evergreen_compute_upload_input(
 	struct pipe_context *ctx_,
 	const uint *block_layout,
 	const uint *grid_layout,
-	const void *input)
+	const void *input,
+	size_t kinput_size)
 {
 	struct r600_context *ctx = (struct r600_context *)ctx_;
 	struct r600_pipe_compute *shader = ctx->cs_shader_state.shader;
@@ -280,7 +281,7 @@ void evergreen_compute_upload_input(
 	/* We need to reserve 9 dwords (36 bytes) for implicit kernel
 	 * parameters.
 	 */
-	unsigned input_size = shader->input_size + 36;
+	unsigned input_size = kinput_size + 36;
 	uint32_t * num_work_groups_start;
 	uint32_t * global_size_start;
 	uint32_t * local_size_start;
@@ -320,7 +321,7 @@ void evergreen_compute_upload_input(
 	memcpy(local_size_start, block_layout, 3 * sizeof(uint));
 
 	/* Copy the kernel inputs */
-	memcpy(kernel_parameters_start, input, shader->input_size);
+	memcpy(kernel_parameters_start, input, kinput_size);
 
 	for (i = 0; i < (input_size / 4); i++) {
 		COMPUTE_DBG(ctx->screen, "input %i : %u\n", i,
@@ -541,7 +542,7 @@ void evergreen_emit_cs_shader(
 static void evergreen_launch_grid(
 		struct pipe_context *ctx_,
 		const uint *block_layout, const uint *grid_layout,
-		uint32_t pc, const void *input, size_t size)
+		uint32_t pc, const void *input, size_t input_size)
 {
 	struct r600_context *ctx = (struct r600_context *)ctx_;
 
@@ -584,7 +585,8 @@ static void evergreen_launch_grid(
 #endif
 	shader->active_kernel = kernel;
 	ctx->cs_shader_state.kernel_index = pc;
-	evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input);
+	evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input,
+                                       input_size);
 	compute_emit_cs(ctx, block_layout, grid_layout);
 }
 
diff --git a/src/gallium/drivers/r600/evergreen_compute.h b/src/gallium/drivers/r600/evergreen_compute.h
index 4fb53a1..570ab2a 100644
--- a/src/gallium/drivers/r600/evergreen_compute.h
+++ b/src/gallium/drivers/r600/evergreen_compute.h
@@ -40,7 +40,6 @@ struct r600_resource_global {
 
 void *evergreen_create_compute_state(struct pipe_context *ctx, const struct pipe_compute_state *cso);
 void evergreen_delete_compute_state(struct pipe_context *ctx, void *state);
-void evergreen_compute_upload_input(struct pipe_context *context, const uint *block_layout, const uint *grid_layout, const void *input);
 void evergreen_init_atom_start_compute_cs(struct r600_context *rctx);
 void evergreen_init_compute_state_functions(struct r600_context *rctx);
 void evergreen_emit_cs_shader(struct r600_context *rctx, struct r600_atom * atom);
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 9a90470..66df65f 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -162,7 +162,7 @@ static unsigned compute_num_waves_for_scratch(
 static void si_launch_grid(
 		struct pipe_context *ctx,
 		const uint *block_layout, const uint *grid_layout,
-		uint32_t pc, const void *input, size_t size)
+		uint32_t pc, const void *input, size_t input_size)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
 	struct si_pipe_compute *program = sctx->cs_shader_state.program;
@@ -197,7 +197,7 @@ static void si_launch_grid(
 	/* Upload the kernel arguments */
 
 	/* The extra num_work_size_bytes are for work group / work item size information */
-	kernel_args_size = program->input_size + num_work_size_bytes + 8 /* For scratch va */;
+	kernel_args_size = input_size + num_work_size_bytes + 8 /* For scratch va */;
 
 	kernel_args = MALLOC(kernel_args_size);
 	for (i = 0; i < 3; i++) {
@@ -209,7 +209,7 @@ static void si_launch_grid(
 	num_waves_for_scratch =	compute_num_waves_for_scratch(
 		&sctx->screen->b.info, block_layout, grid_layout);
 
-	memcpy(kernel_args + (num_work_size_bytes / 4), input, program->input_size);
+	memcpy(kernel_args + (num_work_size_bytes / 4), input, input_size);
 
 	if (shader->scratch_bytes_per_wave > 0) {
 		unsigned scratch_bytes = shader->scratch_bytes_per_wave *
-- 
1.9.3



More information about the mesa-dev mailing list