[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Rapp-dev] RFC: fix insufficient alignment for benchmark run, bug #32835
From: |
Hans-Peter Nilsson |
Subject: |
[Rapp-dev] RFC: fix insufficient alignment for benchmark run, bug #32835 |
Date: |
Fri, 18 Mar 2011 18:58:35 +0100 |
What do you think about this? More details in the bug report.
I think adding a few comments as to the purpose of (adding) that
"offset" would help, but I'm not the right person for that.
Similarly the magic constant "256". And why does RAPP_BMARK_VPAD
contribute just a few bytes when the name (Vertical PADding)
suggests it to be in lines, like vertical padding elsewhere in
RAPP? Maybe it should be renamed something like
RAPP_BMARK_INITIAL_PAD, which seems slightly more accurate?
diff --git a/benchmark/rapp_benchmark.c b/benchmark/rapp_benchmark.c
index 2033026..826662a 100644
--- a/benchmark/rapp_benchmark.c
+++ b/benchmark/rapp_benchmark.c
@@ -534,9 +534,20 @@ rapp_bmark_setup(int width, int height)
int pad_u8 = rapp_align(RAPP_BMARK_VPAD);
int pad_bin = rapp_align((RAPP_BMARK_VPAD + 7) / 8);
int offset = RAPP_BMARK_HPAD*dim_u8 + pad_u8;
- int size = offset + 256 +
- RAPP_BMARK_ROWS*MAX(dim_u8*height + 2*RAPP_BMARK_HPAD,
- rot_u8*width + 2*RAPP_BMARK_HPAD);
+ int size;
+
+ /**
+ * We perform an extra alignment of "offset", since it adjusts
+ * pointers to types that might require alignment larger than
+ * RAPP_ALIGNMEMT, e.g. uintmax_t being 64 bits and requiring
+ * 64-bit alignments on a target with 32-bit pointers and
+ * RC_ALIGNMENT 4, such as sparc64 with the 32-bit ABI.
+ * We assume that doubling the alignment is sufficient.
+ */
+ offset = 2*rapp_align(offset / 2 + 1);
+ size = offset + 256 +
+ RAPP_BMARK_ROWS*MAX(dim_u8*height + 2*RAPP_BMARK_HPAD,
+ rot_u8*width + 2*RAPP_BMARK_HPAD);
rapp_bmark_data.dst = rapp_malloc(size, 0);
rapp_bmark_data.set = rapp_malloc(size, 0);
diff --git a/compute/tune/benchmark/rc_benchmark.c
b/compute/tune/benchmark/rc_benchmark.c
index be86159..7cfad8a 100644
--- a/compute/tune/benchmark/rc_benchmark.c
+++ b/compute/tune/benchmark/rc_benchmark.c
@@ -660,6 +660,16 @@ rc_bmark_setup(void *lib, int width, int height)
dim_bin = (*align)((width + 7) / 8) + 2*pad;
rot_u8 = (*align)(height);
offset = RC_BMARK_PADDING*dim_u8 + pad;
+
+ /**
+ * We perform an extra alignment of "offset", since it adjusts
+ * pointers to types that might require alignment larger than
+ * RAPP_ALIGNMEMT, e.g. uintmax_t being 64 bits and requiring
+ * 64-bit alignments on a target with 32-bit pointers and
+ * RC_ALIGNMENT 4, such as sparc64 with the 32-bit ABI.
+ * We assume that doubling the alignment is sufficient.
+ */
+ offset = 2*align(offset / 2 + 1);
size = MAX(dim_u8*(height + RC_BMARK_PADDING), rot_u8*width) + offset;
rc_bmark_data.dst = (*alloc)(size);
brgds, H-P
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Rapp-dev] RFC: fix insufficient alignment for benchmark run, bug #32835,
Hans-Peter Nilsson <=