r600: Use nir-to-tgsi instead of TGSI when the NIR debug opt is disabled.
For !8044 I'm working on getting all drivers to accept NIR. The NIR compiler in the driver is apparently not quite ready, so use NIR-to-TGSI instead. This is a net win in testcases working on my RV770 and Turks cards (especially in some important piglit tests involving YUV dma-buf decode), though it's not regression-free. shader-db (R600): total dw in shared programs: 8553412 -> 8358918 (-2.27%) dw in affected programs: 7476702 -> 7282208 (-2.60%) total gprs in shared programs: 217286 -> 213217 (-1.87%) gprs in affected programs: 72747 -> 68678 (-5.59%) total loops in shared programs: 398 -> 330 (-17.09%) loops in affected programs: 68 -> 0 total cf in shared programs: 558835 -> 332768 (-40.45%) cf in affected programs: 420475 -> 194408 (-53.76%) shader-db (Turks): total dw in shared programs: 14104598 -> 13556782 (-3.88%) dw in affected programs: 12161972 -> 11614156 (-4.50%) total gprs in shared programs: 321068 -> 313690 (-2.30%) gprs in affected programs: 114899 -> 107521 (-6.42%) total loops in shared programs: 736 -> 651 (-11.55%) loops in affected programs: 111 -> 26 (-76.58%) total cf in shared programs: 925771 -> 581226 (-37.22%) cf in affected programs: 678600 -> 334055 (-50.77%) total stack in shared programs: 27853 -> 27855 (<.01%) stack in affected programs: 5 -> 7 (40.00%) glmark2 terrain: 0.137649% +/- 0.0511938% (n=6) glmark2 jellyfish: no change (n=8) unigine valley (extreme) 5.36 -> 5.45 (n=1 it takes so long to run) unigine heaven (basic) 16.13 -> 16.15 (n=1) Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14319>
This commit is contained in:
@@ -691,6 +691,7 @@ static const struct debug_named_value common_debug_options[] = {
|
||||
{ "tes", DBG_TES, "Print tessellation evaluation shaders" },
|
||||
{ "preoptir", DBG_PREOPT_IR, "Print the LLVM IR before initial optimizations" },
|
||||
{ "checkir", DBG_CHECK_IR, "Enable additional sanity checks on shader IR" },
|
||||
{ "use_tgsi", DBG_USE_TGSI, "Take TGSI directly instead of using NIR-to-TGSI"},
|
||||
|
||||
{ "testdma", DBG_TEST_DMA, "Invoke SDMA tests and exit." },
|
||||
{ "testvmfaultcp", DBG_TEST_VMFAULT_CP, "Invoke a CP VM fault test and exit." },
|
||||
@@ -776,7 +777,8 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen)
|
||||
uint64_t shader_debug_flags =
|
||||
rscreen->debug_flags &
|
||||
(DBG_NIR |
|
||||
DBG_NIR_PREFERRED);
|
||||
DBG_NIR_PREFERRED |
|
||||
DBG_USE_TGSI);
|
||||
|
||||
rscreen->disk_shader_cache =
|
||||
disk_cache_create(r600_get_family_name(rscreen),
|
||||
@@ -1361,6 +1363,34 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
|
||||
|
||||
rscreen->nir_options = nir_options;
|
||||
|
||||
if (rscreen->info.chip_class < EVERGREEN) {
|
||||
/* Pre-EG doesn't have these ALU ops */
|
||||
rscreen->nir_options.lower_bit_count = true;
|
||||
rscreen->nir_options.lower_bitfield_reverse = true;
|
||||
}
|
||||
|
||||
if (!(rscreen->debug_flags & DBG_NIR_PREFERRED)) {
|
||||
/* TGSI is vector, and NIR-to-TGSI doesn't like it when the
|
||||
* input vars have been scalarized.
|
||||
*/
|
||||
rscreen->nir_options.lower_to_scalar = false;
|
||||
|
||||
/* NIR-to-TGSI can't do fused integer csel, and it can't just
|
||||
* override the flag and get the code lowered back when we ask
|
||||
* it to handle it.
|
||||
*/
|
||||
rscreen->nir_options.has_fused_comp_and_csel = false;
|
||||
|
||||
/* r600 has a bitfield_select and bitfield_extract opcode
|
||||
* (called bfi/bfe), but TGSI's BFI/BFE isn't that.
|
||||
*/
|
||||
rscreen->nir_options.lower_bitfield_extract = false;
|
||||
rscreen->nir_options.lower_bitfield_insert_to_bitfield_select = false;
|
||||
|
||||
/* TGSI's ifind is reversed from ours, keep it the TGSI way. */
|
||||
rscreen->nir_options.lower_find_msb_to_reverse = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user