[Mesa-dev] [PATCH 1/3] gallium: Pass input data size to launch_grid

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


Future commits add implicit parameters so
we can no longer rely on shader param size

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 src/gallium/drivers/ilo/ilo_gpgpu.c               |  2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_compute.c   |  2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h   |  4 +--
 src/gallium/drivers/nouveau/nvc0/nve4_compute.c   |  2 +-
 src/gallium/drivers/r600/evergreen_compute.c      |  2 +-
 src/gallium/drivers/radeonsi/si_compute.c         |  2 +-
 src/gallium/include/pipe/p_context.h              |  2 +-
 src/gallium/state_trackers/clover/core/kernel.cpp |  2 +-
 src/gallium/tests/trivial/compute.c               | 40 +++++++++++------------
 9 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_gpgpu.c b/src/gallium/drivers/ilo/ilo_gpgpu.c
index b17a518..d995db2 100644
--- a/src/gallium/drivers/ilo/ilo_gpgpu.c
+++ b/src/gallium/drivers/ilo/ilo_gpgpu.c
@@ -35,7 +35,7 @@
 static void
 ilo_launch_grid(struct pipe_context *pipe,
                 const uint *block_layout, const uint *grid_layout,
-                uint32_t pc, const void *input)
+                uint32_t pc, const void *input, size_t size)
 {
 }
 
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
index ad287a2..55b71e2 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
@@ -197,7 +197,7 @@ void
 nvc0_launch_grid(struct pipe_context *pipe,
                  const uint *block_layout, const uint *grid_layout,
                  uint32_t label,
-                 const void *input)
+                 const void *input, size_t size)
 {
    struct nvc0_context *nvc0 = nvc0_context(pipe);
    struct nouveau_pushbuf *push = nvc0->base.pushbuf;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index ebeb8c4..2e901fa 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -353,10 +353,10 @@ void nvc0_push_vbo(struct nvc0_context *, const struct pipe_draw_info *);
 
 /* nve4_compute.c */
 void nve4_launch_grid(struct pipe_context *,
-                      const uint *, const uint *, uint32_t, const void *);
+                      const uint *, const uint *, uint32_t, const void *, size_t);
 
 /* nvc0_compute.c */
 void nvc0_launch_grid(struct pipe_context *,
-                      const uint *, const uint *, uint32_t, const void *);
+                      const uint *, const uint *, uint32_t, const void *, size_t);
 
 #endif
diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
index f243316..e408ec8 100644
--- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
@@ -432,7 +432,7 @@ void
 nve4_launch_grid(struct pipe_context *pipe,
                  const uint *block_layout, const uint *grid_layout,
                  uint32_t label,
-                 const void *input)
+                 const void *input, size_t size)
 {
    struct nvc0_context *nvc0 = nvc0_context(pipe);
    struct nouveau_pushbuf *push = nvc0->base.pushbuf;
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index 1970414..d50f343 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -541,7 +541,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)
+		uint32_t pc, const void *input, size_t size)
 {
 	struct r600_context *ctx = (struct r600_context *)ctx_;
 
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 42e4fec..9a90470 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)
+		uint32_t pc, const void *input, size_t size)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
 	struct si_pipe_compute *program = sctx->cs_shader_state.program;
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index af5674f..e71be02 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -523,7 +523,7 @@ struct pipe_context {
     */
    void (*launch_grid)(struct pipe_context *context,
                        const uint *block_layout, const uint *grid_layout,
-                       uint32_t pc, const void *input);
+                       uint32_t pc, const void *input, size_t size);
    /*@}*/
 
    /**
diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
index 5e5fe51..68e91d5 100644
--- a/src/gallium/state_trackers/clover/core/kernel.cpp
+++ b/src/gallium/state_trackers/clover/core/kernel.cpp
@@ -93,7 +93,7 @@ kernel::launch(command_queue &q,
                        pad_vector(q, block_size, 1).data(),
                        pad_vector(q, reduced_grid_size, 1).data(),
                        find(name_equals(_name), m.syms).offset,
-                       exec.input.data());
+                       exec.input.data(), exec.input.size());
 
    q.pipe->set_global_binding(q.pipe, 0, exec.g_buffers.size(), NULL, NULL);
    q.pipe->set_compute_resources(q.pipe, 0, exec.resources.size(), NULL);
diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
index 4edb857..3805c6b 100644
--- a/src/gallium/tests/trivial/compute.c
+++ b/src/gallium/tests/trivial/compute.c
@@ -421,11 +421,11 @@ static void destroy_globals(struct context *ctx)
 
 static void launch_grid(struct context *ctx, const uint *block_layout,
                         const uint *grid_layout, uint32_t pc,
-                        const void *input)
+                        const void *input, size_t size)
 {
         struct pipe_context *pipe = ctx->pipe;
 
-        pipe->launch_grid(pipe, block_layout, grid_layout, pc, input);
+        pipe->launch_grid(pipe, block_layout, grid_layout, pc, input, size);
 }
 
 static void test_system_values(struct context *ctx)
@@ -492,7 +492,7 @@ static void test_system_values(struct context *ctx)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  76800, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){4, 3, 5}, (uint []){5, 4, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){4, 3, 5}, (uint []){5, 4, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -537,7 +537,7 @@ static void test_resource_access(struct context *ctx)
         init_tex(ctx, 1, PIPE_TEXTURE_2D, true, PIPE_FORMAT_R32_FLOAT,
                  60, 12, init1);
         init_compute_resources(ctx, (int []) { 0, 1, -1 });
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){15, 12, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){15, 12, 1}, 0, NULL, 0);
         check_tex(ctx, 1, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -598,7 +598,7 @@ static void test_function_calls(struct context *ctx)
         init_tex(ctx, 0, PIPE_TEXTURE_2D, true, PIPE_FORMAT_R32_FLOAT,
                  15, 12, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){3, 3, 3}, (uint []){5, 4, 1}, 15, NULL);
+        launch_grid(ctx, (uint []){3, 3, 3}, (uint []){5, 4, 1}, 15, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -640,7 +640,7 @@ static void test_input_global(struct context *ctx)
         init_globals(ctx, (int []){ 0, 1, 2, 3, -1 },
                      (uint32_t *[]){ &input[1], &input[3],
                                      &input[5], &input[7] });
-        launch_grid(ctx, (uint []){4, 1, 1}, (uint []){1, 1, 1}, 0, input);
+        launch_grid(ctx, (uint []){4, 1, 1}, (uint []){1, 1, 1}, 0, input, sizeof(input));
         check_tex(ctx, 0, expect, NULL);
         check_tex(ctx, 1, expect, NULL);
         check_tex(ctx, 2, expect, NULL);
@@ -704,7 +704,7 @@ static void test_private(struct context *ctx)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  32768, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){16, 1, 1}, (uint []){16, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){16, 1, 1}, (uint []){16, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -791,7 +791,7 @@ static void test_local(struct context *ctx)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  4096, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){64, 1, 1}, (uint []){16, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){64, 1, 1}, (uint []){16, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -846,7 +846,7 @@ static void test_sample(struct context *ctx)
         init_compute_resources(ctx, (int []) { 1, -1 });
         init_sampler_views(ctx, (int []) { 0, -1 });
         init_sampler_states(ctx, 2);
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){128, 32, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){128, 32, 1}, 0, NULL, 0);
         check_tex(ctx, 1, expect, NULL);
         destroy_sampler_states(ctx);
         destroy_sampler_views(ctx);
@@ -896,10 +896,10 @@ static void test_many_kern(struct context *ctx)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  16, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 0, NULL);
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 5, NULL);
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 10, NULL);
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 15, NULL);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 0, NULL, 0);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 5, NULL, 0);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 10, NULL, 0);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){1, 1, 1}, 15, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -937,7 +937,7 @@ static void test_constant(struct context *ctx)
         init_tex(ctx, 1, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  256, 0, init);
         init_compute_resources(ctx, (int []) { 0, 1, -1 });
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){64, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){64, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 1, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -983,7 +983,7 @@ static void test_resource_indirect(struct context *ctx)
         init_tex(ctx, 3, PIPE_BUFFER, false, PIPE_FORMAT_R32_FLOAT,
                  256, 0, init);
         init_compute_resources(ctx, (int []) { 0, 1, 2, 3, -1 });
-        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){64, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){64, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -1091,7 +1091,7 @@ static void test_surface_ld(struct context *ctx)
                 init_compute_resources(ctx, (int []) { 0, 1, -1 });
                 init_sampler_states(ctx, 2);
                 launch_grid(ctx, (uint []){1, 1, 1}, (uint []){128, 32, 1}, 0,
-                            NULL);
+                            NULL, 0);
                 check_tex(ctx, 1, (is_int ? expecti : expectf), NULL);
                 destroy_sampler_states(ctx);
                 destroy_compute_resources(ctx);
@@ -1198,7 +1198,7 @@ static void test_surface_st(struct context *ctx)
                 init_compute_resources(ctx, (int []) { 0, 1, -1 });
                 init_sampler_states(ctx, 2);
                 launch_grid(ctx, (uint []){1, 1, 1}, (uint []){128, 32, 1}, 0,
-                            NULL);
+                            NULL, 0);
                 check_tex(ctx, 1, (is_int && is_signed ? expects :
                                    is_int && !is_signed ? expectu :
                                    expectf), check);
@@ -1272,7 +1272,7 @@ static void test_barrier(struct context *ctx)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  4096, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){64, 1, 1}, (uint []){16, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){64, 1, 1}, (uint []){16, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -1426,7 +1426,7 @@ static void test_atom_ops(struct context *ctx, bool global)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  40, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){10, 1, 1}, (uint []){1, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){10, 1, 1}, (uint []){1, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
@@ -1565,7 +1565,7 @@ static void test_atom_race(struct context *ctx, bool global)
         init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,
                  4096, 0, init);
         init_compute_resources(ctx, (int []) { 0, -1 });
-        launch_grid(ctx, (uint []){64, 1, 1}, (uint []){16, 1, 1}, 0, NULL);
+        launch_grid(ctx, (uint []){64, 1, 1}, (uint []){16, 1, 1}, 0, NULL, 0);
         check_tex(ctx, 0, expect, NULL);
         destroy_compute_resources(ctx);
         destroy_tex(ctx);
-- 
1.9.3



More information about the mesa-dev mailing list