On Tue, Jun 13, 2017 at 5:18 AM, Michel Dänzer <mic...@daenzer.net> wrote: > On 13/06/17 01:31 AM, Marek Olšák wrote: >> From: Marek Olšák <marek.ol...@amd.com> >> >> --- >> src/gallium/auxiliary/util/u_threaded_context.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/src/gallium/auxiliary/util/u_threaded_context.c >> b/src/gallium/auxiliary/util/u_threaded_context.c >> index 3038fc6..a97f016 100644 >> --- a/src/gallium/auxiliary/util/u_threaded_context.c >> +++ b/src/gallium/auxiliary/util/u_threaded_context.c >> @@ -195,22 +195,27 @@ _tc_sync(struct threaded_context *tc, const char >> *info, const char *func) >> >> tc_debug_check(tc); >> } >> >> #define tc_sync(tc) _tc_sync(tc, "", __func__) >> #define tc_sync_msg(tc, info) _tc_sync(tc, info, __func__) >> >> static void >> tc_set_resource_reference(struct pipe_resource **dst, struct pipe_resource >> *src) >> { >> - *dst = NULL; >> - pipe_resource_reference(dst, src); >> + /* Unexpectedly, pipe_resource_reference is a bottleneck here, taking >> 3.7% >> + * of CPU time in a state-heavy microbenchmark. The problem here is that >> + * pipe_resource_reference isn't inlined here. >> + */ >> + *dst = src; >> + if (src) >> + p_atomic_inc(&src->reference.count); >> } > > That's pretty ugly. Does the attached patch help as well? It allows > pipe_resource_reference to be inlined again, and has a pretty dramatic > effect on the size of the generated code for me: > > text data bss dec hex filename > 42586 512 0 43098 a85a u_threaded_context.o > 35282 512 0 35794 8bd2 u_threaded_context.o.patched > > text data bss dec hex filename > 10434626 271176 2062272 12768074 c2d34a /tmp/radeonsi_dri.so > 10001218 271176 2062272 12334666 bc364a > /tmp/radeonsi_dri.so.patched > > > It might also help for other pipe_resource_reference callers.
Yes, the patch helps. Marek > > > -- > Earthling Michel Dänzer | http://www.amd.com > Libre software enthusiast | Mesa and X developer _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev