@@ -1138,20 +1138,43 @@ LogicalResult GpuAllocOp::verify() {
11381138}
11391139
11401140// ===-----------------------------------------------------===//
1141- // GpuDeallocOp
1141+ // LiveInOp
11421142// ===-----------------------------------------------------===//
11431143
1144- LogicalResult GpuDeallocOp ::verify () {
1144+ LogicalResult LiveInOp ::verify () {
11451145 // Make sure the input memref defining operation is a GpuAllocOp
1146- if (auto gpuAlloc = dyn_cast<GpuAllocOp>(getMemref ().getDefiningOp ())) {
1147- // Make sure the size is bigger than 0
1148- if (getByteSize (getMemref ().getType ()) > 0 ) {
1149- return success ();
1150- }
1151- return emitError (" The size of rock.dealloc should be greather than zero." );
1152- }
1153- return emitError (" The operand of rock.dealloc must be the result of a "
1154- " rock.alloc operation." );
1146+ if (!isa<GpuAllocOp>(getMemref ().getDefiningOp ()))
1147+ return emitError (" The operand of rock.live_in must be the result of a "
1148+ " rock.alloc operation." );
1149+
1150+ auto memSpace = dyn_cast_or_null<gpu::AddressSpaceAttr>(
1151+ getMemref ().getType ().getMemorySpace ());
1152+ if (!memSpace ||
1153+ (memSpace &&
1154+ memSpace.getValue () != gpu::GPUDialect::getWorkgroupAddressSpace ()))
1155+ return emitError (" The operand of rock.live_in must a LDS memref" );
1156+
1157+ return success ();
1158+ }
1159+
1160+ // ===-----------------------------------------------------===//
1161+ // LiveOutOp
1162+ // ===-----------------------------------------------------===//
1163+
1164+ LogicalResult LiveOutOp::verify () {
1165+ // Make sure the input memref defining operation is a GpuAllocOp
1166+ if (!isa<GpuAllocOp>(getMemref ().getDefiningOp ()))
1167+ return emitError (" The operand of rock.live_out must be the result of a "
1168+ " rock.alloc operation." );
1169+
1170+ auto memSpace = dyn_cast_or_null<gpu::AddressSpaceAttr>(
1171+ getMemref ().getType ().getMemorySpace ());
1172+ if (!memSpace ||
1173+ (memSpace &&
1174+ memSpace.getValue () != gpu::GPUDialect::getWorkgroupAddressSpace ()))
1175+ return emitError (" The operand of rock.live_out must a LDS memref" );
1176+
1177+ return success ();
11551178}
11561179
11571180// ===-----------------------------------------------------===//
0 commit comments