Skip to content

Commit

Permalink
sort the entries in the runtime parameter struct by type (#1575)
Browse files Browse the repository at this point in the history
this reduces padding a lot
  • Loading branch information
zingale authored May 30, 2024
1 parent 39cb2a4 commit 1667a38
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions util/build_scripts/write_probin.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,19 @@ def write_probin(param_files, out_file, cxx_prefix):

for nm in sorted(namespaces):
params_nm = [q for q in params if q.namespace == nm]
types = sorted(set(q.dtype for q in params_nm))

fout.write(f"struct {nm}_param_t {{\n")
for p in params_nm:
fout.write(p.get_struct_entry())
for tt in types:
params_type = [q for q in params_nm if q.dtype == tt]
for p in params_type:
fout.write(p.get_struct_entry())
fout.write("};\n\n")

# now the parent struct

fout.write(f"struct {cxx_base}_t {{\n")
for nm in namespaces:
for nm in sorted(namespaces):
fout.write(f" {nm}_param_t {nm};\n")
fout.write("};\n\n")

Expand Down

0 comments on commit 1667a38

Please sign in to comment.