catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Add `static_argnames` option to qjit

Open paul0403 opened this issue 1 year ago • 4 comments

Context: Adding a static_argnames option to qjit for users to configure static arguments by name.

Description of the Change: Under the hood, this just maps the static_argnames to their argument indices and add to static_argnums.

Benefits: Users can specify static arguments to jitted functions by name.

Possible Drawbacks: Even more keyword arguments to qjit...

[sc-41335]

paul0403 avatar Sep 26 '24 18:09 paul0403

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.96%. Comparing base (d7c7e39) to head (cf5a031). Report is 201 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1158   +/-   ##
=======================================
  Coverage   97.96%   97.96%           
=======================================
  Files          77       77           
  Lines       11244    11263   +19     
  Branches      967      972    +5     
=======================================
+ Hits        11015    11034   +19     
  Misses        180      180           
  Partials       49       49           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 26 '24 19:09 codecov[bot]

I would replace the tests with lit tests that don't execute the function. They are quicker.

erick-xanadu avatar Sep 27 '24 19:09 erick-xanadu

I would replace the tests with lit tests that don't execute the function. They are quicker.

34a418c9b233c993ac5330261f70c4a3f2872d37

paul0403 avatar Sep 30 '24 15:09 paul0403

Another integration test we might want to consider is with decorators (like vmap, qnode, grad, etc), since this functionality inspects the function signature, there is a chance decorators might not propagate this info properly.

dime10 avatar Oct 01 '24 15:10 dime10

Another integration test we might want to consider is with decorators (like vmap, qnode, grad, etc), since this functionality inspects the function signature, there is a chance decorators might not propagate this info properly.

Really conveniently, inspect module has a inspect.signature(), which can take in any callable, not just plain functions. https://github.com/PennyLaneAI/catalyst/pull/1158/commits/7e80645356ea314c4374d9e48f95f6581f76a7e6

paul0403 avatar Oct 21 '24 21:10 paul0403