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

cmd/compile: support for explicit alignment annotations #6752

Open
gopherbot opened this issue Nov 12, 2013 · 10 comments
Open

cmd/compile: support for explicit alignment annotations #6752

gopherbot opened this issue Nov 12, 2013 · 10 comments
Labels
Milestone

Comments

@gopherbot
Copy link

by rayneolivetti:

Data alignment other than 8 bytes (ex: 128-bits, 256-bits, 512-bits) is necessary for
various instructions (belonging to SSE/AVX/AVX2 and the upcoming AVX-512). Instruction
and label alignment contributes to speed for some instructions.

It would hugely be helpful to be able to specify the alignment of data, text and
ordinary labels.

On the user mailing list, Ian mentioned the possibility of enabling similar
functionality via a magic comment.
@ianlancetaylor
Copy link
Contributor

Comment 1:

I meant a magic comment in Go code.  But of course some sort of assembler support would
be required as well.

@gopherbot
Copy link
Author

Comment 2 by rayneolivetti:

Indeed, that is what I intended to write. I'm sorry about the poor language.

@rsc
Copy link
Contributor

rsc commented Nov 15, 2013

Comment 3:

This is a big topic. I do not know what the right solution is here. Magic comments would
help with specific variables, but it is unclear to me what to do about fields in structs
and so on. This would somehow get mixed into the type system, whether implicitly or
explicitly, and it's not clear which way makes a smaller mess.

Labels changed: added priority-later, removed priority-triage.

Owner changed to @rsc.

Status changed to Thinking.

@minux
Copy link
Member

minux commented Nov 16, 2013

Comment 4:

I think the OP is only asking about alignment control in assembly files.
I agree that for Go it will be a much bigger problem.

@gopherbot
Copy link
Author

Comment 5 by rayneolivetti:

Yes, I'm only hoping to see the support for this in assembly files (hence cmd/as, but
maybe I should simply have said [568]a/[568]l). Maybe it's better to file an issue for
the Go-side support?
This is such a basic feature that any assembler (other than Plan 9 assembler) I have
ever used (even ancient Zilog 80 assemblers!) has this feature. I have the impression
that at the time Plan 9 assembler was written, the authors didn't imagine that alignment
is a real issue and enforcing "native-alignment" (64-bits for amd64 for instance) as the
"one true alignment", without any options, is the best way to go.
In this age of SSE/AVX, such an assumption is no longer valid and causes performance
problems.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 6:

I don't understand what it means to have alignment support only in assembly files.
Usually assembly functions operate on data allocated outside the assembly file.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 7:

Labels changed: added go1.3maybe.

@gopherbot
Copy link
Author

Comment 8 by rayneolivetti:

I'm not sure what this means, you can define your data in assembly or Go code.
A more specific example (taken from real production code) is be the mask data, that is
not passed as a parameter to the function.
Ideally, yes, it would be just perfect to have such support on Go side.
Would make everything much easier. Only assembly support is still okay, since it's
better than the current state (it's totally impossible to have any aligned data at all).
Additionally, assembly side support will be needed for a potential Go-side support
anyway.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 10:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: support for explicit alignment annotations cmd/compile: support for explicit alignment annotations Jun 8, 2015
@rsc rsc removed their assignment Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants