Skip to content

nir-to-tgsi, and use it in softpipe

Emma Anholt requested to merge anholt/mesa:nir-to-tgsi into master

Here we go: A translation layer from NIR to TGSI so that we can some day delete src/mesa/state_tracker/st_glsl_to_tgsi.cpp and its related infrastructure (10k or more LOC), plus hopefully a bunch of GLSL IR optimizations once everyone's going through NIR. It may also be immediately useful for other TGSI-consuming drivers, as I've seen it reduce instruction count massively in compute, geometry, and UBO-loading shaders, but even a bit in trivial texturing shaders like glmark2!

Note that these dependencies should be reviewed in their own MRs:

TODO:

  • Fix regressions not present in other NIR drivers
    • splitting 64-bit vec3/4 NIR registers for temp arrays
    • vs-fs-array-dvec3.shader_test
    • point-line-no-cull
    • gs-fs-vs-double
    • fs-array-of-structs-std140-indirect
    • arb_vertex_attrib_64bit-overlapping-locations
    • vs-test-attrib-location
    • dEQP-GLES31.functional.primitive_bounding_box.wide_points.global_state.vertex_geometry_fragment.fbo_bbox_larger starts crashing depending on various bits of state (previous tests run before it, presence of valgrind, presence of glib's memcheck). Doesn't seem really NTT-specific, added to flakes list with other GS flakes.
  • Land !6363 (merged) so we don't NIR validation fail in fs-vec4-out-of-bounds-[16].
  • Free temps as their last uses occur to stay under TGSI_EXEC_NUM_TEMPS
  • Release regs' temporaries at the end of their live intervals to reduce max temps
  • Move the any/all equality lowering from algebraic to nir_lower_alu for better codegen quality.
  • make texcoord setup skip no-op moves when there's no comparator/lod/etc.
  • benchmark softpipe on glmark2 or something
  • Add more reladdr support?
  • Do shader-db for softpipe to show that this is an overall TGSI instruction count win
  • Maybe enable the NIR vectorizer conditional on shader-db wins

but actually I feel like this is good enough to merge as is given the shader-db stats and softpipe performance stats.

Edited by Emma Anholt

Merge request reports