nir: Switch from ralloc to malloc for NIR instructions.

By replacing the 48-byte ralloc header with our exec_node gc_node (16
bytes), runtime of shader-db on my system across this series drops
-4.21738% +/- 1.47757% (n=5).

Inspired by discussion on #5034.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11776>
This commit is contained in:
Emma Anholt
2021-07-07 10:30:05 -07:00
committed by Marge Bot
parent feee5e6974
commit 879a569884
8 changed files with 84 additions and 38 deletions
+2 -2
View File
@@ -550,7 +550,7 @@ read_src(read_ctx *ctx, nir_src *src, void *mem_ctx)
src->reg.reg = read_lookup_object(ctx, header.any.object_idx);
src->reg.base_offset = blob_read_uint32(ctx->blob);
if (header.any.is_indirect) {
src->reg.indirect = ralloc(mem_ctx, nir_src);
src->reg.indirect = malloc(sizeof(nir_src));
read_src(ctx, src->reg.indirect, mem_ctx);
} else {
src->reg.indirect = NULL;
@@ -770,7 +770,7 @@ read_dest(read_ctx *ctx, nir_dest *dst, nir_instr *instr,
dst->reg.reg = read_object(ctx);
dst->reg.base_offset = blob_read_uint32(ctx->blob);
if (dest.reg.is_indirect) {
dst->reg.indirect = ralloc(instr, nir_src);
dst->reg.indirect = malloc(sizeof(nir_src));
read_src(ctx, dst->reg.indirect, instr);
}
}