This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Dependency confusion in sched-deps
- From: Michael Matz <matz at suse dot de>
- To: Maxim Kuvyrkov <maxim at kugelworks dot com>
- Cc: Paulo Matos <pmatos at broadcom dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 5 Dec 2013 16:25:35 +0100 (CET)
- Subject: Re: Dependency confusion in sched-deps
- Authentication-results: sourceware.org; auth=none
- References: <19EB96622A777C4AB91610E763265F463A3EB0 at SJEXCHMB14 dot corp dot ad dot broadcom dot com> <2ABA154D-7EAE-4422-AE0C-6E2E27F80235 at kugelworks dot com>
Hi,
On Thu, 5 Dec 2013, Maxim Kuvyrkov wrote:
> Output dependency is the right type (write after write). Anti
> dependency is write after read, and true dependency is read after write.
>
> Dependency type plays a role for estimating costs and latencies between
> instructions (which affects performance), but using wrong or imprecise
> dependency type does not affect correctness.
In the context of GCC and the middle ends memory model this statement is
not correct. For some dependency types we're using type based aliasing to
disambiguate, i.e ignore that dependency, which for others we don't. In
particular a read-after-write memory-access dependency can be ignored if
type info says they can't alias (because a program where both _would_
access the same memory would be invalid according to our mem model), but
for write-after-read or write-after-write we cannot do that disambiguation
(because the last write overrides the dynamic type of the memory cell even
if it was incompatible with the one before).
Ciao,
Michael.