diff options
author | Vadim Girlin <[email protected]> | 2013-04-23 10:34:00 +0400 |
---|---|---|
committer | Vadim Girlin <[email protected]> | 2013-04-30 21:50:47 +0400 |
commit | 188c893e65facb8826c58a6f0226b7508f2870fa (patch) | |
tree | e61b8f5385d154164b637cd70b3d8e0a4cb5692e /src/gallium/drivers | |
parent | ad1df471d083630106da8c39ec076f49e779e965 (diff) |
r600g/sb: use source bytecode in case of optimization errors
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_bc.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_context.cpp | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_core.cpp | 32 |
5 files changed, 25 insertions, 11 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 8f6d59b3e6a..4991fb28165 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -72,6 +72,7 @@ static const struct debug_named_value debug_options[] = { { "sbdry", DBG_SB_DRY_RUN, "Don't use optimized bytecode (just print the dumps)" }, { "sbstat", DBG_SB_STAT, "Print optimization statistics for shaders" }, { "sbdump", DBG_SB_DUMP, "Print IR dumps after some optimization passes" }, + { "sbnofallback", DBG_SB_NO_FALLBACK, "Abort on errors instead of fallback" }, DEBUG_NAMED_VALUE_END /* must be last */ }; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 322989a839d..61e2022a4a1 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -263,6 +263,7 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx, #define DBG_SB_DRY_RUN (1 << 23) #define DBG_SB_STAT (1 << 24) #define DBG_SB_DUMP (1 << 25) +#define DBG_SB_NO_FALLBACK (1 << 26) struct r600_tiling_info { unsigned num_channels; diff --git a/src/gallium/drivers/r600/sb/sb_bc.h b/src/gallium/drivers/r600/sb/sb_bc.h index be68f9fd925..459dcac13ce 100644 --- a/src/gallium/drivers/r600/sb/sb_bc.h +++ b/src/gallium/drivers/r600/sb/sb_bc.h @@ -478,6 +478,7 @@ public: static unsigned dump_stat; static unsigned dry_run; + static unsigned no_fallback; static unsigned dskip_start; static unsigned dskip_end; diff --git a/src/gallium/drivers/r600/sb/sb_context.cpp b/src/gallium/drivers/r600/sb/sb_context.cpp index 7a259828d08..034631376b5 100644 --- a/src/gallium/drivers/r600/sb/sb_context.cpp +++ b/src/gallium/drivers/r600/sb/sb_context.cpp @@ -31,6 +31,7 @@ namespace r600_sb { unsigned sb_context::dump_pass = 0; unsigned sb_context::dump_stat = 0; unsigned sb_context::dry_run = 0; +unsigned sb_context::no_fallback = 0; unsigned sb_context::dskip_start = 0; unsigned sb_context::dskip_end = 0; diff --git a/src/gallium/drivers/r600/sb/sb_core.cpp b/src/gallium/drivers/r600/sb/sb_core.cpp index aec838dcacb..bc200a4c9b6 100644 --- a/src/gallium/drivers/r600/sb/sb_core.cpp +++ b/src/gallium/drivers/r600/sb/sb_core.cpp @@ -65,6 +65,7 @@ sb_context *r600_sb_context_create(struct r600_context *rctx) { sb_context::dump_pass = df & DBG_SB_DUMP; sb_context::dump_stat = df & DBG_SB_STAT; sb_context::dry_run = df & DBG_SB_DRY_RUN; + sb_context::no_fallback = df & DBG_SB_NO_FALLBACK; sb_context::dskip_start = debug_get_num_option("R600_SB_DSKIP_START", 0); sb_context::dskip_end = debug_get_num_option("R600_SB_DSKIP_END", 0); @@ -96,6 +97,15 @@ int r600_sb_bytecode_process(struct r600_context *rctx, time_start = os_time_get_nano(); } + SB_DUMP_STAT( cerr << "\nsb: shader " << shader_id << "\n"; ); + + bc_parser parser(*ctx, bc, pshader, dump_source_bytecode, optimize); + + if ((r = parser.parse())) { + assert(0); + return r; + } + /* skip some shaders (use shaders from default backend) * dskip_start - range start, dskip_end - range_end, * e.g. start = 5, end = 6 means shaders 5 & 6 @@ -116,15 +126,6 @@ int r600_sb_bytecode_process(struct r600_context *rctx, } } - SB_DUMP_STAT( cerr << "\nsb: shader " << shader_id << "\n"; ); - - bc_parser parser(*ctx, bc, pshader, dump_source_bytecode, optimize); - - if ((r = parser.parse())) { - assert(0); - return r; - } - shader *sh = parser.get_shader(); SB_DUMP_PASS( cerr << "\n\n###### after parse\n"; sh->dump_ir(); ); @@ -136,8 +137,17 @@ int r600_sb_bytecode_process(struct r600_context *rctx, #define SB_RUN_PASS(n, dump) \ do { \ r = n(*sh).run(); \ + if (r) { \ + cerr << "sb: error (" << r << ") in the " << #n << " pass.\n"; \ + if (sb_context::no_fallback) \ + return r; \ + cerr << "sb: using unoptimized bytecode...\n"; \ + delete sh; \ + return 0; \ + } \ if (dump) { \ - SB_DUMP_PASS( cerr << "\n\n###### after " << #n << "\n"; sh->dump_ir();); \ + SB_DUMP_PASS( cerr << "\n\n###### after " << #n << "\n"; \ + sh->dump_ir();); \ } \ assert(!r); \ } while (0) @@ -175,7 +185,7 @@ int r600_sb_bytecode_process(struct r600_context *rctx, // container nodes in the correct locations for code placement sh->create_bbs(); - SB_RUN_PASS(gcm, 0); + SB_RUN_PASS(gcm, 1); sh->compute_interferences = true; SB_RUN_PASS(liveness, 0); |