Skip to content

Commit

Permalink
fix 3D allocation (ZY->XY stride)
Browse files Browse the repository at this point in the history
  • Loading branch information
computablee committed Nov 27, 2023
1 parent cc314e9 commit 6541e09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions DotMP/GPU/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public sealed class Buffer<T> : IDisposable
/// <summary>
/// The ILGPU buffer for 3D arrays.
/// </summary>
private MemoryBuffer3D<T, Stride3D.DenseZY> buf3d;
private MemoryBuffer3D<T, Stride3D.DenseXY> buf3d;

/// <summary>
/// Behavior of the data, as specified by Behavior.
Expand Down Expand Up @@ -182,11 +182,11 @@ public Buffer(T[,,] data, Buffer.Behavior behavior)
{
case Buffer.Behavior.To:
case Buffer.Behavior.ToFrom:
buf3d = AcceleratorHandler.accelerator.Allocate3DDenseZY(data);
buf3d = AcceleratorHandler.accelerator.Allocate3DDenseXY<T>(data);
break;
case Buffer.Behavior.From:
case Buffer.Behavior.NoCopy:
buf3d = AcceleratorHandler.accelerator.Allocate3DDenseZY<T>((data.GetLength(0), data.GetLength(1), data.GetLength(2)));
buf3d = AcceleratorHandler.accelerator.Allocate3DDenseXY<T>((data.GetLength(0), data.GetLength(1), data.GetLength(2)));
break;
}

Expand Down Expand Up @@ -240,6 +240,6 @@ public void Dispose()
/// <summary>
/// Get the view of the memory for the GPU.
/// </summary>
internal ArrayView3D<T, Stride3D.DenseZY> View3D { get => buf3d.View; }
internal ArrayView3D<T, Stride3D.DenseXY> View3D { get => buf3d.View; }
}
}
2 changes: 1 addition & 1 deletion DotMP/GPU/GpuArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public struct GPUArray<T>
/// <summary>
/// The ILGPU view for 3D arrays.
/// </summary>
private ArrayView3D<T, Stride3D.DenseZY> view3d;
private ArrayView3D<T, Stride3D.DenseXY> view3d;

/// <summary>
/// Number of dimensions.
Expand Down

0 comments on commit 6541e09

Please sign in to comment.