-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add __quantum__rt__device_init(int8_t *, int8_t *, int8_t *)
#396
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #396 +/- ##
=======================================
Coverage 99.48% 99.49%
=======================================
Files 42 42
Lines 7053 7134 +81
Branches 477 477
=======================================
+ Hits 7017 7098 +81
Misses 20 20
Partials 16 16 ☔ View full report in Codecov by Sentry. |
@maliasadi what is the context behind this change? |
@josh146 First, it removes 2 instructions calls from the generated LLVM IR with hardcoding the device triple (name, library, kwargs) from the frontend to the backend in one single
Second, it lets runtime to initialize device instances without keeping record of any partial information about that device. Before this change, the runtime had to store partial information about |
thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I think it just needs a changelog :)
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
We currently lower the device name, kwargs, and library with 3
__quantum__rt__device(key, spec)
calls. The runtime initializes the targeted device after getting the device name and kwargs at the third call:This PR reduces the number of these device calls into 1 single
__quantum__rt__device_init("rtd_lib", "rtd_name", "rtd_kwargs")
call and deprecates the__quantum__rt__device
instruction. The runtime is able to initialize the device without necessarily storing partial device info or implying any specific order to define these specifications in the IR and the runtime. This PR is related to #381 and will help better scope the lifetime of device instances. We also add__quantum__rt__device_release()
to release the initialized device by request (this'll be used in the async support).