Commit 54d0b418 authored by Swann Perarnau's avatar Swann Perarnau
Browse files

[fix] enforce type convertion, better pointer management

Fix small issues with type convertion across several tests,
as a change of architecture might trigger bad behavior in
variadic functions.
parent c445b498
......@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
/* create scratchpad */
assert(!aml_scratch_par_init(&scratch, &area, &area, &dma, &tiling,
NBTILES, NBTILES));
(size_t)NBTILES, (size_t)NBTILES));
dst = aml_scratch_baseptr(&scratch);
/* move some stuff */
for(int i = 0; i < NBTILES; i++)
......
......@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
/* create scratchpad */
assert(!aml_scratch_seq_init(&scratch, &area, &area, &dma, &tiling,
NBTILES, NBTILES));
(size_t)NBTILES, (size_t)NBTILES));
dst = aml_scratch_baseptr(&scratch);
/* move some stuff */
for(int i = 0; i < NBTILES; i++)
......
......@@ -64,9 +64,9 @@ int main(int argc, char *argv[])
&arena, MPOL_BIND, nodemask));
assert(!aml_dma_linux_par_init(&dma, numthreads*2, numthreads));
assert(!aml_scratch_seq_init(&sa, &fast, &slow, &dma, &tiling,
2*numthreads, 1));
(size_t)2*numthreads, (size_t)1));
assert(!aml_scratch_seq_init(&sb, &fast, &slow, &dma, &tiling,
2*numthreads, 1));
(size_t)2*numthreads, (size_t)1));
/* allocation */
a = aml_area_malloc(&slow, MEMSIZE);
......
......@@ -31,11 +31,12 @@ void do_work(unsigned long tid)
{
int offset, i, ai, bi, oldai, oldbi;
unsigned long *ap, *bp;
unsigned long *ap, *bp, *cp;
void *abaseptr, *bbaseptr;
offset = tid*CHUNKING;
ap = aml_tiling_tilestart(&tiling, a, offset);
bp = aml_tiling_tilestart(&tiling, b, offset);
cp = aml_tiling_tilestart(&tiling, c, offset);
abaseptr = aml_scratch_baseptr(&sa);
bbaseptr = aml_scratch_baseptr(&sb);
ai = -1; bi = -1;
......@@ -44,15 +45,16 @@ void do_work(unsigned long tid)
oldai = ai; oldbi = bi;
aml_scratch_async_pull(&sa, &ar, abaseptr, &ai, a, offset+i+1);
aml_scratch_async_pull(&sb, &br, bbaseptr, &bi, b, offset+i+1);
kernel(ap, bp, &c[(offset+i)*esz], esz);
kernel(ap, bp, cp, esz);
aml_scratch_wait(&sa, ar);
aml_scratch_wait(&sb, br);
ap = aml_tiling_tilestart(&tiling, abaseptr, ai);
bp = aml_tiling_tilestart(&tiling, bbaseptr, bi);
cp = aml_tiling_tilestart(&tiling, c, offset+i+1);
aml_scratch_release(&sa, oldai);
aml_scratch_release(&sb, oldbi);
}
kernel(ap, bp, &c[(offset+i)*esz], esz);
kernel(ap, bp, cp, esz);
}
int main(int argc, char *argv[])
......@@ -126,7 +128,7 @@ int main(int argc, char *argv[])
aml_dma_linux_seq_destroy(&dma);
aml_area_free(&slow, a);
aml_area_free(&slow, b);
aml_area_free(&slow, c);
aml_area_free(&fast, c);
aml_area_linux_destroy(&slow);
aml_area_linux_destroy(&fast);
aml_tiling_destroy(&tiling, AML_TILING_TYPE_1D);
......
......@@ -36,12 +36,13 @@ void *th_work(void *arg)
{
int offset, i, ai, bi, oldai, oldbi;
unsigned long *ap, *bp;
unsigned long *ap, *bp, *cp;
void *abaseptr, *bbaseptr;
struct winfo *wi = arg;
offset = wi->tid*CHUNKING;
ap = aml_tiling_tilestart(&tiling, a, offset);
bp = aml_tiling_tilestart(&tiling, b, offset);
cp = aml_tiling_tilestart(&tiling, c, offset);
abaseptr = aml_scratch_baseptr(&sa);
bbaseptr = aml_scratch_baseptr(&sb);
ai = -1; bi = -1;
......@@ -50,15 +51,16 @@ void *th_work(void *arg)
oldai = ai; oldbi = bi;
aml_scratch_async_pull(&sa, &ar, abaseptr, &ai, a, offset+i+1);
aml_scratch_async_pull(&sb, &br, bbaseptr, &bi, b, offset+i+1);
kernel(ap, bp, &c[(offset+i)*esz], esz);
kernel(ap, bp, cp, esz);
aml_scratch_wait(&sa, ar);
aml_scratch_wait(&sb, br);
ap = aml_tiling_tilestart(&tiling, abaseptr, ai);
bp = aml_tiling_tilestart(&tiling, bbaseptr, bi);
cp = aml_tiling_tilestart(&tiling, c, offset+i+1);
aml_scratch_release(&sa, oldai);
aml_scratch_release(&sb, oldbi);
}
kernel(ap, bp, &c[(offset+i)*esz], esz);
kernel(ap, bp, cp, esz);
return arg;
}
......@@ -98,11 +100,11 @@ int main(int argc, char *argv[])
AML_AREA_LINUX_MBIND_TYPE_REGULAR,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS,
&arena, MPOL_BIND, nodemask));
assert(!aml_dma_linux_seq_init(&dma, numthreads*2));
assert(!aml_dma_linux_seq_init(&dma, (size_t)numthreads*4));
assert(!aml_scratch_par_init(&sa, &fast, &slow, &dma, &tiling,
2*numthreads, numthreads));
(size_t)2*numthreads, (size_t)numthreads));
assert(!aml_scratch_par_init(&sb, &fast, &slow, &dma, &tiling,
2*numthreads, numthreads));
(size_t)2*numthreads, (size_t)numthreads));
/* allocation */
a = aml_area_malloc(&slow, MEMSIZE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment