Skip to content

cmd/asm: support Advanced Matrix Extensions (AMX) in Go Assembler #61079

Open

Description

@henkjan-sneller

The Go assembler (shipped with 1.20.5) currently lacks support for Advanced Matrix Extensions (AMX), particularly the sub-extensions AMX-TILE, AMX-INT8, and AMX-BF16.

As a workaround, we have been using byte sequences to generate the required instructions. However, for the sake of our mental stability, we would love to use proper instructions. @golang/compiler could you please add these 12 AMX instructions.

Activity

  1. added this to the Proposal milestone on Jun 29, 2023
  2. changed the title [-]proposal: support Advanced Matrix Extensions (AMX) in Go Assembler[/-] [+]cmd/asm: support Advanced Matrix Extensions (AMX) in Go Assembler[/+] on Jun 30, 2023
  3. ianlancetaylor commented on Jun 30, 2023

    @ianlancetaylor
    Contributor

    This doesn't need to be a proposal, so taking it out of the proposal process.

  4. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Jun 30, 2023
  5. cagedmantis commented on Jun 30, 2023

    @cagedmantis
    Contributor

    /cc @golang/compiler

  6. anton-kuklin commented on Jul 11, 2023

    @anton-kuklin
    Contributor

    Would love to work on that.

  7. cherrymui commented on Jul 11, 2023

    @cherrymui
    Member

    @anton-kuklin that would be great. Thanks! (I don't know of anybody currently working on this.)

  8. anton-kuklin commented on Jul 11, 2023

    @anton-kuklin
    Contributor

    Sure, starting my work.

  9. anton-kuklin commented on Jul 17, 2023

    @anton-kuklin
    Contributor

    Quick update on my progress. During the investigation of how to implement this feature I discovered that there's a tool x86avgen. It generates corresponding optables based on a provided csv file, e.g. this or this. After that I discovered, that there's a tool x86spec which actually downloads the latest intel doc and parses it to generate corresponding csv file mentioned previously.

    However, there's a problem. Currently this tool can't parse properly the latest documentation with added AMX commands, due to the unhandled header.
    For example:

    p.1440: reading TILELOADD/TILELOADDT1-Load Tile: unexpected header: "CPUID Feature\nFlag"
    ["Opcode/Instruction" "Op/En" "64/32-Bit Mode" "CPUID Feature\nFlag" "Description"]
    ["VEX.128.F2.0F38.W0 4B !(11):rrr:100\nTILELOADD tmm1, sibmem" "A" "V/N.E." "AMX-TILE" "Load data into tmm1 as specified by information\nin sibmem."]
    ["VEX.128.66.0F38.W0 4B !(11):rrr:100\nTILELOADDT1 tmm1, sibmem" "A" "V/N.E." "AMX-TILE" "Load data into tmm1 as specified by information\nin sibmem with hint to optimize data caching."]

    To add AMX commands I first need to fix this parser (which I will work on). Do I need to create a separate issue for it, or I can fix it as part of this one?

    CC: @cherrymui

  10. gopherbot commented on Jul 17, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/510555 mentions this issue: x86spec: fix header parsing

  11. anton-kuklin commented on Jul 27, 2023

    @anton-kuklin
    Contributor

    Hey @cherrymui, any chance you can give it a look? It should become pretty straightforward, after we will sort out the PR mentioned above.

  12. added a commit that references this issue on Aug 5, 2023
    8910092
  13. gopherbot commented on Aug 5, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/516277 mentions this issue: cmd/asm: add x86 AMX instructions

  14. anton-kuklin commented on Aug 5, 2023

    @anton-kuklin
    Contributor

    I've created an initial PR, however there's a number of questions, which had to be resolved before it will be ready, so it will take some time. I will ask questions in gerrit.

  15. added a commit that references this issue on Aug 7, 2023
    724506b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions