Skip to content

Commit f510aa8

Browse files
author
arnamoy.bhattacharyya
committed
[SYCL-MLIR] Allow i32 ptr(memref) to be argument of sycl.constructor.
1 parent 29a4a89 commit f510aa8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mlir-sycl/include/mlir/Dialect/SYCL/IR/SYCLOps.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def NDItemMemRef : MemRefOf<[SYCL_NdItemType]>;
118118
def GroupMemRef : MemRefOf<[SYCL_GroupType]>;
119119
def VecMemRef : MemRefOf<[SYCL_VecType]>;
120120

121+
121122
def SYCLMemref : AnyTypeOf<[
122123
IDMemRef,
123124
AccessorCommonMemRef,
@@ -134,6 +135,7 @@ def SYCLMemref : AnyTypeOf<[
134135
VecMemRef,
135136
]>;
136137
def IndexType : AnyTypeOf<[I32, I64, Index]>;
138+
def IntMemrefType : AnyTypeOf<[MemRefOf<[I32]>]>;
137139
def SYCLGetResult : AnyTypeOf<[I64, MemRefOf<[I64]>]>;
138140
def SYCLGetIDResult : AnyTypeOf<[I64, SYCL_IDType]>;
139141
def SYCLGetRangeResult : AnyTypeOf<[I64, SYCL_RangeType]>;
@@ -142,7 +144,7 @@ def SYCLGetRangeResult : AnyTypeOf<[I64, SYCL_RangeType]>;
142144
// CONSTRUCTOR OPERATION
143145
////////////////////////////////////////////////////////////////////////////////
144146

145-
def ConstructorArgs : AnyTypeOf<[SYCLMemref, IndexType, SYCL_IDType, SYCL_RangeType]>;
147+
def ConstructorArgs : AnyTypeOf<[SYCLMemref, IndexType, IntMemrefType, SYCL_IDType, SYCL_RangeType]>;
146148
def SYCLConstructorOp : SYCL_Op<"constructor", []> {
147149
let summary = "Generic constructor operation";
148150
let description = [{

mlir-sycl/test/Dialect/IR/SYCL/constructor.mlir

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ func.func @AccessorImplDevice(%arg0: memref<?x!sycl.accessor_impl_device<[1], (!
66
sycl.constructor(%arg0, %arg1, %arg2, %arg2) {MangledFunctionName = @_ZN4sycl3_V16detail18AccessorImplDeviceILi1EEC1ENS0_2idILi1EEENS0_5rangeILi1EEES7_, TypeName = @AccessorImplDevice} : (memref<?x!sycl.accessor_impl_device<[1], (!sycl.id<1>, !sycl.range<1>, !sycl.range<1>)>>, !sycl.id<1>, !sycl.range<1>, !sycl.range<1>) -> ()
77
return
88
}
9+
10+
// Ensure sycl.id and sycl.range types can be arguments of sycl.constructor.
11+
// CHECK-LABEL: func.func @TestConstructorII32Ptr
12+
func.func @TestConstructorII32Ptr(%arg0: memref<?x!sycl.id<1>, 4>, %arg1: memref<?xi32, 1>) {
13+
sycl.constructor(%arg0, %arg1) {MangledFunctionName = @_ZN4sycl3_V19multi_ptrIjLNS0_6access13address_spaceE1ELNS2_9decoratedE1EEC1EPU3AS1j, Type = @multi_ptr} : (memref<?x!sycl.id<1>, 4>, memref<?xi32, 1>) -> ()
14+
return
15+
}

0 commit comments

Comments
 (0)