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

Add LLVM to Affine access pass #303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions src/enzyme_ad/jax/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ cc_library(
":EnzymeXLAOpsIncGen",
":EnzymeXLAPassesIncGen",
":EnzymeHLOPatternsIncGen",
":RaisingTransformOpsImplIncGen",
":RaisingTransformOpsIncGen",
":RaisingTransformPatternsIncGen",
":RaisingTransformOps",
"@llvm-project//mlir:DLTIDialect",
"@llvm-project//mlir:GPUPipelines",
Expand Down
36 changes: 36 additions & 0 deletions src/enzyme_ad/jax/Dialect/EnzymeXLAOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,40 @@ def Pointer2MemrefOp : EnzymeXLA_Op<"pointer2memref", [
}];
}

//===----------------------------------------------------------------------===//
// AtAddrOp
//===----------------------------------------------------------------------===//

Copy link
Member

Choose a reason for hiding this comment

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

We should instead use pointer2memref

def AtAddrOp : EnzymeXLA_Op<"ataddr", [Pure]> {
let summary =
"Construct a c-style memref at an addr";
let description = [{
}];
let arguments = (ins AnyType:$addr);
let results = (outs AnyRankedOrUnrankedMemRef:$dest);
let builders = [
OpBuilder<(ins "Value":$source), [{
return build($_builder, $_state,
TypeRange(MemRefType::get({ShapedType::kDynamic}, $_builder.getI8Type())),
ValueRange(source));
}]>,
OpBuilder<(ins "Value":$source, "Type":$dstType), [{
return build($_builder, $_state,
TypeRange(dstType),
ValueRange(source));
}]>
];
}

Copy link
Member

Choose a reason for hiding this comment

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

@ftynse @ivanradanov
Is this something upstreamable or already upstream

def AffineScopeOp : EnzymeXLA_Op<"scope", [
AffineScope,
AutomaticAllocationScope,
RecursiveMemoryEffects,
]>,
Arguments<(ins Variadic<AnyType>:$operands)>,
Results<(outs Variadic<AnyType>:$results)> {
let summary = "Inline affine scope";
let regions = (region SizedRegion<1>:$region);
}

#endif // ENZYMEXLA_OPS
Loading