Skip to content

Conversation

@a-alveyblanc
Copy link
Collaborator

No description provided.

@a-alveyblanc a-alveyblanc marked this pull request as ready for review July 2, 2025 21:02
@brian-kelley brian-kelley self-requested a review July 2, 2025 21:03
Copy link
Collaborator

Choose a reason for hiding this comment

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

CMakeFiles, CMake caches and generated makefiles should be added to gitignore


Operation *op = getOperation();
if (!op->hasTrait<OpTrait::SymbolTable>()) {
op->emitError() << " was scheduled to be run under the inliner, but does "
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
op->emitError() << " was scheduled to be run under the inliner, but does "
op->emitError() << " was scheduled to be run under the inliner, but does not "

@@ -0,0 +1,38 @@
/* Top level routine for automatic kernel fusion. Creates "fusion sets", i.e.
* sets of subkernels that are to be fused together. Major steps:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* sets of subkernels that are to be fused together. Major steps:
* sets of subkernels that are to be fused together.

Or finish the comment, I'm fine either way :)

if (write == bufferStores.end())
return WalkResult::advance();

if (!write->second.size())
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens here if loadMem's rank is 0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Never mind, I see that an interrupt result means that there could be a read after write.

ploopChains.clear();
ploopChains.push_back({});

bool noSideEffects = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to add some comments about this logic. It looks like it will always group all parallels in a block into chains of 2: (i, i+1), (i+2, i+3), ...


// {{{ generic -> einsum

typedef struct EinsumArg {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer C++ style struct declarations like

struct EinsumArg
{
};

Comment on lines +139 to +143
if (
!isa<arith::AddFOp>(op) &&
!isa<arith::MulFOp>(op) &&
!isa<linalg::YieldOp>(op)
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (
!isa<arith::AddFOp>(op) &&
!isa<arith::MulFOp>(op) &&
!isa<linalg::YieldOp>(op)
) {
if (!isa<arith::AddFOp, arith::MulFOp, linalg::YieldOp>(op)) {

!isa<arith::MulFOp>(op) &&
!isa<linalg::YieldOp>(op)
) {
op.dump();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
op.dump();
llvm::outs() << "Note: cannot convert following linalg.generic to einsum:\n";
op.dump();

OK to dump the op but should give a message for why it's being printed. Or just get rid of the dump since this is only one possible case for why a generic isn't a valid einsum.

}
}

std::set<char> outputIndices;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This part is nice and elegant

FusedEinsum fusedEinsum;

std::vector<EinsumSpecification> fused_einsums;
for (auto outer = einsums.rbegin(); outer != einsums.rend(); ++outer) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function should have some comments explaining the steps

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