@@ -80,6 +80,7 @@ void SYCLFuncDescriptor::declareFunction(ModuleOp &module, OpBuilder &b) {
8080
8181bool SYCLAccessorFuncDescriptor::isValid (FuncId funcId) const {
8282 switch (funcId) {
83+ case FuncId::AccessorInt1ReadWriteGlobalBufferFalseCtorDefault:
8384 case FuncId::AccessorInt1ReadWriteGlobalBufferFalseInit:
8485 return true ;
8586 default :
@@ -180,11 +181,12 @@ SYCLFuncRegistry::getFuncId(SYCLFuncDescriptor::FuncKind funcKind, Type retType,
180181 continue ;
181182 }
182183 if (desc.argTys .size () != argTypes.size ()) {
183- LLVM_DEBUG (llvm::dbgs () << " \t skip, number of arguments does not match\n " );
184+ LLVM_DEBUG (llvm::dbgs ()
185+ << " \t skip, number of arguments does not match\n " );
184186 continue ;
185187 }
186188 if (!std::equal (argTypes.begin (), argTypes.end (), desc.argTys .begin ())) {
187- LLVM_DEBUG (llvm::dbgs () << " \t skip, arguments types do not match\n " );
189+ LLVM_DEBUG (llvm::dbgs () << " \t skip, arguments types do not match\n " );
188190 continue ;
189191 }
190192
@@ -212,19 +214,35 @@ void SYCLFuncRegistry::declareAccessorFuncDescriptors(
212214 MLIRContext *context = module .getContext ();
213215 auto voidTy = LLVM::LLVMVoidType::get (context);
214216 auto i32Ty = IntegerType::get (context, 32 );
215- auto i32PtrTy = LLVM::LLVMPointerType::get (i32Ty);
216- Type accessorInt1ReadWriteGlobalBufferPtrTy =
217- converter.convertType (MemRefType::get (
218- -1 , AccessorType::get (context, i32Ty, 1 , MemoryAccessMode::ReadWrite,
219- MemoryTargetMode::GlobalBuffer, {})));
220- Type id1Ty = converter.convertType (IDType::get (context, 1 ));
221- Type range1Ty = converter.convertType (RangeType::get (context, 1 ));
217+ auto i32PtrTy = converter.convertType (MemRefType::get (-1 , i32Ty));
218+
219+ constexpr unsigned int dim = 1 ;
220+ Type id1SYCLTy = IDType::get (context, dim);
221+ Type range1SYCLTy = RangeType::get (context, dim);
222+ Type accessorImplDeviceSYCLTy = AccessorImplDeviceType::get (
223+ context, dim, {id1SYCLTy, range1SYCLTy, range1SYCLTy});
224+ Type accessorInt1ReadWriteGlobalBufferSYCLTy = AccessorType::get (
225+ context, i32Ty, dim, MemoryAccessMode::ReadWrite,
226+ MemoryTargetMode::GlobalBuffer, {accessorImplDeviceSYCLTy});
227+ Type accessorInt1ReadWriteGlobalBufferPtrTy = converter.convertType (
228+ MemRefType::get (-1 , accessorInt1ReadWriteGlobalBufferSYCLTy));
229+
230+ Type id1Ty = converter.convertType (id1SYCLTy);
231+ Type range1Ty = converter.convertType (range1SYCLTy);
222232
223233 // Construct the SYCL functions descriptors for the sycl::accessor<n> type.
224234 // Descriptor format: (enum, function name, signature).
225235 // clang-format off
226236 std::vector<SYCLFuncDescriptor> descriptors = {
227237 // sycl::accessor<int, 1, read_write, global_buffer, (placeholder)0>::
238+ // accessor()
239+ SYCLAccessorFuncDescriptor (
240+ FuncId::AccessorInt1ReadWriteGlobalBufferFalseCtorDefault,
241+ " _ZN2cl4sycl8accessorIiLi1ELNS0_6access4modeE1026ELNS2_"
242+ " 6targetE2014ELNS2_11placeholderE0ENS0_3ext6oneapi22accessor_"
243+ " property_listIJEEEEC2Ev" ,
244+ voidTy, {accessorInt1ReadWriteGlobalBufferPtrTy}),
245+ // sycl::accessor<int, 1, read_write, global_buffer, (placeholder)0>::
228246 // __init(int AS1*, sycl::range<1>, sycl::range<1>, sycl::id<1>)
229247 SYCLAccessorFuncDescriptor (
230248 FuncId::AccessorInt1ReadWriteGlobalBufferFalseInit,
0 commit comments