public HashSet <Variable> FindWrittenGroupSharedArrays(GPUVerifier verifier) { // We add any group-shared array that may be written to or accessed atomically // in the region. // // We also add any group-shared array that may be written to by an asynchronous // memory copy somewhere in the kernel. This is because asynchronous copies can // cross barriers. Currently we are very conservative about this. HashSet <Variable> result = new HashSet <Variable>(); foreach (var v in verifier.KernelArrayInfo.GetGroupSharedArrays(false)) { if (verifier.ArraysAccessedByAsyncWorkGroupCopy[AccessType.WRITE].Contains(v.Name)) { result.Add(v); } } foreach (var m in Blocks.Select(item => item.Cmds).SelectMany(item => item).OfType <CallCmd>() .Select(item => item.Proc.Modifies).SelectMany(item => item)) { // m is a variable modified by a call in the barrier interval Variable v; if (verifier.TryGetArrayFromAccessHasOccurred(Utilities.StripThreadIdentifier(m.Name), AccessType.WRITE, out v) || verifier.TryGetArrayFromAccessHasOccurred(Utilities.StripThreadIdentifier(m.Name), AccessType.ATOMIC, out v)) { if (verifier.KernelArrayInfo.GetGroupSharedArrays(false).Contains(v)) { result.Add(v); } } } return(result); }