diff --git a/Src/ILGPU/Runtime/CPU/CPUMemoryBuffer.cs b/Src/ILGPU/Runtime/CPU/CPUMemoryBuffer.cs index 133f858aa..ef32f407b 100644 --- a/Src/ILGPU/Runtime/CPU/CPUMemoryBuffer.cs +++ b/Src/ILGPU/Runtime/CPU/CPUMemoryBuffer.cs @@ -92,8 +92,12 @@ public static void CPUCopyFrom( in ArrayView targetView) where T : unmanaged { - if (targetView.GetAcceleratorType() != AcceleratorType.CPU) + switch (targetView.GetAcceleratorType()) { + case AcceleratorType.CPU: + case AcceleratorType.Velocity: + break; + default: throw new NotSupportedException( RuntimeErrorMessages.NotSupportedTargetAccelerator); } @@ -107,6 +111,7 @@ public static void CPUCopyFrom( switch (sourceView.GetAcceleratorType()) { case AcceleratorType.CPU: + case AcceleratorType.Velocity: // Copy from CPU to CPU CPUCopyToCPU( ref sourceView.LoadEffectiveAddress(), @@ -157,10 +162,14 @@ public static void CPUCopyTo( in ArrayView targetView) where T : unmanaged { - if (sourceView.GetAcceleratorType() != AcceleratorType.CPU) + switch (sourceView.GetAcceleratorType()) { - throw new NotSupportedException( - RuntimeErrorMessages.NotSupportedTargetAccelerator); + case AcceleratorType.CPU: + case AcceleratorType.Velocity: + break; + default: + throw new NotSupportedException( + RuntimeErrorMessages.NotSupportedTargetAccelerator); } if (targetView.Length > sourceView.Length) throw new ArgumentOutOfRangeException(nameof(sourceView)); @@ -172,6 +181,7 @@ public static void CPUCopyTo( switch (targetView.GetAcceleratorType()) { case AcceleratorType.CPU: + case AcceleratorType.Velocity: // Copy from CPU to CPU CPUCopyToCPU( ref sourceView.LoadEffectiveAddress(), @@ -223,11 +233,14 @@ public static void CPUCopy( in ArrayView targetView) where T : unmanaged { - if (sourceView.GetAcceleratorType() == AcceleratorType.CPU) + if (sourceView.GetAcceleratorType() == AcceleratorType.CPU || + sourceView.GetAcceleratorType() == AcceleratorType.Velocity) { CPUCopyTo(stream, sourceView, targetView); } - else if (targetView.GetAcceleratorType() == AcceleratorType.CPU) + else if ( + targetView.GetAcceleratorType() == AcceleratorType.CPU || + sourceView.GetAcceleratorType() == AcceleratorType.Velocity) { CPUCopyFrom(stream, sourceView, targetView); }