Originally posted by Serafean
View Post
Announcement
Collapse
No announcement yet.
The Difference In Optimizations Between NIR & GLSL
Collapse
X
-
-
Originally posted by toyotabedzrock View Post(x*x)*(x*x) is not as efficient as it could be. It would be better to do
y = x*x
y = y*y
Either way it has to make two trips threw the GPU but the second way uses fewer registers and compute resources.
Also, it would have definitely been possible to have the GLSL pass be on one line... we just didn't bother porting the Python framework that autogenerates these optimizations to GLSL IR. The real significance is that the NIR version will catch cases where the GLSL IR one wouldn't, thanks to SSA.
Comment
-
Originally posted by smitty3268 View PostYeah, they aren't.
I mean, you could say that TGSI is like a serialized form of NIR, and that would be sort of correct on an abstract level. But practically they aren't the same at all, and neither is SPIR-V.
Comment
-
Originally posted by Ericg View PostIts not definitive yet whether Vulkan will fully supplant OpenGL. Vulkan may end up being used when maximum performance is necessary, and OpenGL being used whenever its not performance-critical. It takes a lot to get Vulkan up off of the ground for a program. Rendering a triangle in OpenGL was something like 60 lines of code, with Vulkan being 600 or so.
Comment
-
Originally posted by cwabbott View PostNo, they're actually rather similar, or at least the graphics-oriented subset of SPIR-V is. They're both SSA-based, have native support for graphics things like texturing, and do I/O through reading/writing variables. Please tell me how they're different.
The purposes of SPIR-V and NIR are completely different. COMPLETELY different. And I think it was very clear that the original poster here didn't understand that and was trying to draw some kind of direct line between the two that doesn't exist. NIR was not created based on SPIR-V specs. SPIR-V wasn't created based on NIR specs. The two are just similar because they both try to expose what GPU hardware can do.Last edited by smitty3268; 26 April 2015, 08:50 PM.
Comment
-
Originally posted by smitty3268 View PostI agree that if you are arguing they are abstractly similar, then sure, in the same way any serialization format would be similar to an in-memory IR. But you could say the same thing about TGSI (if it had an extra pass to turn it into SSA form, something that was discussed in the past, for example).
The purposes of SPIR-V and NIR are completely different. COMPLETELY different. And I think it was very clear that the original poster here didn't understand that and was trying to draw some kind of direct line between the two that doesn't exist. NIR was not created based on SPIR-V specs. SPIR-V wasn't created based on NIR specs. The two are just similar because they both try to expose what GPU hardware can do.
Comment
-
See, we are clearly looking at this from 2 very different angles. Because when i look at
Originally posted by cwabbott View PostAside from not supporting SSA, TGSI is also completely typeless and turns everything into a single flat array of virtual registers, when SPIR-V doesn't do this -- NIR also has registers, but they're meant to be used at the very end to help the driver optimize index expressions (and avoid having the backend deal with variables directly).
Then i look at
Right, they weren't created by the same people, they aren't based on one another, and one is a serialized format whereas another is designed for actual optimizations...
You obviously wrote a lot of those implementation details in NIR which i think is why you are focusing on them. I suppose both are valid, they are just different ways of looking at the same information.Last edited by smitty3268; 29 April 2015, 03:21 AM.
Comment
Comment