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

Save benchmark function interface, validate parameters #3

Closed
5 tasks done
nicholasjng opened this issue Jan 17, 2024 · 0 comments
Closed
5 tasks done

Save benchmark function interface, validate parameters #3

nicholasjng opened this issue Jan 17, 2024 · 0 comments
Assignees

Comments

@nicholasjng
Copy link
Collaborator

nicholasjng commented Jan 17, 2024

Currently we are overwriting the parameters for the benchmark passed in BenchmarkRunner.run() with the params slot saved on the benchmark. This is not thought through entirely, and needs changing.

Points to consider:

  • Removeparams on the Benchmark class as a separate slot. All default values can be given either as variable defaults in the benchmark signature, or via params in BenchmarkRunner.run(). (Remove benchmark params slot, type core decorators #15)
  • We need to warn (logging) on param<->default value collision to prevent confusion. (Add warning for supplied and default parameter collision #19)
  • We should think of validating the interface typing against the passed parameters, and warn/error on mismatches. (Add Interface-checks #12)
  • In this sense, we can also warn if the benchmark function interface is partially/entirely untyped. (Debug log prints in _check if a member of any benchmark interface is untyped, i.e. param.annotation == inspect.Parameter.empty.) (Handle untyped interfaces in _check #18)
  • Save benchmark function interface as a member of the Benchmark class. This should be a nnbench class called Interface etc., which is immutable/frozen, and provides easy access to function interface properties such as varnames (->inspect.signature.parameters.keys()), vartypes (->inspect.signature.parameters.values()), tuples of the two previous (->inspect.signature.parameters.items()), and default values (->p.default for p in inspect.signature.parameters). (Add interface class member to Benchmark class #20)
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

No branches or pull requests

2 participants