Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new option for short names -- could potentially be useful generally #457

Merged
merged 5 commits into from
Aug 2, 2024

Conversation

msprotz
Copy link
Contributor

@msprotz msprotz commented Aug 2, 2024

This adds support for short names in monomorphized instances. For code that relies heavily on those (such as the code produced by the Eurydice frontend), this replaces a deterministic, pretty-printed name, such as libcrux_ml_kem_ind_cca_generate_keypair_unpacked__libcrux_ml_kem_vector_neon_vector_type_SIMD128Vector_libcrux_ml_kem_hash_functions_neon_Simd128Hash_3size_t_1152size_t_2400size_t_1184size_t_1152size_t_2size_t_128size_t, by the name of the generic function, followed by a hashcode of the instantiation function's type- and expression-level arguments, and produces this instead:

/**
A monomorphic instance of libcrux_ml_kem.ind_cca.generate_keypair_unpacked with
types libcrux_ml_kem_vector_neon_vector_type_SIMD128Vector,
libcrux_ml_kem_hash_functions_neon_Simd128Hash and with const generics:
- K = 2
- CPA_PRIVATE_KEY_SIZE = 768
- PRIVATE_KEY_SIZE = 1632
- PUBLIC_KEY_SIZE = 800
- BYTES_PER_RING_ELEMENT = 768
- ETA1 = 3
- ETA1_RANDOMNESS_SIZE = 192
*/
libcrux_ml_kem_ind_cca_unpacked_MlKemKeyPairUnpacked__libcrux_ml_kem_vector_neon_vector_type_SIMD128Vector__2size_t
libcrux_ml_kem_ind_cca_generate_keypair_unpacked_32

There could probably be similar improvements for type names.

@msprotz
Copy link
Contributor Author

msprotz commented Aug 2, 2024

This PR now does the same for type names, provided the short names option is activated. There's also a bonus feature in which tuples of a repeated single type t get pretty-printed as t_xN where N is the size of the tuple.

@msprotz msprotz merged commit fc56fce into master Aug 2, 2024
2 checks passed
@msprotz msprotz deleted the protz_misc branch August 2, 2024 19:41
@msprotz
Copy link
Contributor Author

msprotz commented Aug 2, 2024

(Got an everest green locally, which is not surprising since this is off by default)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant