diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-01-28 23:51:19 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-01-30 02:07:12 +0100 |
commit | 29c1f67e9f166da4393493d213ee06498aecac51 (patch) | |
tree | 40cd0d0c313c3a8eca671bea0671b2aacfe9919a /src/amd/common/ac_binary.c | |
parent | d115b67712d6db1eff9d3a4bb57a585c0158be74 (diff) |
radv/ac: Add compiler support for spilling.
Based on code written by Dave Airlie.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/common/ac_binary.c')
-rw-r--r-- | src/amd/common/ac_binary.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/amd/common/ac_binary.c b/src/amd/common/ac_binary.c index 01cf000d9be..9c66a821c21 100644 --- a/src/amd/common/ac_binary.c +++ b/src/amd/common/ac_binary.c @@ -212,23 +212,28 @@ static const char *scratch_rsrc_dword1_symbol = void ac_shader_binary_read_config(struct ac_shader_binary *binary, struct ac_shader_config *conf, - unsigned symbol_offset) + unsigned symbol_offset, + bool supports_spill) { unsigned i; const unsigned char *config = ac_shader_binary_config_start(binary, symbol_offset); bool really_needs_scratch = false; - + uint32_t wavesize = 0; /* LLVM adds SGPR spills to the scratch size. * Find out if we really need the scratch buffer. */ - for (i = 0; i < binary->reloc_count; i++) { - const struct ac_shader_reloc *reloc = &binary->relocs[i]; + if (supports_spill) { + really_needs_scratch = true; + } else { + for (i = 0; i < binary->reloc_count; i++) { + const struct ac_shader_reloc *reloc = &binary->relocs[i]; - if (!strcmp(scratch_rsrc_dword0_symbol, reloc->name) || - !strcmp(scratch_rsrc_dword1_symbol, reloc->name)) { - really_needs_scratch = true; - break; + if (!strcmp(scratch_rsrc_dword0_symbol, reloc->name) || + !strcmp(scratch_rsrc_dword1_symbol, reloc->name)) { + really_needs_scratch = true; + break; + } } } @@ -259,9 +264,7 @@ void ac_shader_binary_read_config(struct ac_shader_binary *binary, case R_0286E8_SPI_TMPRING_SIZE: case R_00B860_COMPUTE_TMPRING_SIZE: /* WAVESIZE is in units of 256 dwords. */ - if (really_needs_scratch) - conf->scratch_bytes_per_wave = - G_00B860_WAVESIZE(value) * 256 * 4; + wavesize = value; break; case SPILLED_SGPRS: conf->spilled_sgprs = value; @@ -285,4 +288,9 @@ void ac_shader_binary_read_config(struct ac_shader_binary *binary, if (!conf->spi_ps_input_addr) conf->spi_ps_input_addr = conf->spi_ps_input_ena; } + + if (really_needs_scratch) { + /* sgprs spills aren't spilling */ + conf->scratch_bytes_per_wave = G_00B860_WAVESIZE(wavesize) * 256 * 4; + } } |