From d907c3f4133d82afa2e3543e0bfa766cc3b034bf Mon Sep 17 00:00:00 2001 From: Krzysztof Filipek Date: Mon, 6 Oct 2025 14:35:29 +0200 Subject: [PATCH] [scripts] Persist ur_function_t max ID in registry generation --- unified-runtime/scripts/core/registry.yml | 1 + unified-runtime/scripts/generate_ids.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/unified-runtime/scripts/core/registry.yml b/unified-runtime/scripts/core/registry.yml index a6237d93bf5ce..baefa0ad0903d 100644 --- a/unified-runtime/scripts/core/registry.yml +++ b/unified-runtime/scripts/core/registry.yml @@ -670,6 +670,7 @@ etors: - name: BINDLESS_IMAGES_SUPPORTS_IMPORTING_HANDLE_TYPE_EXP desc: Enumerator for $xBindlessImagesSupportsImportingHandleTypeExp value: '288' +max_id: '288' --- type: enum desc: Defines structure types diff --git a/unified-runtime/scripts/generate_ids.py b/unified-runtime/scripts/generate_ids.py index eed9066f4c503..c8bceb5c43cde 100644 --- a/unified-runtime/scripts/generate_ids.py +++ b/unified-runtime/scripts/generate_ids.py @@ -64,6 +64,14 @@ def generate_function_type( etor["name"]: etor["value"] for etor in existing_function_type["etors"] } max_etor = get_max_enum(existing_function_type) + stored_max_etor = existing_function_type.get("max_id") + try: + stored_max_etor = int(stored_max_etor) if stored_max_etor is not None else None + except ValueError: + stored_max_etor = None + persistent_max = ( + max_etor if stored_max_etor is None else max(max_etor, stored_max_etor) + ) functions = [ obj for s in specs for obj in s["objects"] if obj["type"] == "function" ] @@ -73,8 +81,8 @@ def generate_function_type( etor_name = "$X_FUNCTION_" + util.to_snake_case(fname).upper() id = existing_etors.get(etor_name) if id is None: - max_etor += 1 - id = max_etor + persistent_max += 1 + id = persistent_max entry = { "name": etor_name, "desc": f"Enumerator for $x{fname}", @@ -85,6 +93,7 @@ def generate_function_type( registry.append(entry) registry = sorted(registry, key=lambda x: int(x["value"])) existing_function_type["etors"] = registry + existing_function_type["max_id"] = str(persistent_max) update_fn(existing_function_type, meta) ## create a copy to write back to registry.yml