Example #1
0
        private Dictionary <string, int> GetAssignmentCounts(Implementation impl)
        {
            Dictionary <string, int> result = new Dictionary <string, int>();

            foreach (var c in verifier.RootRegion(impl).Cmds())
            {
                if (c is AssignCmd)
                {
                    var aCmd = (AssignCmd)c;
                    HashSet <string> alreadySeenInThisAssignment = new HashSet <string>();
                    foreach (var a in aCmd.Lhss)
                    {
                        if (a is SimpleAssignLhs)
                        {
                            var v = GVUtil.StripThreadIdentifier(
                                ((SimpleAssignLhs)a).AssignedVariable.Name);
                            if (!alreadySeenInThisAssignment.Contains(v))
                            {
                                if (result.ContainsKey(v))
                                {
                                    result[v]++;
                                }
                                else
                                {
                                    result[v] = 1;
                                }
                                alreadySeenInThisAssignment.Add(v);
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #2
0
        void Analyse()
        {
            var cfg         = verifier.Program.ProcessLoops(impl);
            var modSet      = LoopInvariantGenerator.GetModifiedVariables(verifier.RootRegion(impl));
            var multiDefMap = new VarDefMap();

            FindAssignments(verifier.RootRegion(impl), multiDefMap);
            foreach (var e in multiDefMap.Where(i => i.Value.Count == 2))
            {
                AnalyseAssignment(e.Key, e.Value, cfg, modSet);
            }
        }
Example #3
0
        public static VariableDefinitionAnalysisRegion Analyse(Implementation impl, GPUVerifier verifier)
        {
            var a = new VariableDefinitionAnalysisRegion(verifier);

            a.Analyse(verifier.RootRegion(impl), verifier.Program.ProcessLoops(impl));
            return(a);
        }
 public static void EstablishDisabledLoops(GPUVerifier verifier, Implementation impl)
 {
     foreach (var region in verifier.RootRegion(impl).SubRegions())
     {
         if (!AccessesGlobalArrayOrUnsafeBarrier(region, verifier))
         {
             verifier.AddRegionWithLoopInvariantsDisabled(region);
         }
     }
 }
 internal void DoAbstractHoudiniTransform()
 {
     foreach (var region in verifier.Program.Implementations
              .Select(item => verifier.RootRegion(item).SubRegions()).SelectMany(item => item))
     {
         TransformRegion(region);
     }
     AddExistentialFunctions();
     RemoveExistentialConstants();
 }
        public static void PreInstrument(GPUVerifier verifier, Implementation impl)
        {
            foreach (var region in verifier.RootRegion(impl).SubRegions())
            {
                if (verifier.RegionHasLoopInvariantsDisabled(region))
                {
                    continue;
                }

                GenerateCandidateForReducedStrengthStrideVariables(verifier, impl, region);
                GenerateCandidateForNonNegativeGuardVariables(verifier, impl, region);
                GenerateCandidateForNonUniformGuardVariables(verifier, impl, region);
                GenerateCandidateForLoopBounds(verifier, impl, region);
                GenerateCandidateForEnabledness(verifier, impl, region);
                GenerateCandidateForEnablednessWhenAccessingSharedArrays(verifier, impl, region);
            }
        }
 private void Analyse(Implementation impl)
 {
     Analyse(impl, verifier.RootRegion(impl));
 }