Skip to content
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

Array reinterpret operations #3366

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

Conversation

mshinwell
Copy link
Collaborator

@mshinwell mshinwell commented Dec 12, 2024

This is a different approach from the one I took previously to adding the "array reinterpret" operations, e.g. given an int64# array, get the two values corresponding to the type #(float# * float#) from byte offset 8 (which is unaligned with respect to the product type as a whole). I think this way is easier: the Lambda primitives now mirror what happens in the middle end, namely they take both the array kind and the array ref/set kind. (This means that all this information basically just passes through Lambda_to_flambda, which in fact could now become simpler, as some conversion functions could now be deleted were it not for the float array optimization.)

  • The array kind determines indexing
  • The array ref/set kind determines what is actually read or written.

We should be able to expose reinterpret primitives in Translprim which map to these existing primitives, just with the kinds appropriately set, I hope.

@mshinwell mshinwell marked this pull request as draft December 12, 2024 09:57
@mshinwell mshinwell force-pushed the array-reinterpret2 branch 3 times, most recently from fa8e3b4 to 435c54d Compare December 12, 2024 14:22
@mshinwell mshinwell force-pushed the array-reinterpret2 branch 2 times, most recently from 5194da9 to a241f97 Compare January 13, 2025 15:50
@mshinwell mshinwell marked this pull request as ready for review January 15, 2025 11:30
@mshinwell mshinwell requested a review from ccasin January 15, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant