[oclgrind] 01/03: Fix unaligned memory accesses causing armhf failures

James Price jprice-guest at moszumanska.debian.org
Thu Jan 19 13:10:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

jprice-guest pushed a commit to branch master
in repository oclgrind.

commit a4c7c06a5e81b8568ba07fcad8c8200befb204a8
Author: James Price <j.price at bristol.ac.uk>
Date:   Thu Jan 19 12:59:19 2017 +0000

    Fix unaligned memory accesses causing armhf failures
---
 debian/patches/align-alloc.patch | 39 +++++++++++++++++++++++++++++++++++++++
 debian/patches/series            |  1 +
 2 files changed, 40 insertions(+)

diff --git a/debian/patches/align-alloc.patch b/debian/patches/align-alloc.patch
new file mode 100644
index 0000000..9e3232c
--- /dev/null
+++ b/debian/patches/align-alloc.patch
@@ -0,0 +1,39 @@
+Author: James Price <j.price at bristol.ac.uk>
+Description: Align offsets in pool allocator
+Origin: upstream commit c19cb13
+Last-Update: 2017-01-19
+--- a/src/core/common.cpp
++++ b/src/core/common.cpp
+@@ -808,6 +808,9 @@
+ 
+   uint8_t* MemoryPool::alloc(size_t size)
+   {
++    if (size == 0)
++      return NULL;
++
+     // Check if requested size larger than block size
+     if (size > m_blockSize)
+     {
+@@ -817,6 +820,22 @@
+       return buffer;
+     }
+ 
++    // Round up size to nearest power of two for alignment
++    // Taken from here:
++    //   http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
++    unsigned align = size;
++    align--;
++    align |= align >> 1;
++    align |= align >> 2;
++    align |= align >> 4;
++    align |= align >> 8;
++    align |= align >> 16;
++    align++;
++
++    // Align offset to size of requested allocation
++    if (m_offset & (align-1))
++      m_offset += (align - (m_offset & (align-1)));
++
+     // Check if enough space in current block
+     if (m_offset + size > m_blockSize)
+     {
diff --git a/debian/patches/series b/debian/patches/series
index 74fb111..31d46c6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ library-versions.patch
 pch-location.patch
 use-opencl-headers.patch
 altivec-fix.patch
+align-alloc.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/oclgrind.git



More information about the Pkg-opencl-commits mailing list