Committed: ca3cdf95748

Thanks Kyrill!

On 10 Feb 2026, at 3:40 PM, Kyrylo Tkachov <[email protected]> wrote:

Hi Soumya,

On 10 Feb 2026, at 11:08, Soumya AR <[email protected]> wrote:

This patch fixes the following bugs:

1) For SVE vector costs [sve_vec_cost], the JSON schema did not list the
inherited members from the base structure, only the SVE specific ones. Updated
the schema to include all the members and regenerated the printing/parsing
routines.

2) If someone uses -fdump-tuning-model with mcpu=olympus, it will have the flag
for dispatch scheduling enabled. Then, if someone uses that dump against any
-mcpu other than olympus for tuning, it will ICE as we enable dispatch 
scheduling
but don't provide the data. Updated this to clear the flag if
dispatch_constraints is NULL.


Looks straightforward to me.
Ok if no objections in 24 hours.
Thanks,
Kyrill

Signed-off-by: Soumya AR <[email protected]>

gcc/ChangeLog:

* config/aarch64/aarch64-json-schema.h: Include inherited members for
SVE vector costs.
* config/aarch64/aarch64-json-tunings-parser-generated.inc
(parse_vec_costs_sve): Regenerate.
* config/aarch64/aarch64-json-tunings-parser.cc
(aarch64_load_tuning_params_from_json_string): Clear dispatch scheduling
flag if dispatch_constraints is NULL.
* config/aarch64/aarch64-json-tunings-printer-generated.inc
(serialize_vec_costs_sve): Regenerate.
---
gcc/config/aarch64/aarch64-json-schema.h      | 20 +++++++++++++++++++
.../aarch64-json-tunings-parser-generated.inc | 20 +++++++++++++++++++
.../aarch64/aarch64-json-tunings-parser.cc    | 14 +++++++++++++
...aarch64-json-tunings-printer-generated.inc | 20 +++++++++++++++++++
4 files changed, 74 insertions(+)

diff --git a/gcc/config/aarch64/aarch64-json-schema.h 
b/gcc/config/aarch64/aarch64-json-schema.h
index 32fb39300fe..9b6c5478d15 100644
--- a/gcc/config/aarch64/aarch64-json-schema.h
+++ b/gcc/config/aarch64/aarch64-json-schema.h
@@ -176,6 +176,26 @@ static const char *schema_json = R"json(
"store_cost": "int"
     },
     "sve": {
+ "int_stmt_cost": "int",
+ "fp_stmt_cost": "int",
+ "ld2_st2_permute_cost": "int",
+ "ld3_st3_permute_cost": "int",
+ "ld4_st4_permute_cost": "int",
+ "permute_cost": "int",
+ "reduc_i8_cost": "int",
+ "reduc_i16_cost": "int",
+ "reduc_i32_cost": "int",
+ "reduc_i64_cost": "int",
+ "reduc_f16_cost": "int",
+ "reduc_f32_cost": "int",
+ "reduc_f64_cost": "int",
+ "store_elt_extra_cost": "int",
+ "vec_to_scalar_cost": "int",
+ "scalar_to_vec_cost": "int",
+ "align_load_cost": "int",
+ "unalign_load_cost": "int",
+ "unalign_store_cost": "int",
+ "store_cost": "int",
"clast_cost": "int",
"fadda_f16_cost": "int",
"fadda_f32_cost": "int",
diff --git a/gcc/config/aarch64/aarch64-json-tunings-parser-generated.inc 
b/gcc/config/aarch64/aarch64-json-tunings-parser-generated.inc
index 882d8f79975..7943dea6ece 100644
--- a/gcc/config/aarch64/aarch64-json-tunings-parser-generated.inc
+++ b/gcc/config/aarch64/aarch64-json-tunings-parser-generated.inc
@@ -175,6 +175,26 @@ template <typename T>
static void
parse_vec_costs_sve (const json::object *jo, T &sve)
{
+  PARSE_INTEGER_FIELD (jo, "int_stmt_cost", sve.int_stmt_cost);
+  PARSE_INTEGER_FIELD (jo, "fp_stmt_cost", sve.fp_stmt_cost);
+  PARSE_INTEGER_FIELD (jo, "ld2_st2_permute_cost", sve.ld2_st2_permute_cost);
+  PARSE_INTEGER_FIELD (jo, "ld3_st3_permute_cost", sve.ld3_st3_permute_cost);
+  PARSE_INTEGER_FIELD (jo, "ld4_st4_permute_cost", sve.ld4_st4_permute_cost);
+  PARSE_INTEGER_FIELD (jo, "permute_cost", sve.permute_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_i8_cost", sve.reduc_i8_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_i16_cost", sve.reduc_i16_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_i32_cost", sve.reduc_i32_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_i64_cost", sve.reduc_i64_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_f16_cost", sve.reduc_f16_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_f32_cost", sve.reduc_f32_cost);
+  PARSE_INTEGER_FIELD (jo, "reduc_f64_cost", sve.reduc_f64_cost);
+  PARSE_INTEGER_FIELD (jo, "store_elt_extra_cost", sve.store_elt_extra_cost);
+  PARSE_INTEGER_FIELD (jo, "vec_to_scalar_cost", sve.vec_to_scalar_cost);
+  PARSE_INTEGER_FIELD (jo, "scalar_to_vec_cost", sve.scalar_to_vec_cost);
+  PARSE_INTEGER_FIELD (jo, "align_load_cost", sve.align_load_cost);
+  PARSE_INTEGER_FIELD (jo, "unalign_load_cost", sve.unalign_load_cost);
+  PARSE_INTEGER_FIELD (jo, "unalign_store_cost", sve.unalign_store_cost);
+  PARSE_INTEGER_FIELD (jo, "store_cost", sve.store_cost);
 PARSE_INTEGER_FIELD (jo, "clast_cost", sve.clast_cost);
 PARSE_INTEGER_FIELD (jo, "fadda_f16_cost", sve.fadda_f16_cost);
 PARSE_INTEGER_FIELD (jo, "fadda_f32_cost", sve.fadda_f32_cost);
diff --git a/gcc/config/aarch64/aarch64-json-tunings-parser.cc 
b/gcc/config/aarch64/aarch64-json-tunings-parser.cc
index 59c745e347e..9b7bdf535c9 100644
--- a/gcc/config/aarch64/aarch64-json-tunings-parser.cc
+++ b/gcc/config/aarch64/aarch64-json-tunings-parser.cc
@@ -496,6 +496,20 @@ aarch64_load_tuning_params_from_json_string (const char 
*json_string,
   }

 parse_tunings (jo, *tune);
+
+  /* dispatch_constraints are not represented in JSON tunings.  If the JSON
+     sets DISPATCH_SCHED in extra_tuning_flags but the base model does not
+     provide dispatch_constraints, clear the flag to avoid an assertion
+     failure later.  */
+  if ((tune->extra_tuning_flags & AARCH64_EXTRA_TUNE_DISPATCH_SCHED)
+      && tune->dispatch_constraints == nullptr)
+    {
+      warning (0, "JSON tuning enables dispatch scheduling but "
+       "%<dispatch_constraints%> is not available; "
+       "disabling dispatch scheduling");
+      tune->extra_tuning_flags &= ~AARCH64_EXTRA_TUNE_DISPATCH_SCHED;
+    }
+
 return;
}

diff --git a/gcc/config/aarch64/aarch64-json-tunings-printer-generated.inc 
b/gcc/config/aarch64/aarch64-json-tunings-printer-generated.inc
index 498be96ff33..e619a39749d 100644
--- a/gcc/config/aarch64/aarch64-json-tunings-printer-generated.inc
+++ b/gcc/config/aarch64/aarch64-json-tunings-printer-generated.inc
@@ -209,6 +209,26 @@ serialize_vec_costs_sve (const T &sve)
{
 auto sve_obj = std::make_unique<json::object> ();

+  SERIALIZE_INTEGER_FIELD (sve_obj, "int_stmt_cost", sve.int_stmt_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "fp_stmt_cost", sve.fp_stmt_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "ld2_st2_permute_cost", 
sve.ld2_st2_permute_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "ld3_st3_permute_cost", 
sve.ld3_st3_permute_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "ld4_st4_permute_cost", 
sve.ld4_st4_permute_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "permute_cost", sve.permute_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_i8_cost", sve.reduc_i8_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_i16_cost", sve.reduc_i16_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_i32_cost", sve.reduc_i32_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_i64_cost", sve.reduc_i64_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_f16_cost", sve.reduc_f16_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_f32_cost", sve.reduc_f32_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "reduc_f64_cost", sve.reduc_f64_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "store_elt_extra_cost", 
sve.store_elt_extra_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "vec_to_scalar_cost", 
sve.vec_to_scalar_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "scalar_to_vec_cost", 
sve.scalar_to_vec_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "align_load_cost", sve.align_load_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "unalign_load_cost", 
sve.unalign_load_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "unalign_store_cost", 
sve.unalign_store_cost);
+  SERIALIZE_INTEGER_FIELD (sve_obj, "store_cost", sve.store_cost);
 SERIALIZE_INTEGER_FIELD (sve_obj, "clast_cost", sve.clast_cost);
 SERIALIZE_INTEGER_FIELD (sve_obj, "fadda_f16_cost", sve.fadda_f16_cost);
 SERIALIZE_INTEGER_FIELD (sve_obj, "fadda_f32_cost", sve.fadda_f32_cost);
--
2.43.0

Reply via email to