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

doc: document PCALIGN assembler directive #64283

Closed
mauri870 opened this issue Nov 20, 2023 · 3 comments
Closed

doc: document PCALIGN assembler directive #64283

mauri870 opened this issue Nov 20, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mauri870
Copy link
Member

mauri870 commented Nov 20, 2023

The PCALIGN assembler directive is used to align instructions to a given boundary. On critical subroutines and critical innermost loops it can deliver a significant boost in performance.

Currently this pseudo instruction is available for ppc64, loong64, amd64, arm64 and soon for riscv64 once CL 541740 is merged. There is also ongoing work to optimize certain routines in #63678.

I propose adding a new section called "Instruction Alignment" to the https://go.dev/doc/asm that includes the following:

  • Short introduction
  • Supported architectures
  • Usage
    • Tradeoffs
      • some cache space is lost to empty spaces before the aligned code entries
      • can lead to spurious alignment issues if not done correctly
    • Known places where adding it gets perf improvements (hot loops, critical sections)
    • Known boundary sizes that work (e.g 16 bytes on amd64, 32 for AVX2)

I'm happy to write such docs if we agree that it is relevant for the assembler documentation, preferably to be included in Go 1.22.

/cc @rsc @cherrymui @dmitshur

@mauri870 mauri870 added this to the Go1.22 milestone Nov 20, 2023
@mknyszek mknyszek added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Nov 20, 2023
@mknyszek
Copy link
Contributor

CC @golang/compiler

@mknyszek mknyszek added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 20, 2023
@cherrymui
Copy link
Member

Sounds good to me for documenting this. I'd suggest a short description in the "Directives" section. The current https://go.dev/doc/asm documentation isn't performance-focused mostly, so I'd say let's keep the performance-related discussion short (a sentence or two). Thanks.

@mauri870 mauri870 self-assigned this Nov 20, 2023
mauri870 added a commit to mauri870/go that referenced this issue Nov 21, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/544115 mentions this issue: doc: document PCALIGN directive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants