Lines Matching refs:spirv
45 auto idx = builder.create<spirv::ConstantOp>(loc, targetType, idxAttr); in getOffsetForBitwidth()
48 builder.create<spirv::ConstantOp>(loc, targetType, srcBitsAttr); in getOffsetForBitwidth()
49 auto m = builder.create<spirv::UModOp>(loc, srcIdx, idx); in getOffsetForBitwidth()
50 return builder.create<spirv::IMulOp>(loc, targetType, m, srcBitsValue); in getOffsetForBitwidth()
62 spirv::AccessChainOp op, in adjustAccessChainForBitwidth()
70 auto idx = builder.create<spirv::ConstantOp>(loc, targetType, attr); in adjustAccessChainForBitwidth()
75 indices.back() = builder.create<spirv::SDivOp>(loc, lastDim, idx); in adjustAccessChainForBitwidth()
77 return builder.create<spirv::AccessChainOp>(loc, t, op.base_ptr(), indices); in adjustAccessChainForBitwidth()
84 Value result = builder.create<spirv::BitwiseAndOp>(loc, value, mask); in shiftValue()
85 return builder.create<spirv::ShiftLeftLogicalOp>(loc, targetType, result, in shiftValue()
94 spirv::StorageClass::Workgroup) != type.getMemorySpaceAsInt()) in isAllocationSupported()
98 spirv::StorageClass::Function) != type.getMemorySpaceAsInt()) in isAllocationSupported()
118 static Optional<spirv::Scope> getAtomicOpScope(MemRefType type) { in getAtomicOpScope()
119 Optional<spirv::StorageClass> storageClass = in getAtomicOpScope()
125 case spirv::StorageClass::StorageBuffer: in getAtomicOpScope()
126 return spirv::Scope::Device; in getAtomicOpScope()
127 case spirv::StorageClass::Workgroup: in getAtomicOpScope()
128 return spirv::Scope::Workgroup; in getAtomicOpScope()
140 auto one = spirv::ConstantOp::getOne(srcInt.getType(), loc, builder); in castIntNToBool()
141 return builder.create<spirv::IEqualOp>(loc, srcInt, one); in castIntNToBool()
150 Value zero = spirv::ConstantOp::getZero(dstType, loc, builder); in castBoolToIntN()
151 Value one = spirv::ConstantOp::getOne(dstType, loc, builder); in castBoolToIntN()
152 return builder.create<spirv::SelectOp>(loc, dstType, srcBool, one, zero); in castBoolToIntN()
254 rewriter.replaceOpWithNewOp<spirv::VariableOp>(allocaOp, spirvType, in matchAndRewrite()
255 spirv::StorageClass::Function, in matchAndRewrite()
280 spirv::GlobalVariableOp varOp; in matchAndRewrite()
285 auto varOps = entryBlock.getOps<spirv::GlobalVariableOp>(); in matchAndRewrite()
289 varOp = rewriter.create<spirv::GlobalVariableOp>(loc, spirvType, varName, in matchAndRewrite()
294 rewriter.replaceOpWithNewOp<spirv::AddressOfOp>(operation, varOp); in matchAndRewrite()
326 spirv::AccessChainOp accessChainOp = in matchAndRewrite()
327 spirv::getElementPtr(typeConverter, memrefType, adaptor.getMemref(), in matchAndRewrite()
338 .cast<spirv::PointerType>() in matchAndRewrite()
340 Type structElemType = pointeeType.cast<spirv::StructType>().getElementType(0); in matchAndRewrite()
342 if (auto arrayType = structElemType.dyn_cast<spirv::ArrayType>()) in matchAndRewrite()
345 dstType = structElemType.cast<spirv::RuntimeArrayType>().getElementType(); in matchAndRewrite()
354 rewriter.create<spirv::LoadOp>(loc, accessChainOp.getResult()); in matchAndRewrite()
367 Value spvLoadOp = rewriter.create<spirv::LoadOp>( in matchAndRewrite()
369 loadOp->getAttrOfType<spirv::MemoryAccessAttr>( in matchAndRewrite()
370 spirv::attributeName<spirv::MemoryAccess>()), in matchAndRewrite()
377 Value result = rewriter.create<spirv::ShiftRightArithmeticOp>( in matchAndRewrite()
381 Value mask = rewriter.create<spirv::ConstantOp>( in matchAndRewrite()
383 result = rewriter.create<spirv::BitwiseAndOp>(loc, dstType, result, mask); in matchAndRewrite()
391 rewriter.create<spirv::ConstantOp>(loc, dstType, shiftValueAttr); in matchAndRewrite()
392 result = rewriter.create<spirv::ShiftLeftLogicalOp>(loc, dstType, result, in matchAndRewrite()
394 result = rewriter.create<spirv::ShiftRightArithmeticOp>(loc, dstType, result, in matchAndRewrite()
399 mask = spirv::ConstantOp::getOne(result.getType(), loc, rewriter); in matchAndRewrite()
400 result = rewriter.create<spirv::IEqualOp>(loc, result, mask); in matchAndRewrite()
403 result = rewriter.create<spirv::SConvertOp>(loc, dstType, result); in matchAndRewrite()
419 auto loadPtr = spirv::getElementPtr( in matchAndRewrite()
426 rewriter.replaceOpWithNewOp<spirv::LoadOp>(loadOp, loadPtr); in matchAndRewrite()
439 spirv::AccessChainOp accessChainOp = in matchAndRewrite()
440 spirv::getElementPtr(typeConverter, memrefType, adaptor.getMemref(), in matchAndRewrite()
453 .cast<spirv::PointerType>() in matchAndRewrite()
455 Type structElemType = pointeeType.cast<spirv::StructType>().getElementType(0); in matchAndRewrite()
457 if (auto arrayType = structElemType.dyn_cast<spirv::ArrayType>()) in matchAndRewrite()
460 dstType = structElemType.cast<spirv::RuntimeArrayType>().getElementType(); in matchAndRewrite()
469 rewriter.replaceOpWithNewOp<spirv::StoreOp>( in matchAndRewrite()
491 Value mask = rewriter.create<spirv::ConstantOp>( in matchAndRewrite()
494 rewriter.create<spirv::ShiftLeftLogicalOp>(loc, dstType, mask, offset); in matchAndRewrite()
495 clearBitsMask = rewriter.create<spirv::NotOp>(loc, dstType, clearBitsMask); in matchAndRewrite()
503 Optional<spirv::Scope> scope = getAtomicOpScope(memrefType); in matchAndRewrite()
506 Value result = rewriter.create<spirv::AtomicAndOp>( in matchAndRewrite()
507 loc, dstType, adjustedPtr, *scope, spirv::MemorySemantics::AcquireRelease, in matchAndRewrite()
509 result = rewriter.create<spirv::AtomicOrOp>( in matchAndRewrite()
510 loc, dstType, adjustedPtr, *scope, spirv::MemorySemantics::AcquireRelease, in matchAndRewrite()
531 auto storePtr = spirv::getElementPtr( in matchAndRewrite()
538 rewriter.replaceOpWithNewOp<spirv::StoreOp>(storeOp, storePtr, in matchAndRewrite()