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

Implement scaled_dot(mxfp8, fp8) via mma #4795

Merged
merged 2 commits into from
Oct 12, 2024
Merged

Conversation

lezcano
Copy link
Contributor

@lezcano lezcano commented Sep 24, 2024

Initial implementation using mma.

Missing to test that it plays ball with the pipeliner.

@lezcano lezcano changed the title mxfp mma Implement scaled_dot(mxfp8, fp8) via mma Sep 24, 2024
Initial implementation using mma.

Missing to test that it plays ball with the pipeliner.
Copy link
Collaborator

@ThomasRaoux ThomasRaoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments.
So this breaks the pipeliner somehow?


let results = (outs TT_FloatTensor:$d);

// Not sure why I need to fully specify the optional group, but otherwise it complains when loading the mlir file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what optional group?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one referring to the scale of the rhs being an std::optional

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I still don't understand the meaning of the comment :) What does "I need to fully specify the optional group" means then?

Copy link
Contributor Author

@lezcano lezcano Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that I had to specify all this funny syntax: (`,`) : (`,` $rhs_scale^ `,`)?. In the other ops that we use optional args, we pretty much handle them in the frontend where we call different builders explicitly.
Here, I tried to handle the optional arg at the MLIR level, and it so happened that just writing (`,` $rhs_scale^)? wouldn't work. I had to write the whole if-else clause for the optional, adding another comma inside it.


namespace mlir::triton::gpu {

LogicalResult UpcastMXFPOp::verify() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The verifiers and other methods for this dialect are currently in Dialect.cpp. I would keep it there for consistency. We can have a separate PR to move it for cleanup if you want.

lib/Dialect/TritonGPU/Transforms/AccelerateMatmul.cpp Outdated Show resolved Hide resolved
@lezcano
Copy link
Contributor Author

lezcano commented Sep 30, 2024

So this breaks the pipeliner somehow?

No, it's just that I haven't tested if it works as expected just yet.

@ThomasRaoux
Copy link
Collaborator

BTW, it would be nice to have lit tests for accelerate_matmul as well lowering to of upscale to llvm

@lezcano
Copy link
Contributor Author

lezcano commented Oct 11, 2024

@ThomasRaoux addressed the review (at long last)

Copy link
Collaborator

@ThomasRaoux ThomasRaoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lezcano lezcano merged commit 4daa467 into triton-lang:main Oct 12, 2024
7 checks passed
@lezcano lezcano deleted the mxfp-mma branch October 12, 2024 11:09
Luosuu pushed a commit to Luosuu/triton that referenced this pull request Nov 13, 2024
Initial implementation using mma.

Missing to test that it plays ball with the pipeliner.
guacamoleo pushed a commit to guacamoleo/triton that referenced this pull request Nov 14, 2024
Initial implementation using mma.

Missing to test that it plays ball with the pipeliner.
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.

2 participants