Skip to content

Commit df6bea8

Browse files
committed
Add AlignmentAttrOpInterface to SPIRV dialect memory operations
1 parent adf4d4d commit df6bea8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCooperativeMatrixOps.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef MLIR_DIALECT_SPIRV_IR_COOPERATIVE_MATRIX_OPS
1717
#define MLIR_DIALECT_SPIRV_IR_COOPERATIVE_MATRIX_OPS
1818

19+
include "mlir/Interfaces/AlignmentAttrInterface.td"
20+
1921
//===----------------------------------------------------------------------===//
2022
// SPV_KHR_cooperative_matrix extension ops.
2123
//===----------------------------------------------------------------------===//
@@ -62,7 +64,7 @@ def SPIRV_KHRCooperativeMatrixLengthOp :
6264

6365
// -----
6466

65-
def SPIRV_KHRCooperativeMatrixLoadOp : SPIRV_KhrVendorOp<"CooperativeMatrixLoad", []> {
67+
def SPIRV_KHRCooperativeMatrixLoadOp : SPIRV_KhrVendorOp<"CooperativeMatrixLoad", [DeclareOpInterfaceMethods<AlignmentAttrOpInterface>]> {
6668
let summary = "Loads a cooperative matrix through a pointer";
6769

6870
let description = [{
@@ -148,7 +150,7 @@ def SPIRV_KHRCooperativeMatrixLoadOp : SPIRV_KhrVendorOp<"CooperativeMatrixLoad"
148150

149151
// -----
150152

151-
def SPIRV_KHRCooperativeMatrixStoreOp : SPIRV_KhrVendorOp<"CooperativeMatrixStore", []> {
153+
def SPIRV_KHRCooperativeMatrixStoreOp : SPIRV_KhrVendorOp<"CooperativeMatrixStore", [DeclareOpInterfaceMethods<AlignmentAttrOpInterface>]> {
152154
let summary = "Stores a cooperative matrix through a pointer";
153155

154156
let description = [{

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMemoryOps.td

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#define MLIR_DIALECT_SPIRV_IR_MEMORY_OPS
1616

1717
include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
18+
include "mlir/Interfaces/AlignmentAttrInterface.td"
19+
1820

1921
// -----
2022

@@ -79,7 +81,7 @@ def SPIRV_AccessChainOp : SPIRV_Op<"AccessChain", [Pure]> {
7981

8082
// -----
8183

82-
def SPIRV_CopyMemoryOp : SPIRV_Op<"CopyMemory", []> {
84+
def SPIRV_CopyMemoryOp : SPIRV_Op<"CopyMemory", [DeclareOpInterfaceMethods<AlignmentAttrOpInterface>]> {
8385
let summary = [{
8486
Copy from the memory pointed to by Source to the memory pointed to by
8587
Target. Both operands must be non-void pointers and having the same <id>
@@ -182,7 +184,7 @@ def SPIRV_InBoundsPtrAccessChainOp : SPIRV_Op<"InBoundsPtrAccessChain", [Pure]>
182184

183185
// -----
184186

185-
def SPIRV_LoadOp : SPIRV_Op<"Load", []> {
187+
def SPIRV_LoadOp : SPIRV_Op<"Load", [DeclareOpInterfaceMethods<AlignmentAttrOpInterface>]> {
186188
let summary = "Load through a pointer.";
187189

188190
let description = [{
@@ -310,7 +312,7 @@ def SPIRV_PtrAccessChainOp : SPIRV_Op<"PtrAccessChain", [Pure]> {
310312

311313
// -----
312314

313-
def SPIRV_StoreOp : SPIRV_Op<"Store", []> {
315+
def SPIRV_StoreOp : SPIRV_Op<"Store", [DeclareOpInterfaceMethods<AlignmentAttrOpInterface>]> {
314316
let summary = "Store through a pointer.";
315317

316318
let description = [{

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.h"
2121
#include "mlir/IR/BuiltinOps.h"
2222
#include "mlir/IR/OpImplementation.h"
23+
#include "mlir/Interfaces/AlignmentAttrInterface.h"
2324
#include "mlir/Interfaces/CallInterfaces.h"
2425
#include "mlir/Interfaces/ControlFlowInterfaces.h"
2526
#include "mlir/Interfaces/FunctionInterfaces.h"

0 commit comments

Comments
 (0)