Skip to content

Commit 9038945

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

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ 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 = max_etor if stored_max_etor is None else max(max_etor, stored_max_etor)
6773
functions = [
6874
obj for s in specs for obj in s["objects"] if obj["type"] == "function"
6975
]
@@ -73,8 +79,8 @@ def generate_function_type(
7379
etor_name = "$X_FUNCTION_" + util.to_snake_case(fname).upper()
7480
id = existing_etors.get(etor_name)
7581
if id is None:
76-
max_etor += 1
77-
id = max_etor
82+
persistent_max += 1
83+
id = persistent_max
7884
entry = {
7985
"name": etor_name,
8086
"desc": f"Enumerator for $x{fname}",
@@ -85,6 +91,7 @@ def generate_function_type(
8591
registry.append(entry)
8692
registry = sorted(registry, key=lambda x: int(x["value"]))
8793
existing_function_type["etors"] = registry
94+
existing_function_type["max_id"] = str(persistent_max)
8895
update_fn(existing_function_type, meta)
8996

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

0 commit comments

Comments
 (0)