<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 11, 2017 at 10:31 AM, Erik Faye-Lund <span dir="ltr"><<a href="mailto:kusmabite@gmail.com" target="_blank">kusmabite@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Jan 11, 2017 at 7:22 PM, Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br>
> On Wed, Jan 11, 2017 at 7:09 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
>> On Wed, Jan 11, 2017 at 9:32 AM, Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>><br>
>>><br>
>>> On 01/11/2017 05:32 PM, Marek Olšák wrote:<br>
>>>><br>
>>>> On Wed, Jan 11, 2017 at 4:33 PM, Erik Faye-Lund <<a href="mailto:kusmabite@gmail.com">kusmabite@gmail.com</a>><br>
>>>> wrote:<br>
>>>>><br>
>>>>> On Wed, Jan 11, 2017 at 4:14 PM, Nicolai Hähnle <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>><br>
>>>>> wrote:<br>
>>>>>><br>
>>>>>> On 11.01.2017 13:17, Marek Olšák wrote:<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> On Tue, Jan 10, 2017 at 6:48 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
>>>>>>> wrote:<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> I'll be honest, I'm not a fan... Given that D3D10 has one defined<br>
>>>>>>>> behavior,<br>
>>>>>>>> D3D9 has another, and GL doesn't specify, I don't really think we<br>
>>>>>>>> should<br>
>>>>>>>> be<br>
>>>>>>>> making a global change to all drivers to do the D3D9 behavior just to<br>
>>>>>>>> fix<br>
>>>>>>>> one app. Sure, other apps probably have the same bug, but are we<br>
>>>>>>>> going<br>
>>>>>>>> to<br>
>>>>>>>> have apps that expect the D3D10 behavior that we've now explicitly<br>
>>>>>>>> made<br>
>>>>>>>> not<br>
>>>>>>>> work?<br>
>>>>>>>><br>
>>>>>>>> If we're going to hack around an app bug, I would really rather see<br>
>>>>>>>> it<br>
>>>>>>>> behind a driconf option rather than a global change to driver<br>
>>>>>>>> behavior.<br>
>>>>>>>> Even better, it'd be cool if we could see the app get fixed. (Yes, I<br>
>>>>>>>> know<br>
>>>>>>>> that's not likely).<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> I think we are not in a position to refuse this workaround, or put<br>
>>>>>>> more precisely, to have a different behavior from everybody else. By<br>
>>>>>>> "we", I mean i965, radeonsi, svga. All closed drivers use abs. Many<br>
>>>>>>> Mesa drivers also use abs internally (r300, r600, nv30, nv50/nvc0).<br>
>>>>>>> This is not really a workaround for a specific application, even<br>
>>>>>>> though it's strongly motivated by that. It's a fix to align the few<br>
>>>>>>> remaining drivers with all others.<br>
>>>>>>><br>
>>>>>>> We talked with the publisher about this a very long time ago. While I<br>
>>>>>>> don't remember the details (Nicolai?), I think they refused to fix it<br>
>>>>>>> because radeonsi appeared to be the only driver not doing abs.<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> If I remember correctly, it wasn't so much a refusal as a lack of<br>
>>>>>> follow-through. They even had an option in their framework to add the<br>
>>>>>> abs(...) when translating shaders, but somehow didn't turn it on<br>
>>>>>> unconditionally for some reason...<br>
>>>>><br>
>>>>><br>
>>>>> VP even says so here:<br>
>>>>> <a href="https://github.com/virtual-programming/specops-linux/issues/20" rel="noreferrer" target="_blank">https://github.com/virtual-<wbr>programming/specops-linux/<wbr>issues/20</a><br>
>>>>><br>
>>>>> They recommend against patching mesa to do abs, though.<br>
>>>><br>
>>>><br>
>>>> We should still patch Mesa to align the behavior with closed drivers<br>
>>>> and gallium drivers like r600g and nouveau. In other words, it's too<br>
>>>> late to tell us not to patch Mesa, because r600g and nouveau have been<br>
>>>> "patched" since the beginning.<br>
>>>><br>
>>>> We only need to decide whether we should do it in the GLSL compiler or<br>
>>>> radeonsi, i.e. whether we should exclude i965 and svga.<br>
>>><br>
>>><br>
>>> I do agree with that.<br>
>><br>
>><br>
>> I tend to disagree but I've come to the conclusion that I won't stand in the<br>
>> way either. If both of the other desktop vendors do it and we've already<br>
>> decided that no implementation we care about will have its performance<br>
>> impacted, it seems like a valid spec-compliant thing to do. I would prefer<br>
>> it to be behind a driconf option, but if it's unconditional, oh well. My<br>
>> disagreement is mostly philosophical.<br>
>><br>
>> Over the last two years of working on Vulkan, I've been fighting broken<br>
>> tests and apps left and right. Vulkan has a huge amount of area where, if<br>
>> an app does something wrong, they get undefined behavior which is up to and<br>
>> including program termination. And basically all apps are broken in some<br>
>> way. Fortunately, the validation layers are finally starting to catch up to<br>
>> the point where I'm noticing very few bugs that the validation layers don't<br>
>> catch and things are getting into a better state. However, I've had more<br>
>> discussions than I can count with people where I have to explain to them<br>
>> that "No, the app is broken. It needs to be fixed. It's not my job to make<br>
>> it work." Once you start allowing brokenness, you can never stop allowing<br>
>> it and you paint yourself into a corner. Suddenly, you go to make a change,<br>
>> and your design decisions are not guided by the spec, they're guided by the<br>
>> spec *and* all of the broken apps that you have to keep working on your<br>
>> driver because you let something through.<br>
>><br>
>> In the world of GLES and OpenGL conformance, we fight the same fight. When<br>
>> people ask me how conformance is coming, I frequently answer with, "We've<br>
>> got a bunch of people fixing <insert test suite name here> so that our<br>
>> driver passes". It's not that mesa is particularly touchy, it's that a good<br>
>> chunk of the rest of the industry just hacks around everything inside their<br>
>> driver and doesn't bother to fix the tests. Sometimes the driver that<br>
>> passes the conformance suite isn't even the one they ship. If we're going<br>
>> to have a spec and hardware vendors (or the FOSS community) are going to<br>
>> implement it and apps are going to write to it, then we all need to agree on<br>
>> what it means and play by the rules. If an app doesn't play by the rules<br>
>> and does something with undefined behavior, then it's a broken app. If we<br>
>> say, "No, it's ok, you don't have to fix it. We'll just hack around it"<br>
>> we're enablers for their broken behavior and the broken behavior continues.<br>
>> In this particular case, we're dealing with a broken app. The only real<br>
>> issue is that all of the drivers that point out the issues were not drivers<br>
>> they tested on.<br>
>><br>
>> Another reason why I'm not a huge fan is that there is some momentum in the<br>
>> industry to make GLSL better defined with respect to NaN. I don't know that<br>
>> anything will ever come of it (because it may break apps) but if something<br>
>> does, we may find ourselves having to make SQRT and RSQ NaN-correct in the<br>
>> future and, hey look, it'll break apps.<br>
>><br>
>> Ok, rant over. Push it if you want. You can even put my nakked-by on it if<br>
>> you'd like. :-)<br>
><br>
> I agree with you completely, and I find it unfortunate too that we<br>
> have to add the workaround to GLSL or radeonsi to align its behavior<br>
> with closed drivers.<br>
<br>
</div></div>Just for reference, I just tested what NVIDIA does on Windows, and<br>
they *don't* seem to do inversesqrt(abs(x)) on my HW/driver.<br>
</blockquote></div><br></div><div class="gmail_extra">What about sqrt()? Do they do abs for one and not the other? Because that would be crazy but also possible.<br></div></div>