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

Support AVX512_BITALG instructions and relax base register req in VM operands #199

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
599bdd1
internal/cmd/avogen: write output file even when gofmt fails (#165)
josharian Jan 4, 2021
c63f459
ci: bump to go 1.16
mmcloughlin Feb 22, 2021
f592679
module auto in bootstrap
mmcloughlin Feb 22, 2021
14d5f9f
go env
mmcloughlin Feb 22, 2021
899a3ca
use tools.mod for tools install
mmcloughlin Feb 22, 2021
45b858c
Merge commit '899a3ca3ff8315036b105e73effd6b2ee269112b' into avx512_v…
vsivsi Mar 19, 2021
04add25
Update/regen with VL forms of VPOPCNTD/Q
vsivsi Mar 19, 2021
f19e503
Added VPOPCNTB/W BITALG inst + VL forms
vsivsi Mar 20, 2021
2be30b1
Fixed VPOPCNTB/W broadcast, Added VPSHUFBITQMB
vsivsi Mar 20, 2021
8f3c4ea
examples: cpu feature checks (#171)
mmcloughlin Apr 7, 2021
3f5da8f
all: upgrade direct dependencies (#172)
mmcloughlin Apr 7, 2021
e5c9b4e
script: use tools.mod for bootstrap (#175)
mmcloughlin Apr 11, 2021
c5faaae
attr: generate code from textflag.h (#176)
mmcloughlin Apr 11, 2021
e9f28ca
attr: flag test methods (#177)
mmcloughlin Apr 11, 2021
060ad41
ci: codecov informational mode (#179)
mmcloughlin Apr 12, 2021
3622eb0
pass: support priority in register allocator (#180)
mmcloughlin Apr 12, 2021
4592e16
operand: allow signed immediates to be matched by IsIMMX (#182)
kalamay Apr 16, 2021
f295bde
pass: ensure frame pointer register is saved (#174)
mmcloughlin Apr 19, 2021
c32f24f
pass: de-prioritize base pointer in register allocation (#184)
mmcloughlin Apr 19, 2021
f798093
tests/thirdparty: update/add packages, fix modules (#186)
klauspost Apr 19, 2021
cb1947b
Merge upstream changes in v0.2.0
vsivsi Apr 19, 2021
6bad393
ci: bump to go 1.16 (#166)
mmcloughlin Apr 19, 2021
ec9535c
doc: link to Filippo's live stream in README (#187)
mmcloughlin Apr 22, 2021
3a219c8
ci: github actions hardening (#190)
mmcloughlin Apr 28, 2021
b2b755d
Relax ismv() to allow omission of Base register
vsivsi May 26, 2021
fefe3f2
Allow VM without Base in VerifyMemOperands
vsivsi May 26, 2021
b935256
ci: upgrade codecov action (#196)
mmcloughlin Aug 21, 2021
c3ee58c
ci: bump go version
mmcloughlin Sep 7, 2021
8b12b38
Merge commit 'b935256fa53858859d608444d9f1bde3d952022f' into avx512_v…
vsivsi Sep 8, 2021
17f12b0
Merge branch 'avx512_vpopcnt_VL' into relax-isvm
vsivsi Sep 8, 2021
fdca336
Merge commit 'c3ee58c2a4e867b3cb026b7eb0438e330b568016' into relax-isvm
vsivsi Sep 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
name: ci

permissions:
contents: read

on:
push:
branches:
Expand All @@ -6,17 +11,16 @@ on:
schedule:
- cron: '17 12 * * 6'

name: ci
jobs:
test:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
go-version: [1.16.x, 1.17.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8 # v2.1.3
with:
go-version: ${{ matrix.go-version }}
- name: Configure Go Environment
Expand All @@ -26,7 +30,9 @@ jobs:
- name: Go Environment
run: go env
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
persist-credentials: false
- name: Bootstrap
run: ./script/bootstrap

Expand All @@ -38,27 +44,27 @@ jobs:
run: ./script/coverage

- name: Upload Unit Test Coverage
uses: codecov/codecov-action@v1.0.5
uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: unittests.coverprofile
files: unittests.coverprofile
flags: unittests
- name: Upload Integration Test Coverage
uses: codecov/codecov-action@v1.0.5
uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: integration.coverprofile
files: integration.coverprofile
flags: integration

lint:
strategy:
matrix:
go-version: [1.15.x]
go-version: [1.17.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8 # v2.1.3
with:
go-version: ${{ matrix.go-version }}
- name: Configure Go Environment
Expand All @@ -68,7 +74,9 @@ jobs:
- name: Go Environment
run: go env
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
persist-credentials: false
- name: Bootstrap
run: ./script/bootstrap
- name: Lint
Expand All @@ -77,16 +85,18 @@ jobs:
thirdparty:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
go-version: [1.16.x, 1.17.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8 # v2.1.3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
persist-credentials: false
- name: Run Third-Party Tests
working-directory: ./tests/thirdparty
run: go test -pkgs packages.json
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
* **Automatically load arguments and store return values**: ensure memory offsets are correct for complex structures
* **Generation of stub files** to interface with your Go package

For an introduction to `avo` watch the [dotGo 2019](https://2019.dotgo.eu/) talk [Better `x86` Assembly Generation with Go](https://www.youtube.com/watch?v=6Y5CZ7_tyA4) ([slides](https://speakerdeck.com/mmcloughlin/better-x86-assembly-generation-with-go)), or see the [Gophercon 2019 talk](https://www.youtube.com/watch?v=WaD8sNqroAw) ([slides](https://speakerdeck.com/mmcloughlin/better-x86-assembly-generation-with-go-gophercon-2019)) for a longer tutorial. To discuss `avo` and general Go assembly topics, join us in the [#assembly](https://gophers.slack.com/archives/C6WDZJ70S) channel of [Gophers Slack](https://invite.slack.golangbridge.org/).
For more about `avo`:

* Introductory talk ["Better `x86` Assembly Generation with Go"](https://www.youtube.com/watch?v=6Y5CZ7_tyA4) at [dotGo 2019](https://2019.dotgo.eu/) ([slides](https://speakerdeck.com/mmcloughlin/better-x86-assembly-generation-with-go))
* [Longer tutorial at Gophercon 2019](https://www.youtube.com/watch?v=WaD8sNqroAw) showing a highly-optimized dot product ([slides](https://speakerdeck.com/mmcloughlin/better-x86-assembly-generation-with-go-gophercon-2019))
* Watch [Filippo Valsorda](https://filippo.io/) live code the [rewrite of `filippo.io/edwards25519` assembly with `avo`](https://videos.filippo.io/videos/watch/d7173fa3-3d74-4f58-9e5a-30f26cf416e2?start=3m)
* Discuss `avo` and general Go assembly topics in the [#assembly](https://gophers.slack.com/archives/C6WDZJ70S) channel of [Gophers Slack](https://invite.slack.golangbridge.org/)

_Note: APIs subject to change while `avo` is still in an experimental phase. You can use it to build [real things](examples) but we suggest you pin a version with your package manager of choice._

Expand Down
59 changes: 1 addition & 58 deletions attr/attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,7 @@ import (
// Attribute represents TEXT or DATA flags.
type Attribute uint16

// Reference: https://github.com/golang/go/blob/aafe257390cc9048e8b5df898fabd79a9e0d4c39/src/runtime/textflag.h#L11-L37
//
// // Don't profile the marked routine. This flag is deprecated.
// #define NOPROF 1
// // It is ok for the linker to get multiple of these symbols. It will
// // pick one of the duplicates to use.
// #define DUPOK 2
// // Don't insert stack check preamble.
// #define NOSPLIT 4
// // Put this data in a read-only section.
// #define RODATA 8
// // This data contains no pointers.
// #define NOPTR 16
// // This is a wrapper function and should not count as disabling 'recover'.
// #define WRAPPER 32
// // This function uses its incoming context register.
// #define NEEDCTXT 64
// // Allocate a word of thread local storage and store the offset from the
// // thread local base to the thread local storage in this variable.
// #define TLSBSS 256
// // Do not insert instructions to allocate a stack frame for this function.
// // Only valid on functions that declare a frame size of 0.
// // TODO(mwhudson): only implemented for ppc64x at present.
// #define NOFRAME 512
// // Function can call reflect.Type.Method or reflect.Type.MethodByName.
// #define REFLECTMETHOD 1024
// // Function is the top of the call stack. Call stack unwinders should stop
// // at this function.
// #define TOPFRAME 2048
//
const (
NOPROF Attribute = 1 << iota
DUPOK
NOSPLIT
RODATA
NOPTR
WRAPPER
NEEDCTXT
_
TLSBSS
NOFRAME
REFLECTMETHOD
TOPFRAME
)
//go:generate go run make_textflag.go -output ztextflag.go

// Asm returns a representation of the attributes in assembly syntax. This may use macros from "textflags.h"; see ContainsTextFlags() to determine if this header is required.
func (a Attribute) Asm() string {
Expand Down Expand Up @@ -86,17 +43,3 @@ func (a Attribute) split() ([]string, Attribute) {
}
return flags, rest
}

var attrname = map[Attribute]string{
NOPROF: "NOPROF",
DUPOK: "DUPOK",
NOSPLIT: "NOSPLIT",
RODATA: "RODATA",
NOPTR: "NOPTR",
WRAPPER: "WRAPPER",
NEEDCTXT: "NEEDCTXT",
TLSBSS: "TLSBSS",
NOFRAME: "NOFRAME",
REFLECTMETHOD: "REFLECTMETHOD",
TOPFRAME: "TOPFRAME",
}
31 changes: 31 additions & 0 deletions attr/attr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,34 @@ func TestAttributeContainsTextFlags(t *testing.T) {
}
}
}

func TestAttributeTestMethods(t *testing.T) {
cases := []struct {
Attribute Attribute
Predicate func(Attribute) bool
Expect bool
}{
// Confirm logic works as expected.
{DUPOK | NOSPLIT, Attribute.DUPOK, true},
{DUPOK | NOSPLIT, Attribute.NOSPLIT, true},
{DUPOK | NOSPLIT, Attribute.NOFRAME, false},

// Basic test for every method.
{NOPROF, Attribute.NOPROF, true},
{DUPOK, Attribute.DUPOK, true},
{NOSPLIT, Attribute.NOSPLIT, true},
{RODATA, Attribute.RODATA, true},
{NOPTR, Attribute.NOPTR, true},
{WRAPPER, Attribute.WRAPPER, true},
{NEEDCTXT, Attribute.NEEDCTXT, true},
{TLSBSS, Attribute.TLSBSS, true},
{NOFRAME, Attribute.NOFRAME, true},
{REFLECTMETHOD, Attribute.REFLECTMETHOD, true},
{TOPFRAME, Attribute.TOPFRAME, true},
}
for _, c := range cases {
if c.Predicate(c.Attribute) != c.Expect {
t.Errorf("%s: expected %#v", c.Attribute.Asm(), c.Expect)
}
}
}
Loading