r600: Make NIR the default shader IR

By default sb is disabled, to enable it one can
set
  R600_DEBUG=nirsb

TGSI can be enabled by using
  R600_DEBUG=use_tgsi

In this case "sb" will be enabled, but one can use
the TGSI backend without sb by setting

  R600_DEBUG=use_tgsi,sb

Closes: #6858

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18753>
This commit is contained in:
Gert Wollny 2022-09-16 16:32:33 +02:00 committed by Marge Bot
parent ad74cd3c3f
commit 6be7c2ef51
7 changed files with 11 additions and 18 deletions

View file

@ -2735,8 +2735,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx,
uint32_t *bytecode;
int i, j, r, fs_size;
struct r600_fetch_shader *shader;
unsigned no_sb = rctx->screen->b.debug_flags & DBG_NO_SB ||
(rctx->screen->b.debug_flags & DBG_NIR);
unsigned no_sb = rctx->screen->b.debug_flags & (DBG_NO_SB | DBG_NIR);
unsigned sb_disasm = !no_sb || (rctx->screen->b.debug_flags & DBG_SB_DISASM);
assert(count < 32);

View file

@ -245,8 +245,7 @@ fail:
}
static bool is_nir_enabled(struct r600_common_screen *screen) {
return (screen->debug_flags & DBG_NIR_PREFERRED); /* &&
screen->family >= CHIP_CEDAR);*/
return !(screen->debug_flags & DBG_USE_TGSI);
}
/*
@ -319,7 +318,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_NIR_ATOMICS_AS_DEREF:
return rscreen->b.debug_flags & DBG_NIR_PREFERRED;
return is_nir_enabled(&rscreen->b);
case PIPE_CAP_TEXTURE_TRANSFER_MODES:
return PIPE_TEXTURE_TRANSFER_BLIT;

View file

@ -270,8 +270,6 @@ struct r600_gs_rings_state {
#define DBG_NIR_SB (1 << 28)
#define DBG_USE_TGSI (1 << 29)
#define DBG_NIR_PREFERRED (DBG_NIR_SB | DBG_NIR)
struct r600_screen {
struct r600_common_screen b;
bool has_msaa;

View file

@ -775,10 +775,7 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen)
/* These flags affect shader compilation. */
uint64_t shader_debug_flags =
rscreen->debug_flags &
(DBG_NIR |
DBG_NIR_PREFERRED |
DBG_USE_TGSI);
rscreen->debug_flags & DBG_USE_TGSI;
rscreen->disk_shader_cache =
disk_cache_create(r600_get_family_name(rscreen),
@ -1392,7 +1389,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
nir_lower_dtrunc;
}
if (!(rscreen->debug_flags & DBG_NIR_PREFERRED)) {
if (rscreen->debug_flags & DBG_USE_TGSI) {
rscreen->nir_options.lower_fpow = false;
/* TGSI is vector, and NIR-to-TGSI doesn't like it when the

View file

@ -179,14 +179,15 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
pipe_shader_type_from_mesa(sel->nir->info.stage);
bool dump = r600_can_dump_shader(&rctx->screen->b, processor);
unsigned use_sb = !(rctx->screen->b.debug_flags & DBG_NO_SB) ||
unsigned use_sb = (rctx->screen->b.debug_flags & DBG_USE_TGSI &&
!(rctx->screen->b.debug_flags & DBG_NO_SB)) ||
(rctx->screen->b.debug_flags & DBG_NIR_SB);
unsigned sb_disasm;
unsigned export_shader;
shader->shader.bc.isa = rctx->isa;
if (!(rscreen->b.debug_flags & DBG_NIR_PREFERRED)) {
if (rscreen->b.debug_flags & DBG_USE_TGSI) {
assert(sel->ir_type == PIPE_SHADER_IR_TGSI);
r = r600_shader_from_tgsi(rctx, shader, key);
if (r) {
@ -223,7 +224,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
tgsi_dump(sel->tokens, 0);
}
if (rscreen->b.debug_flags & (DBG_NIR_PREFERRED)) {
if (!(rscreen->b.debug_flags & DBG_USE_TGSI)) {
fprintf(stderr, "--NIR --------------------------------------------------------\n");
nir_print_shader(sel->nir, stderr);
}

View file

@ -992,7 +992,7 @@ struct r600_pipe_shader_selector *r600_create_shader_state_tokens(struct pipe_co
} else if (ir == PIPE_SHADER_IR_NIR){
nir_shader *s = (nir_shader *)prog;
if (!(rscreen->b.debug_flags & DBG_NIR_PREFERRED)) {
if (rscreen->b.debug_flags & DBG_USE_TGSI) {
sel->tokens = (void *)nir_to_tgsi(s, ctx->screen);
ir = PIPE_SHADER_IR_TGSI;
tgsi_scan_shader(sel->tokens, &sel->info);

View file

@ -801,8 +801,7 @@ int r600_shader_from_nir(struct r600_context *rctx,
NIR_PASS_V(sh, nir_convert_from_ssa, true);
NIR_PASS_V(sh, nir_opt_dce);
if ((rctx->screen->b.debug_flags & DBG_NIR_PREFERRED) &&
(rctx->screen->b.debug_flags & DBG_ALL_SHADERS)) {
if (rctx->screen->b.debug_flags & DBG_ALL_SHADERS) {
fprintf(stderr, "-- NIR --------------------------------------------------------\n");
struct nir_function *func = (struct nir_function *)exec_list_get_head(&sh->functions);
nir_index_ssa_defs(func->impl);