Skip to content

Commit

Permalink
Fix BOArray BO allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mellich committed Sep 6, 2024
1 parent 34c404b commit 5a18737
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/xrt_bo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 5a18737

Please sign in to comment.