Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Added some math funcs implementation #500

Merged
merged 9 commits into from
Feb 9, 2021
Merged

Conversation

kuzminrobin
Copy link
Contributor

@kuzminrobin kuzminrobin commented Feb 5, 2021

The first step for #501
Resolves #508

Copy link
Contributor

@cgranade cgranade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me, but I'm not an LLVM expert per se so I'll leave it to others to approve. In any case, it looks like the tests are all at the C level, but it would be good to have integration tests similar to

define i64 @Microsoft__Quantum__Testing__QIR__QuantumRandomNumberGenerator__body() #0 {
that ensure that the new intrinsic works correctly when called from QIR files generated by the Q# compiler.

@kuzminrobin
Copy link
Contributor Author

This looks reasonable to me, but I'm not an LLVM expert per se so I'll leave it to others to approve. In any case, it looks like the tests are all at the C level, but it would be good to have integration tests similar to

define i64 @Microsoft__Quantum__Testing__QIR__QuantumRandomNumberGenerator__body() #0 {

that ensure that the new intrinsic works correctly when called from QIR files generated by the Q# compiler.

Moved the tests to .qs file.

src/QirRuntime/test/QIR-static/qir-test-math.qs Outdated Show resolved Hide resolved
src/QirRuntime/test/QIR-static/qir-test-math.qs Outdated Show resolved Hide resolved
src/QirRuntime/test/QIR-static/qir-driver.cpp Outdated Show resolved Hide resolved
src/QirRuntime/test/QIR-static/qir-test-arrays.qs Outdated Show resolved Hide resolved
Copy link
Contributor

@guenp guenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments; thanks for implementing this!

src/QirRuntime/lib/QIR/bridge-qis.ll Outdated Show resolved Hide resolved
src/QirRuntime/lib/QIR/bridge-qis.ll Outdated Show resolved Hide resolved
@kuzminrobin kuzminrobin changed the title Test PR: Added sqrt implementation Added some math funcs implementation Feb 8, 2021
@kuzminrobin kuzminrobin marked this pull request as ready for review February 8, 2021 19:37
src/QirRuntime/test/QIR-static/qir-driver.cpp Outdated Show resolved Hide resolved
src/QirRuntime/test/QIR-static/qir-test-math.qs Outdated Show resolved Hide resolved
src/QirRuntime/test/QIR-static/qir-test-math.qs Outdated Show resolved Hide resolved
src/QirRuntime/test/QIR-static/qir-test-math.qs Outdated Show resolved Hide resolved
src/QirRuntime/lib/QIR/intrinsicsMath.cpp Show resolved Hide resolved
Copy link
Contributor

@IrinaYatsenko IrinaYatsenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me on the QirRuntime's side of things. Signing off modulo Chris' comments on the semantics of arctan2.

Copy link
Contributor

@cgranade cgranade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock @guenp, but we should as quickly as possible:

  • Ensure exclusive language is not used in codebase
  • Extend QSharpFoundation unit tests to cover what you noticed about ArcTan2, so that we can prevent regressions that would cause QIR and C# runtimes to disagree

src/QirRuntime/test/QIR-static/qir-test-strings.qs Outdated Show resolved Hide resolved
@kuzminrobin
Copy link
Contributor Author

Approving to unblock @guenp, but we should as quickly as possible:

  • Ensure exclusive language is not used in codebase
  • Extend QSharpFoundation unit tests to cover what you noticed about ArcTan2, so that we can prevent regressions that would cause QIR and C# runtimes to disagree

Filed #508.
Added to #506:

Extend QSharpFoundation unit tests to cover what has been noticed about ArcTan2, so that we can prevent regressions that would cause QIR and C# runtimes to disagree

@kuzminrobin kuzminrobin merged commit fbd4b38 into main Feb 9, 2021
@kuzminrobin kuzminrobin deleted the kuzminrobin/mathfuncs branch February 9, 2021 04:34
@kuzminrobin kuzminrobin self-assigned this Feb 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace the exclusive term Implement bridge and native backing for math functions Q# depends on
4 participants