[RFC PATCH v1 07/43] tcg: Increase maximum TB size and maximum temporaries

Anton Johansson via posted 43 patches 2 days, 13 hours ago
[RFC PATCH v1 07/43] tcg: Increase maximum TB size and maximum temporaries
Posted by Anton Johansson via 2 days, 13 hours ago
Doubles amount of space allocated for translation blocks.  This is
needed, particularly for Hexagon, where a single instruction packet may
consist of up to four vector instructions.  If each vector instruction
then gets expanded into gvec operations that utilize a small host vector
size the TB blows up quite quickly.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 include/tcg/tcg.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index d3e820568f..bd8cb9ff50 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -39,7 +39,7 @@
 /* XXX: make safe guess about sizes */
 #define MAX_OP_PER_INSTR 266
 
-#define CPU_TEMP_BUF_NLONGS 128
+#define CPU_TEMP_BUF_NLONGS 256
 #define TCG_STATIC_FRAME_SIZE  (CPU_TEMP_BUF_NLONGS * sizeof(long))
 
 #if TCG_TARGET_REG_BITS == 32
@@ -231,7 +231,7 @@ typedef struct TCGPool {
 
 #define TCG_POOL_CHUNK_SIZE 32768
 
-#define TCG_MAX_TEMPS 512
+#define TCG_MAX_TEMPS 1024
 #define TCG_MAX_INSNS 512
 
 /* when the size of the arguments of a called function is smaller than
-- 
2.45.2
Re: [RFC PATCH v1 07/43] tcg: Increase maximum TB size and maximum temporaries
Posted by Richard Henderson 20 hours ago
On 11/20/24 19:49, Anton Johansson wrote:
> Doubles amount of space allocated for translation blocks.  This is
> needed, particularly for Hexagon, where a single instruction packet may
> consist of up to four vector instructions.  If each vector instruction
> then gets expanded into gvec operations that utilize a small host vector
> size the TB blows up quite quickly.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>

I hope this is a performance modification only?
I hope that the normal set of "restart on resource overflow" code functioned correctly?
If you're overflowing these values with a single hexagon insn, then I suggest something is 
wrong.

> ---
>   include/tcg/tcg.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
> index d3e820568f..bd8cb9ff50 100644
> --- a/include/tcg/tcg.h
> +++ b/include/tcg/tcg.h
> @@ -39,7 +39,7 @@
>   /* XXX: make safe guess about sizes */
>   #define MAX_OP_PER_INSTR 266
>   
> -#define CPU_TEMP_BUF_NLONGS 128
> +#define CPU_TEMP_BUF_NLONGS 256
>   #define TCG_STATIC_FRAME_SIZE  (CPU_TEMP_BUF_NLONGS * sizeof(long))

Changing this probably requires auditing all tcg/arch/ backends.  The various prologue 
generation code *ought* to catch out of range values, but I bet we weren't that careful.


r~

>   
>   #if TCG_TARGET_REG_BITS == 32
> @@ -231,7 +231,7 @@ typedef struct TCGPool {
>   
>   #define TCG_POOL_CHUNK_SIZE 32768
>   
> -#define TCG_MAX_TEMPS 512
> +#define TCG_MAX_TEMPS 1024
>   #define TCG_MAX_INSNS 512
>   
>   /* when the size of the arguments of a called function is smaller than