Skip to content

proposal for unaligned loads and stores #1537

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

Merged
merged 13 commits into from
Mar 31, 2022

Conversation

glessard
Copy link
Contributor

@glessard glessard commented Feb 2, 2022

Implementation PR: swiftlang/swift#41033

@glessard glessard marked this pull request as ready for review February 8, 2022 23:22
@rjmccall
Copy link
Contributor

@glessard Is this still awaiting an implementation?

@glessard
Copy link
Contributor Author

The proposal and implementation are ready for review.

@glessard
Copy link
Contributor Author

I could remove excessive references to drafts, I guess.

@rjmccall
Copy link
Contributor

Ah, I see the link in the PR summary. Could you link it from the document, please? And yeah, if there's any draft cleanup you want to do, please do so.

@glessard
Copy link
Contributor Author

@rjmccall Ready to go on my end; let me know if you need any other changes.

@rjmccall
Copy link
Contributor

Thanks. We'll try to talk about it in the Core Team ASAP and figure out how it's going to be scheduled, but I wanted to make sure you felt it was ready before we started that process.

@rjmccall
Copy link
Contributor

We'd like to go ahead and run this. I'll be review manager. I think two weeks, running from March 30th until April 12th, is probably appropriate; is that okay with you as the author?

@glessard
Copy link
Contributor Author

Sounds great. Thanks!

@rjmccall
Copy link
Contributor

rjmccall commented Mar 31, 2022

Review manager feedback:

  • The title of the proposal just talks about unaligned loads, but the proposal includes both load and store operations.
  • Please address Karl's idea about asserting POD-ness of as a precondition.
  • Personally, I have to say that keeping the alignment requirement for load but removing it from storeBytes feels like an odd decision. You don't have to respond to this; I'm just putting it out there.

With that, I'll put this in review.

@glessard
Copy link
Contributor Author

loadUnaligned has a debugPrecondition for POD-ness. I'll clarify this in the document and in the doc-comment.

Co-authored-by: Ben Rimmington <[email protected]>
@rjmccall
Copy link
Contributor

loadUnaligned has a debugPrecondition for POD-ness. I'll clarify this in the document and in the doc-comment.

Thank you.

@glessard
Copy link
Contributor Author

glessard commented Mar 31, 2022

Regarding storeBytes and storeBytesUnaligned: one issue here is that the destination is always, by definition, byte-aligned. At the builtins level, there is also not a different way to spell the two. If we had both functions, they would be identical in release mode, and differ only by their set of debugPrecondition calls.

@rjmccall
Copy link
Contributor

Regarding storeBytes and storeBytesUnaligned: one issue here is that the destination is always, by definition, byte-aligned. At the builtins level, there is also not a different way to spell the two. If we had both functions, they would be identical in release mode, and differ only by their set of debugPrecondition calls.

I mean, we could add a builtin that does an aligned store. But in fact we don't need to: since you're requiring the type to be POD, you can simply use the existing initialize or assign builtin.

@rjmccall
Copy link
Contributor

Do you want me to put this into review? I can just make these same comments in the review thread, and we can see what the community thinks. Worst case, the Core Team asks you to revise the proposal.

@glessard
Copy link
Contributor Author

Yes, go ahead. Thanks!

@rjmccall rjmccall merged commit 5c8737c into swiftlang:main Mar 31, 2022
@glessard glessard deleted the unaligned-loads branch March 31, 2022 21:52
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.

3 participants