Skip to content

Distinguish all-float blocks and float arrays#61

Merged
stedolan merged 2 commits intooxcaml:4.11from
mshinwell:floatblock
Jul 19, 2021
Merged

Distinguish all-float blocks and float arrays#61
stedolan merged 2 commits intooxcaml:4.11from
mshinwell:floatblock

Conversation

@mshinwell
Copy link
Collaborator

Flambda 2 has a strict distinction between blocks (including records) and arrays. At first we tried to treat these together but that proved to be a bad idea.

One of the changes required to the frontend to enforce this distinction is given here. It distinguishes all-float records from float arrays. The change to Lambda.structured_constant necessitated a bootstrap.

@mshinwell mshinwell added the flambda2 Prerequisite for, or part of, flambda2 label Jun 25, 2021
@mshinwell mshinwell requested a review from stedolan June 29, 2021 12:39
| Const_block (tag, fields) ->
str (Uconst_block (tag, List.map transl fields))
| Const_float_block sl ->
(* CR mshinwell: Add [Uconst_float_block]? *)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there's any real need to do this. I don't think Clambda needs to distinguish the two, and if one day it needs to it's easily changed then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a stale CR, removed.

| Pmakearray(_, _) when is_empty approxs ->
Prim (Pmakeblock(0, Asttypes.Immutable, Some []), [], dbg),
A.value_block (Tag.create_exn 0) [||], C.Benefit.zero
(* CR mshinwell: Work out what to do here with [Pmakefloatblock] *)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan something more complicated than treating it the same as Pfloatarray here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this was also a stale CR. Flambda 1 uses the Clambda primitives in its IR, so in fact it never sees Pmakefloatblock here, as Convert_primitives has turned it into Pmakearray Pfloatarray.

@stedolan stedolan self-assigned this Jul 14, 2021
@stedolan stedolan merged commit ffca564 into oxcaml:4.11 Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flambda2 Prerequisite for, or part of, flambda2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants