From 5a18737617935f6e51a9bccfa7947b488f38acc2 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 6 Sep 2024 17:05:30 +0200 Subject: [PATCH] Fix BOArray BO allocation --- CHANGELOG | 1 + src/xrt_bo.jl | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 96912de..21b9219 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ ## Unreleased +- Fix order of BO arguments in BOArray constructor which lead to allocation errors - Convert prepare_bitstream function to macro and fix signature generation - Minor changes in method names (adding ! to some methods because they change their input parameters) - Move wrapped API to XRTWrap submodule to support easier extension of core functionality diff --git a/src/xrt_bo.jl b/src/xrt_bo.jl index 73c0935..f9438a3 100644 --- a/src/xrt_bo.jl +++ b/src/xrt_bo.jl @@ -79,7 +79,7 @@ function BOArray(device::Device, userdata::AbstractArray{T,N}, mem; flags::XRTWr else aligned_buffer = userdata end - bo = BO(device, Base.unsafe_convert(Ptr{Nothing}, aligned_buffer), length(aligned_buffer) * sizeof(eltype(aligned_buffer)), mem, flags) + bo = BO(device, Base.unsafe_convert(Ptr{Nothing}, aligned_buffer), sizeof(aligned_buffer), flags, mem) BOArray(bo, aligned_buffer) end @@ -91,7 +91,7 @@ alignment of host buffers. """ function BOArray{T,N}(device::Device, size, mem; flags::XRTWrap.BOFlags=XRTWrap.XRT_BO_FLAGS_NORMAL) where {T,N} aligned_buffer = Array{T,N}(MemAlign(4096), size) - bo = BO(device, Base.unsafe_convert(Ptr{Nothing}, aligned_buffer), length(aligned_buffer) * sizeof(eltype(aligned_buffer)), mem, flags) + bo = BO(device, Base.unsafe_convert(Ptr{Nothing}, aligned_buffer), length(aligned_buffer) * sizeof(eltype(aligned_buffer)), flags, mem) BOArray(bo, aligned_buffer) end