ispc/ispc — Issue #163: Assertion failed: "dynamic_cast<const PointerType *>(fptrType) != NULL" 
Author: Nagarathnam
Created: 2012-01-27 14:54:19+00:00
State: open

/bin/mkdir -p objs/
ispc -O2 --target=sse4-x2 --arch=x86-64 saxpy.ispc -o objs/saxpy_ispc.o -h objs/saxpy_ispc.h
expr.cpp:2735: Assertion failed: "dynamic_cast(fptrType) != NULL"
***
*** Please file a bug report at https://github.com/ispc/ispc/issues
*** (Including as much information as you can about how to reproduce this error).
*** You have apparently encountered a bug in the compiler that we'd like to fix!
***
make: *** [objs/saxpy_ispc.h] Aborted (core dumped)

export void saxpy_ispc(uniform int N,
uniform float scale,
uniform float X[],
uniform float Y[],
uniform float result[])
{
foreach (i = 0 ... N) {
result[i] = scale * X[i] + Y[i];
}
}

task void saxpy_ispc_task(uniform int N,
uniform int span,
uniform float scale,
uniform float X[],
uniform float Y[],
uniform float result[])
{
uniform int indexStart;
uniform int indexEnd;
indexStart = (taskIndex * span);
indexEnd = min(N, indexStart + (span)/8);
foreach (i = indexStart ... indexEnd) {
result[i] = scale * X[i] + Y[i];
}
uniform int k =0;
for (k=0; k<8;k++) {
indexStart = (((7-taskIndex-k)%8) * span) + k(span/8);
indexEnd = min(N, indexStart + (span)/8);
foreach (i = indexStart ... indexEnd) {
result[i] = scale * X[i] + Y[i];
}
}
}
export void saxpy_ispc_withtasks(uniform int N,
uniform float scale,
uniform float X[],
uniform float Y[],
uniform float result[])
{

uniform int span = N / 8; // 8 tasks

launch[N/span] < saxpy_ispc_task(N, span, scale, X, Y, result) >;
}