Skip to content

Commit d907c3f

Browse files
committed
[scripts] Persist ur_function_t max ID in registry generation
1 parent 91653ad commit d907c3f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

unified-runtime/scripts/core/registry.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ etors:
670670
- name: BINDLESS_IMAGES_SUPPORTS_IMPORTING_HANDLE_TYPE_EXP
671671
desc: Enumerator for $xBindlessImagesSupportsImportingHandleTypeExp
672672
value: '288'
673+
max_id: '288'
673674
---
674675
type: enum
675676
desc: Defines structure types

unified-runtime/scripts/generate_ids.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ def generate_function_type(
6464
etor["name"]: etor["value"] for etor in existing_function_type["etors"]
6565
}
6666
max_etor = get_max_enum(existing_function_type)
67+
stored_max_etor = existing_function_type.get("max_id")
68+
try:
69+
stored_max_etor = int(stored_max_etor) if stored_max_etor is not None else None
70+
except ValueError:
71+
stored_max_etor = None
72+
persistent_max = (
73+
max_etor if stored_max_etor is None else max(max_etor, stored_max_etor)
74+
)
6775
functions = [
6876
obj for s in specs for obj in s["objects"] if obj["type"] == "function"
6977
]
@@ -73,8 +81,8 @@ def generate_function_type(
7381
etor_name = "$X_FUNCTION_" + util.to_snake_case(fname).upper()
7482
id = existing_etors.get(etor_name)
7583
if id is None:
76-
max_etor += 1
77-
id = max_etor
84+
persistent_max += 1
85+
id = persistent_max
7886
entry = {
7987
"name": etor_name,
8088
"desc": f"Enumerator for $x{fname}",
@@ -85,6 +93,7 @@ def generate_function_type(
8593
registry.append(entry)
8694
registry = sorted(registry, key=lambda x: int(x["value"]))
8795
existing_function_type["etors"] = registry
96+
existing_function_type["max_id"] = str(persistent_max)
8897
update_fn(existing_function_type, meta)
8998

9099
## create a copy to write back to registry.yml

0 commit comments

Comments
 (0)