-
Notifications
You must be signed in to change notification settings - Fork 180
Conversation
|
It looks like the build failure is transient, so maybe let's kick off another one? /azp run With respect to the other point, I think especially for QIR emission, it would make sense to keep this backed by your Q# implementation so as to not introduce another intrinsic that target packages need to implement. |
|
|
||
| @Test("QuantumSimulator") | ||
| function CanComputeBitSizeFromLargeNumbers () : Unit { | ||
| for (k in 1 .. 100) { |
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.
| for (k in 1 .. 100) { | |
| for k in 1 .. 100 { |
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.
I think the current libraries still builds against an older version of the QDK.
| return AccumulatedBitsizeL(a, 0); | ||
| mutable bitsize = 0; | ||
| mutable val = a; | ||
| while (val != 0L) { |
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.
| while (val != 0L) { | |
| while val != 0L { |
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.
I think the current libraries still builds against an older version of the QDK.
Co-authored-by: Chris Granade <chgranad@microsoft.com>
Can we do both? Provide a Q# implementation but also have a C# implementation for when we run Q# applications inside C#? I think such an approach would be generally helpful. |
Good question, yeah. @swernli, I know you've raised that some of the behavior around that has changed recently with the move to targeting packages; how would be best to have the best of both worlds here? |
|
Thanks for drawing my attention to this, Chris! The good news is that the target package work (which merged to qsharp-runtime/main as of microsoft/qsharp-runtime#476) was able to accomplish its goals in a (mostly) non-breaking way. So the behavior I raised before that changed actually didn't change and can still work as it did before. For clarity, here's a list of the current behaviors you can use:
So it sounds like in this case you want to use that first option, which will still work as it does today. That way the Q# implementation will be used when generating code (such as for QIR) but the C# implementation will take precedence with our default simulator. |
|
Thanks for the help, @swernli!
Agreed, I think this meets both usecases fairly nicely. It's good to have the version that relies on the nicely optimized code from the C# standard libraries while still being able to use the pure Q# version in QIR. My only concern at that point would be testing to make sure that the Q# version is correct when the C# implementation is missing; I think that isn't quite covered by |
This PR fixes #403 by replacing the recursive implementation with an iterative one. However, reading @vadym-kl's issue description I wonder whether it is better to implement it as a Q# intrinsic and calling directly into C#'s method to retrieve the bit size.