From 10a7381d7e0964d0d7be62cd1ccd7f54b73c640b Mon Sep 17 00:00:00 2001 From: jnice-81 <68808325+jnice-81@users.noreply.github.com> Date: Thu, 1 Jul 2021 13:14:01 +0200 Subject: [PATCH] Added missing support for MemoryBank::unspecified to new API --- include/hlslib/common/OpenCL.h | 6 ++++-- intel_test/host/RunJacobi2D.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/hlslib/common/OpenCL.h b/include/hlslib/common/OpenCL.h index 3e9b1a5..ba117d9 100644 --- a/include/hlslib/common/OpenCL.h +++ b/include/hlslib/common/OpenCL.h @@ -259,10 +259,12 @@ MemoryBank StorageTypeToMemoryBank(StorageType storage, int bank) { if (storage != StorageType::DDR) { ThrowRuntimeError("Only DDR bank identifiers can be converted to memory bank flags."); } - if (bank < 0 || bank > 3) { - ThrowRuntimeError("Bank identifier is out of range (must be [0-3])."); + if (bank < -1 || bank > 3) { + ThrowRuntimeError("Bank identifier is out of range (must be [0-3] or -1 for unspecified)."); } switch (bank) { + case -1: + return MemoryBank::unspecified; case 0: return MemoryBank::bank0; case 1: diff --git a/intel_test/host/RunJacobi2D.cpp b/intel_test/host/RunJacobi2D.cpp index 78232af..230f520 100644 --- a/intel_test/host/RunJacobi2D.cpp +++ b/intel_test/host/RunJacobi2D.cpp @@ -96,7 +96,7 @@ int main(int argc, char **argv) { std::copy(host_buffer.begin(), host_buffer.end(), copy_host_buffer.begin() + kW * kH); device_buffer = context.MakeBuffer( - hlslib::ocl::StorageType::DDR, 1, copy_host_buffer.begin(), + hlslib::ocl::StorageType::DDR, -1, copy_host_buffer.begin(), copy_host_buffer.end()); } else if (copyMode == "newapi_notransfer") { device_buffer = context.MakeBuffer(