diff --git a/Src/ILGPU/Runtime/CPU/CPUAccelerator.cs b/Src/ILGPU/Runtime/CPU/CPUAccelerator.cs
index c502ff3308..18c46c4e5a 100644
--- a/Src/ILGPU/Runtime/CPU/CPUAccelerator.cs
+++ b/Src/ILGPU/Runtime/CPU/CPUAccelerator.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2016-2021 ILGPU Project
+// Copyright (c) 2016-2022 ILGPU Project
// www.ilgpu.net
//
// File: CPUAccelerator.cs
@@ -12,6 +12,7 @@
using ILGPU.Backends;
using ILGPU.Backends.IL;
using ILGPU.Resources;
+using ILGPU.Runtime.Velocity;
using System;
using System.Diagnostics;
using System.Reflection;
@@ -240,12 +241,13 @@ protected override void OnUnbind() { }
///
protected override bool CanAccessPeerInternal(Accelerator otherAccelerator) =>
- otherAccelerator as CPUAccelerator != null;
+ otherAccelerator is CPUAccelerator ||
+ otherAccelerator is VelocityAccelerator;
///
protected override void EnablePeerAccessInternal(Accelerator otherAccelerator)
{
- if (otherAccelerator as CPUAccelerator == null)
+ if (!CanAccessPeerInternal(otherAccelerator))
{
throw new InvalidOperationException(
RuntimeErrorMessages.CannotEnablePeerAccessToOtherAccelerator);
@@ -256,7 +258,7 @@ protected override void EnablePeerAccessInternal(Accelerator otherAccelerator)
protected override void DisablePeerAccessInternal(
Accelerator otherAccelerator) =>
Debug.Assert(
- otherAccelerator is CPUAccelerator,
+ CanAccessPeerInternal(otherAccelerator),
"Invalid EnablePeerAccess method");
#endregion
@@ -472,7 +474,7 @@ protected override int EstimateGroupSizeInternal(
#region Page Lock Scope
///
- protected unsafe override PageLockScope CreatePageLockFromPinnedInternal(
+ protected override PageLockScope CreatePageLockFromPinnedInternal(
IntPtr pinned,
long numElements)
{