ISPC emits vcmpleps + vblendvps instead of vminps/vmaxps

43 views
Skip to first unread message

Michael Andersson

unread,
Apr 13, 2020, 12:01:42 PM4/13/20
to Intel SPMD Program Compiler Users
Hi,
I've been working on a few different implementations of a simple ray tracer where one is implemented using intrinsics and one using ISPC. Long story short, the intrinsics version outperforms the ISPC one and it appears to be the ray/aabb intersection test that is slower. I did a comparison with Compiler Explorer and one difference I noticed is that ISPC emits vcmpleps + vblendvps as opposed to vminps/vmaxps (see https://godbolt.org/z/ZD7Vpr for details). I have yet to determine with absolute certainty that this specific difference between the intrinsics version and the one written in ISPC is causing the performance difference but it seems a resonable cause given that the former ends up having less instructions than the latter.

1. Is there a specific reason why ISPC emits vcmpleps + vblendvps instead of vminps/vmaxps?
2. Is there something I can do, be it provide a specific compiler flag or write the intersection routine differently, to make ISPC emit vminps/vmaxps instructions?

Thanks
Michael

Dmitry Babokin

unread,
Apr 13, 2020, 12:38:44 PM4/13/20
to ispc-...@googlegroups.com
Hi Michael,

I'm glad that I have an easy answer for you. Try ispc trunk, instead of v1.12. It has a fix. Download page has links to ispc trunk for Linux and Windows. If you need Mac, I can build it for you manually. Compile Explorer also has ispc trunk.

I'm curious if this fixes all code gen issues in your code and if ispc performs on par with intrinsics version. 

Dmitry.

--
You received this message because you are subscribed to the Google Groups "Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispc-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ispc-users/d86e5c0a-dd18-4a50-9517-9924a8056dc5%40googlegroups.com.

Michael Andersson

unread,
Apr 13, 2020, 2:37:47 PM4/13/20
to Intel SPMD Program Compiler Users
Hi Dmitry,
Thank you for getting back to me so quickly :)

I completely missed that trunk was available in Compiler Explorer, nice to see that it emits the instructions I was asking about.

I tried compiling my ISPC programs with trunk but I ran into a compiler bug. Didn't find a similar one that had already been reported so I filed https://github.com/ispc/ispc/issues/1711.

Cheers,
Michael
To unsubscribe from this group and stop receiving emails from it, send an email to ispc-...@googlegroups.com.

Dmitry Babokin

unread,
Apr 13, 2020, 3:47:40 PM4/13/20
to ispc-...@googlegroups.com
Thanks for reporting it! It's related to recent changes. We'll fix it.

Dmitry.

To unsubscribe from this group and stop receiving emails from it, send an email to ispc-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ispc-users/0e53eec5-26a3-4707-8a7f-6c785ee1dbfa%40googlegroups.com.

Michael Andersson

unread,
Apr 21, 2020, 4:32:34 PM4/21/20
to Intel SPMD Program Compiler Users
Thanks for fixing the issue. Instead of being ~13 ms slower than the intrinsics version the ISPC version is now ~54 ms faster :)

Cheers,
Michael

Dmitry Babokin

unread,
Apr 21, 2020, 4:42:21 PM4/21/20
to ispc-...@googlegroups.com
Woohoo! [dancing]

To unsubscribe from this group and stop receiving emails from it, send an email to ispc-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ispc-users/6676e462-20a3-40af-91d9-cf2128537e57%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages