Skip to content

Floating Point Writing Fixes #45

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

peter-campora
Copy link
Contributor

Addressing: #41

…d also adding the fcmp operation to the spec
@idavis
Copy link
Collaborator

idavis commented Mar 21, 2025

@peter-campora When both integer and floating point extensions are enabled, should fptosi and sitofp be available? If not, is there another idiomatic way to convert between the values?

@idavis
Copy link
Collaborator

idavis commented Mar 31, 2025

@@ -696,7 +697,7 @@ additional runtime function must be available:

| Function | Signature | Description |
| :---------------------------------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| __quantum__rt__float_record_output | `void(f64,i8*)` | Records a floating-point value in the generated output. The second parameter defines the string label for the value. Depending on the output schema, the label is included in the output or omitted. |
| __quantum__rt__float_record_output | `void(double,i8*)` | Records a floating-point value in the generated output. The second parameter defines the string label for the value. Depending on the output schema, the label is included in the output or omitted. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| __quantum__rt__float_record_output | `void(double,i8*)` | Records a floating-point value in the generated output. The second parameter defines the string label for the value. Depending on the output schema, the label is included in the output or omitted. |
| __quantum__rt__double_record_output | `void(double,i8*)` | Records a floating-point value in the generated output. The second parameter defines the string label for the value. Depending on the output schema, the label is included in the output or omitted. |

If we assume that the idea is to use fpext on smaller floating points and use only __quantum__rt__double_record_output for half, float, and double. It still leaves the question of how to output fp128 type. We may need another RT function for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively, only 16/32/64-bit floating-point types should be supported.

!"float_computations", !"f32,f64"}`. The precision must be one of the LLVM
recognized values (f16, f32, f64, f80, or f128), and classical computations on
!"float_computations", !"float,double"}`. The precision must be one of the LLVM
recognized values (`half (f16)`, `float (f32)`, and `double (f64)`), and classical computations on
Copy link
Contributor

Choose a reason for hiding this comment

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

The backticks should be for the recognized values (types).

Suggested change
recognized values (`half (f16)`, `float (f32)`, and `double (f64)`), and classical computations on
recognized values (`half` (16-bit), `float` (32-bit), and `double` (64-bit)), and classical computations on

Alternatively, binary16, binary32 and binary64 in parentheses.

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

Successfully merging this pull request may close these issues.

4 participants