By: Mark Roulo (nothanks.delete@this.xxx.com), July 17, 2015 9:03 am
Room: Moderated Discussions
Michael S (already5chosen.delete@this.yahoo.com) on July 17, 2015 8:44 am wrote:
> Mark Roulo (nothanks.delete@this.xxx.com) on July 17, 2015 8:19 am wrote:
> > Michael S (already5chosen.delete@this.yahoo.com) on July 17, 2015 4:51 am wrote:
> > > Jouni Osmala (josmala.delete@this.cc.hut.fi) on July 17, 2015 1:18 am wrote:
> > > >
> > > >
> > > > I believe haswell made the best possible addition to speed up bounds checking. Increasing
> > > > the branch unit from one to two. Having already compare and branch as fused operation
> > > > means that at execution stage it doesn't take more than one additional operation.
> > > >
> > >
> > > Generally, on that regard, unlike many others I am from
> > > you school, i.e. the argument that hardware to speed
> > > up bound checks should better be spent to speed up not only bound checks looks to me as very valid.
> > >
> > > BUT
> > >
> > > Without deep thinking I can see at least two good reasons
> > > for specialized hardware/ISA support for bound checking.
> >
> > We are getting bounds checkin H/W with Skylake.
> >
> > https://en.wikipedia.org/wiki/Intel_MPX
> >
> > I have no idea about the performance (one hopes it is faster than
> > software solutions ...)
>
> MPX sets impossible goal - to help bound checking C. With
> impossible goal you can't expect too useful results.
For any code that doesn't play with pointers in "odd" ways, MPX
should work fine (though I still have no idea about the performance
hit).
So:
*) Declare array and use it? FINE
*) Allocate array (with malloc) and use it? FINE
*) Walk pointer through known array start? FINE
My guess is that this can cover well over 90% of the array usage
in typical C programs. I'll take it and not complain too much about
the fact that things aren't 100%. More ... my guess is that C code
that does things that don't work well with MPX can be re-written to
play nicely (without much of a performance hit ... maybe none). If
the compiler generates warnings when it can't use MPX, those developers
who care about array out-of-bounds conditions enough will fix their
code to play nice.
> Mark Roulo (nothanks.delete@this.xxx.com) on July 17, 2015 8:19 am wrote:
> > Michael S (already5chosen.delete@this.yahoo.com) on July 17, 2015 4:51 am wrote:
> > > Jouni Osmala (josmala.delete@this.cc.hut.fi) on July 17, 2015 1:18 am wrote:
> > > >
> > > >
> > > > I believe haswell made the best possible addition to speed up bounds checking. Increasing
> > > > the branch unit from one to two. Having already compare and branch as fused operation
> > > > means that at execution stage it doesn't take more than one additional operation.
> > > >
> > >
> > > Generally, on that regard, unlike many others I am from
> > > you school, i.e. the argument that hardware to speed
> > > up bound checks should better be spent to speed up not only bound checks looks to me as very valid.
> > >
> > > BUT
> > >
> > > Without deep thinking I can see at least two good reasons
> > > for specialized hardware/ISA support for bound checking.
> >
> > We are getting bounds checkin H/W with Skylake.
> >
> > https://en.wikipedia.org/wiki/Intel_MPX
> >
> > I have no idea about the performance (one hopes it is faster than
> > software solutions ...)
>
> MPX sets impossible goal - to help bound checking C. With
> impossible goal you can't expect too useful results.
For any code that doesn't play with pointers in "odd" ways, MPX
should work fine (though I still have no idea about the performance
hit).
So:
*) Declare array and use it? FINE
*) Allocate array (with malloc) and use it? FINE
*) Walk pointer through known array start? FINE
My guess is that this can cover well over 90% of the array usage
in typical C programs. I'll take it and not complain too much about
the fact that things aren't 100%. More ... my guess is that C code
that does things that don't work well with MPX can be re-written to
play nicely (without much of a performance hit ... maybe none). If
the compiler generates warnings when it can't use MPX, those developers
who care about array out-of-bounds conditions enough will fix their
code to play nice.