6 ms·
An attribute for functions that says "no optimisations may be applied to the body that would change timings" seems like a reasonable level of granularity here,
by mst 2y ago
An attribute for functions that says "no optimisations may be applied to the body that would change timings" seems like a reasonable level of granularity here, and if you were conservative about which optimisations it allowed in version zero it'd probably not be a vast amount of work.
I'm sort of reminded of the software people vs. hardware people stuff in embedded work, where ideally you'd have people around who'd crossed over from one to another but (comparing to crypto authors and compiler authors) there's enough of a cultural disconnect between the two groups that it doesn't happen as often as one might prefer.
- saalweachter 2y agoWhy not just specify "all branches of this code must execute in the same amount of time", and let the compiler figure it out for the architecture being compiled for?
- davrosthedalek 2y agoInstruction duration isn't constant even within the same arch. You cannot have branches in constant-time code. I do wonder though how often cpu instructions have data-dependent execution times....
- davrosthedalek 2y ago(Correction: You cannot have data-dependent branches. You can of course have branches to make a fixed-iterations for loop, for example)