Skip to content
Draft
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
1,052 changes: 1,052 additions & 0 deletions docs/designs/vpto-vector-address-ops.md

Large diffs are not rendered by default.

470 changes: 470 additions & 0 deletions docs/isa/micro-isa/18-vaddr-loop-memory.md

Large diffs are not rendered by default.

224 changes: 224 additions & 0 deletions include/PTO/IR/VPTOOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def PTO_B32MaskTypeConstraint : Type<
"PTO low-level b32 mask type">;
def PTO_AlignTypeConstraint : Type<CPred<"::llvm::isa<::mlir::pto::AlignType>($_self)">,
"PTO low-level align type">;
def PTO_VAddrTypeConstraint : Type<CPred<"::llvm::isa<::mlir::pto::VAddrType>($_self)">,
"PTO low-level vector_address offset type">;

def PTO_BufferType : Type<
CPred<"::llvm::isa<::mlir::pto::PtrType>($_self)">,
Expand Down Expand Up @@ -1348,6 +1350,75 @@ def PTO_VldsOp : PTO_Op<"vlds", [
}];
}

def PTO_VagOp : PTO_Op<"vag"> {
let arguments = (ins Variadic<I32>:$strides);
let results = (outs PTO_VAddrTypeConstraint:$addr);

let hasVerifier = 1;

let assemblyFormat = [{
$strides attr-dict `:` type($strides) `->` type($addr)
}];
}

def PTO_VAddrLoopOp : PTO_Op<"vaddr_loop", [
SingleBlock,
NoTerminator,
AttrSizedOperandSegments
]> {
let summary = "Structured vector-address loop";
let description = [{
`pto.vaddr_loop` represents one to four canonical nested vector-address
loops. The op carries only upper bounds. Each vector-address value declared
in the header has one byte stride per loop dimension and is made available
as a body region argument.
}];

let arguments = (ins
Variadic<I16>:$bounds,
Variadic<I32>:$strides
);
let regions = (region SizedRegion<1>:$body);

let hasVerifier = 1;
let hasCustomAssemblyFormat = 1;
}

def PTO_ValdOp : PTO_Op<"vald", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_BufferLikeType:$source,
PTO_VAddrTypeConstraint:$addr,
OptionalAttr<StrAttr>:$dist
);

let results = (outs PTO_VectorType:$result);

let hasVerifier = 1;

let assemblyFormat = [{
$source `[` $addr `]` attr-dict `:` type($source) `,` type($addr) `->` type($result)
}];
}

def PTO_Valdx2Op : PTO_Op<"valdx2", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_BufferLikeType:$source,
PTO_VAddrTypeConstraint:$addr,
StrAttr:$dist
);
let results = (outs PTO_VectorType:$low, PTO_VectorType:$high);

let hasVerifier = 1;

let assemblyFormat = [{
$source `[` $addr `]` `,` $dist attr-dict `:` type($source) `,` type($addr) `->` type($low) `,` type($high)
}];
}

def PTO_Vldsx2Op : PTO_Op<"vldsx2", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -1381,6 +1452,23 @@ def PTO_VldasOp : PTO_Op<"vldas", [
}];
}

def PTO_ValdaOp : PTO_Op<"valda", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_BufferLikeType:$source,
PTO_VAddrTypeConstraint:$addr
);

let results = (outs PTO_AlignTypeConstraint:$result);

let hasVerifier = 1;

let assemblyFormat = [{
$source `[` $addr `]` attr-dict `:` type($source) `,` type($addr) `->` type($result)
}];
}

def PTO_InitAlignOp : PTO_Op<"init_align", []> {
let arguments = (ins);

Expand Down Expand Up @@ -1461,6 +1549,29 @@ def PTO_VldusOp : PTO_Op<"vldus", [
}];
}

def PTO_ValduOp : PTO_Op<"valdu", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_BufferLikeType:$source,
PTO_VAddrTypeConstraint:$addr_in,
PTO_AlignTypeConstraint:$align_in,
I32:$inc
);

let results = (outs
PTO_VectorType:$result,
PTO_AlignTypeConstraint:$align_out,
PTO_VAddrTypeConstraint:$addr_out
);

let hasVerifier = 1;

let assemblyFormat = [{
$source `[` $addr_in `]` `,` $align_in `,` $inc attr-dict `:` type($source) `,` type($addr_in) `,` type($align_in) `,` type($inc) `->` type($result) `,` type($align_out) `,` type($addr_out)
}];
}

def PTO_UvldOp : PTO_Op<"uvld", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -1758,6 +1869,23 @@ def PTO_PldsOp : PTO_Op<"plds", [
}];
}

def PTO_PaldOp : PTO_Op<"pald", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_BufferLikeType:$source,
PTO_VAddrTypeConstraint:$addr,
StrAttr:$dist
);
let results = (outs PTO_MaskTypeConstraint:$result);

let hasVerifier = 1;

let assemblyFormat = [{
$source `[` $addr `]` `,` $dist attr-dict `:` type($source) `,` type($addr) `->` type($result)
}];
}

def PTO_PldiOp : PTO_Op<"pldi", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -2539,6 +2667,26 @@ def PTO_VstsOp : PTO_Op<"vsts", [
}];
}

def PTO_VastOp : PTO_Op<"vast", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_VectorType:$value,
PTO_BufferLikeType:$destination,
PTO_VAddrTypeConstraint:$addr,
OptionalAttr<StrAttr>:$dist,
PTO_MaskTypeConstraint:$mask
);

let results = (outs);

let hasVerifier = 1;

let assemblyFormat = [{
$value `,` $destination `[` $addr `]` `,` $mask attr-dict `:` type($value) `,` type($destination) `,` type($addr) `,` type($mask)
}];
}

def PTO_VscatterOp : PTO_Op<"vscatter", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -2577,6 +2725,25 @@ def PTO_PstsOp : PTO_Op<"psts", [
}];
}

def PTO_PastOp : PTO_Op<"past", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_MaskTypeConstraint:$value,
PTO_BufferLikeType:$destination,
PTO_VAddrTypeConstraint:$addr,
StrAttr:$dist
);

let results = (outs);

let hasVerifier = 1;

let assemblyFormat = [{
$value `,` $destination `[` $addr `]` `,` $dist attr-dict `:` type($value) `,` type($destination) `,` type($addr)
}];
}

def PTO_CopyUbufToGmOp : PTO_Op<"copy_ubuf_to_gm", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -3302,6 +3469,26 @@ def PTO_Vstsx2Op : PTO_Op<"vstsx2", [
}];
}

def PTO_Vastx2Op : PTO_Op<"vastx2", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_VectorType:$low,
PTO_VectorType:$high,
PTO_BufferLikeType:$destination,
PTO_VAddrTypeConstraint:$addr,
StrAttr:$dist,
PTO_MaskTypeConstraint:$mask
);
let results = (outs);

let hasVerifier = 1;

let assemblyFormat = [{
$low `,` $high `,` $destination `[` $addr `]` `,` $dist `,` $mask attr-dict `:` type($low) `,` type($high) `,` type($destination) `,` type($addr) `,` type($mask)
}];
}

def PTO_VsldbOp : PTO_Op<"vsldb", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -3357,6 +3544,23 @@ def PTO_VstasOp : PTO_Op<"vstas", [
}];
}

def PTO_VastaOp : PTO_Op<"vasta", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_AlignTypeConstraint:$value,
PTO_BufferLikeType:$destination,
PTO_VAddrTypeConstraint:$addr
);
let results = (outs);

let hasVerifier = 1;

let assemblyFormat = [{
$value `,` $destination `[` $addr `]` attr-dict `:` type($value) `,` type($destination) `,` type($addr)
}];
}

def PTO_VstarOp : PTO_Op<"vstar", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down Expand Up @@ -3413,6 +3617,26 @@ def PTO_VstusOp : PTO_Op<"vstus", [
}];
}

def PTO_VastuOp : PTO_Op<"vastu", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
let arguments = (ins
PTO_AlignTypeConstraint:$align_in,
PTO_VAddrTypeConstraint:$addr_in,
PTO_VectorType:$value,
PTO_BufferLikeType:$base,
StrAttr:$mode
);
let results = (outs PTO_AlignTypeConstraint:$align_out,
PTO_VAddrTypeConstraint:$addr_out);

let hasVerifier = 1;

let assemblyFormat = [{
$align_in `,` $addr_in `,` $value `,` $base `,` $mode attr-dict `:` type($align_in) `,` type($addr_in) `,` type($value) `,` type($base) `->` type($align_out) `,` type($addr_out)
}];
}

def PTO_VsturOp : PTO_Op<"vstur", [
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>
]> {
Expand Down
20 changes: 20 additions & 0 deletions include/PTO/IR/VPTOTypeDefs.td
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,26 @@ def MaskType : TypeDef<PTO_Dialect, "Mask"> {
}];
}

def VAddrType : TypeDef<PTO_Dialect, "VAddr"> {
let mnemonic = "vaddr";
let summary = "A PTO low-level vector_address offset token";

let parameters = (ins
StringRefParameter<"address granularity view">:$granularity
);

let hasCustomAssemblyFormat = 1;
let genVerifyDecl = 1;

let extraClassDeclaration = [{
static bool isSupportedGranularity(::llvm::StringRef granularity);

bool isB8() const { return getGranularity() == "b8"; }
bool isB16() const { return getGranularity() == "b16"; }
bool isB32() const { return getGranularity() == "b32"; }
}];
}

def AlignType : TypeDef<PTO_Dialect, "Align"> {
let mnemonic = "align";
let summary = "A PTO low-level vector_align carrier";
Expand Down
Loading
Loading