About vkCmdPipelineBarrier

Hello,
In dynamic_rendering_local_read.cpp in Vulkan-Samples tutorials
the 926th line

vkCmdPipelineBarrier2KHR(cmd, &dependencyInfo);

If I remove this 926th line, then this pipelinebarrier2 disappears
but still the program “dynamic_rendering_local_read” works fine and there were no validation errors
That pipelinebarrier is located between two local-reads
(Of course, this source does not use renderpass, it uses dynamic rendering)

So, I guess this pipelinebarrier2 does not be need

Also, when I code my own program which uses two set of vkCmdBeginRendering (with vkCmdEndRendering), I find actually pipelinebarriers is not needed in between

So, may I ask
Usually are these pipelinebarriers between local-reads not needed ?
For what and for when are these actually really needed ?

Thank you