summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-03-20 15:38:33 -0400
committerTom Stellard <thomas.stellard@amd.com>2012-03-20 15:38:33 -0400
commit54f37597d31e965dd6c301123980a01faa55792d (patch)
tree8b17bf1ff43109ab6c8710c9b2762a16fcd1ee07
parent394778d2327dda4cc32b67683d5165e9274a567e (diff)
r600g: Compute the correct wavefront size
-rw-r--r--src/gallium/drivers/r600/evergreen_compute.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index 58d9b3c6b17..4d98ceaa821 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -454,8 +454,18 @@ static void evergreen_launch_grid(
COMPUTE_DBG("PC: %i\n", pc);
struct r600_context *ctx = (struct r600_context *)ctx_;
-
- evergreen_set_lds(ctx->cs_shader, 0, 0, 0);
+ unsigned num_waves;
+ unsigned num_pipes = ctx->screen->info.r600_max_pipes;
+ unsigned wave_divisor = (16 * num_pipes);
+
+ /* num_waves = ceil((tg_size.x * tg_size.y, tg_size.z) / (16 * num_pipes)) */
+ num_waves = (block_layout[0] * block_layout[1] * block_layout[2] + wave_divisor - 1) /
+ wave_divisor;
+
+ COMPUTE_DBG("Using %u pipes, there are %u wavefronts per thread block\n",
+ num_pipes, num_waves);
+
+ evergreen_set_lds(ctx->cs_shader, 0, 0, num_waves);
evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input);
evergreen_direct_dispatch(ctx_, block_layout, grid_layout);
compute_emit_cs(ctx);