Skip to content

Commit 02da2df

Browse files
anv: implement missing PIPE_CONTROL restriction in GPGPU
I saw this programming note a while ago but never sent the patch... /o\ Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109020
1 parent fe0ad18 commit 02da2df

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

src/intel/vulkan/genX_cmd_buffer.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer)
177177
pc.TextureCacheInvalidationEnable = true;
178178
pc.ConstantCacheInvalidationEnable = true;
179179
pc.StateCacheInvalidationEnable = true;
180+
181+
/* From the SKL PRM, Vol. 2a, "PIPE_CONTROL",
182+
*
183+
* Project: SKL+
184+
*
185+
* "“CS Stall” bit in PIPE_CONTROL command must be always set for
186+
* GPGPU workloads when “Texture Cache Invalidation Enable” bit is
187+
* set"
188+
*/
189+
#if GEN_GEN >= 9
190+
pc.CommandStreamerStallEnable = cmd_buffer->state.current_pipeline == GPGPU;
191+
#endif
180192
}
181193
}
182194

@@ -1599,6 +1611,18 @@ genX(cmd_buffer_config_l3)(struct anv_cmd_buffer *cmd_buffer,
15991611
pc.InstructionCacheInvalidateEnable = true;
16001612
pc.StateCacheInvalidationEnable = true;
16011613
pc.PostSyncOperation = NoWrite;
1614+
1615+
/* From the SKL PRM, Vol. 2a, "PIPE_CONTROL",
1616+
*
1617+
* Project: SKL+
1618+
*
1619+
* "“CS Stall” bit in PIPE_CONTROL command must be always set for
1620+
* GPGPU workloads when “Texture Cache Invalidation Enable” bit is
1621+
* set"
1622+
*/
1623+
#if GEN_GEN >= 9
1624+
pc.CommandStreamerStallEnable = cmd_buffer->state.current_pipeline == GPGPU;
1625+
#endif
16021626
}
16031627

16041628
/* Now send a third stalling flush to make sure that invalidation is
@@ -1801,6 +1825,20 @@ genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer)
18011825
pipe.InstructionCacheInvalidateEnable =
18021826
bits & ANV_PIPE_INSTRUCTION_CACHE_INVALIDATE_BIT;
18031827

1828+
/* From the SKL PRM, Vol. 2a, "PIPE_CONTROL",
1829+
*
1830+
* Project: SKL+
1831+
*
1832+
* "“CS Stall” bit in PIPE_CONTROL command must be always set for
1833+
* GPGPU workloads when “Texture Cache Invalidation Enable” bit is
1834+
* set"
1835+
*/
1836+
#if GEN_GEN >= 9
1837+
pipe.CommandStreamerStallEnable =
1838+
cmd_buffer->state.current_pipeline == GPGPU &&
1839+
(bits & ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT);
1840+
#endif
1841+
18041842
/* From the SKL PRM, Vol. 2a, "PIPE_CONTROL",
18051843
*
18061844
* "When VF Cache Invalidate is set “Post Sync Operation” must be
@@ -3366,6 +3404,18 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer,
33663404
pc.StateCacheInvalidationEnable = true;
33673405
pc.InstructionCacheInvalidateEnable = true;
33683406
pc.PostSyncOperation = NoWrite;
3407+
3408+
/* From the SKL PRM, Vol. 2a, "PIPE_CONTROL",
3409+
*
3410+
* Project: SKL+
3411+
*
3412+
* "“CS Stall” bit in PIPE_CONTROL command must be always set for
3413+
* GPGPU workloads when “Texture Cache Invalidation Enable” bit is
3414+
* set"
3415+
*/
3416+
#if GEN_GEN >= 9
3417+
pc.CommandStreamerStallEnable = cmd_buffer->state.current_pipeline == GPGPU;
3418+
#endif
33693419
}
33703420

33713421
anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT), ps) {

0 commit comments

Comments
 (0)