Permalink
Browse files

Fixed bug in bookeeping of allocated/freed objects, fixing bitonic so…

…rt. Clean up.
  • Loading branch information...
kaby76 committed Mar 21, 2018
1 parent 686f6ec commit 4ede1e1cdf270799ca14eddd8d512dbfee73f2a5
Showing with 99 additions and 7,050 deletions.
  1. +18 −10 Campy.Compiler/buffers.cs
  2. +1 −1 Campy.Compiler/cfg.cs
  3. +0 −24 Campy.Graphs/x
  4. +0 −6,953 Campy.Graphs/y
  5. +0 −2 Campy.sln
  6. +80 −32 ConsoleApp4/Program.cs
  7. +0 −13 UnitTestProject1/UnitTest1.cs
  8. +0 −15 UnitTestProject1/UnitTestProject1.csproj
View
@@ -225,25 +225,32 @@ public void SynchDataStructures()
// "top level" data structures.
Stack<object> nuke = new Stack<object>();
foreach (object k in _copied_to_gpu)
foreach (object back_to_cpu in _copied_to_gpu)
{
if (_never_copy_from_gpu.Contains(k))
if (_never_copy_from_gpu.Contains(back_to_cpu))
continue;
if (_delayed_from_gpu.Contains(k))
if (_delayed_from_gpu.Contains(back_to_cpu))
continue;
if (!_allocated_objects.ContainsKey(k))
if (!_allocated_objects.ContainsKey(back_to_cpu))
continue; // Honestly, this is actually a problem as the object was somehow lost.
if (!_allocated_object_level.ContainsKey(k))
if (!_allocated_object_level.ContainsKey(back_to_cpu))
throw new Exception();
IntPtr v = _allocated_objects[k];
IntPtr gpu_buffer_pointer = _allocated_objects[back_to_cpu];
if (Campy.Utils.Options.IsOn("copy_trace"))
{
System.Console.Write("Copying GPU buffer {0:X}", gpu_buffer_pointer.ToInt64());
System.Console.Write(" back to CPU object " + back_to_cpu);
System.Console.WriteLine();
}
DeepCopyFromImplementation(v, out object to, k.GetType());
DeepCopyFromImplementation(gpu_buffer_pointer, out object to, back_to_cpu.GetType());
nuke.Push(k);
nuke.Push(back_to_cpu);
}
// After copying object back to CPU, we need to delete the GPU copy
@@ -256,6 +263,7 @@ public void SynchDataStructures()
_copied_to_gpu.Remove(k);
_allocated_objects.Remove(k);
_copied_from_gpu.Remove(k);
_allocated_buffers.Remove(v);
Free(v);
}
@@ -760,7 +768,7 @@ public unsafe void DeepCopyFromImplementation(IntPtr from_gpu, out object to_cpu
to_cpu = to_array;
if (to_cpu != default(Array))
if (to_cpu != null)
{
if (_delayed_from_gpu.Contains(to_cpu))
{
@@ -839,7 +847,7 @@ public unsafe void DeepCopyFromImplementation(IntPtr from_gpu, out object to_cpu
_allocated_buffers[from_gpu] = to_cpu;
if (to_cpu != default(Array))
if (to_cpu != null)
{
if (_delayed_from_gpu.Contains(to_cpu))
{
View
@@ -394,7 +394,7 @@ public void OutputEntireGraph()
return;
System.Console.WriteLine("Graph:");
System.Console.WriteLine();
System.Console.WriteLine("List of entries blocks:");
System.Console.WriteLine("List of entry blocks:");
System.Console.WriteLine(new String(' ', 4) + "Node" + new string(' ', 4) + "Method");
foreach (Vertex n in this._entries)
{
View

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 4ede1e1

Please sign in to comment.