radeonsi: also prefetch compute shaders
authorMarek Olšák <marek.olsak@amd.com>
Tue, 24 Jan 2017 02:41:05 +0000 (03:41 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 30 Jan 2017 12:27:14 +0000 (13:27 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_compute.c

index fe29fb154d5301c8535198fd9f245aa44c4c1513..d05c488f38ce16cabc56f6a2fdb2173c3482505d 100644 (file)
@@ -372,6 +372,18 @@ static bool si_switch_compute_shader(struct si_context *sctx,
                              RADEON_PRIO_SCRATCH_BUFFER);
        }
 
+       /* Prefetch the compute shader to TC L2.
+        *
+        * We should also prefetch graphics shaders if a compute dispatch was
+        * the last command, and the compute shader if a draw call was the last
+        * command. However, that would add more complexity and we're likely
+        * to get a shader state change in that case anyway.
+        */
+       if (sctx->b.chip_class >= CIK) {
+               cik_prefetch_TC_L2_async(sctx, &program->shader.bo->b.b,
+                                        0, program->shader.bo->b.b.width0);
+       }
+
        shader_va = shader->bo->gpu_address + offset;
        if (program->use_code_object_v2) {
                /* Shader code is placed after the amd_kernel_code_t