Email or username:

Password:

Forgot your password?
Raph Levien

A bit of a followup to the barrier miscompilation issue I found. So far in developing piet-gpu I've found about 5 of these, in about 5k lines of GPU shader code. So I estimate if you're writing this kind of intricate compute stuff, you'll likely run into one serious miscompilation every 1000 lines of code.

My goal is to get each of these into an appropriate test. A previous cycle is github.com/KhronosGroup/VK-GL- and will also be featured in an ASPLOS paper.

The new one is:

github.com/gpuweb/cts/issues/1

2 comments
David Neto

@raph Blessed are the test makers.

Great find.

My first theory in the office hours discussion was that the MSL compiler assumed reconvergence after the "if" and then assumed the barrier could be elided because it thought the subgroup was executing reconvergently or in "lockstep".

Who knows what Apple will conclude, though.

emk

@raph That's some pretty amazing bug hunting.

It's been ~15 years since I caught a miscompilation in CPU code. We were using the Quake II engine to simulate gamma radiation (long story), and Carmack's code stored the address of a stack var in a global during a deep recursive call tree.

MSVC did a tail-call jump, destroying the stack frame. Even though the pointer had escaped.

(Or maybe doing that with a pointer is undefined behavior. Honestly, I never remember with C.)

Go Up