You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to implement SHA256 with QPULib and I've encountered a seg fault. Backtrack from GDB when compiled for emulation.
Program received signal SIGSEGV, Segmentation fault.
0x000000000800ddfe in computeLiveOut(Seq<SmallSeq<int> >*, Seq<SmallSeq<int> >*, int, SmallSeq<int>*) ()
(gdb) bt
#0 0x000000000800ddfe in computeLiveOut(Seq<SmallSeq<int> >*, Seq<SmallSeq<int> >*, int, SmallSeq<int>*) ()
#1 0x000000000800df9c in liveness(Seq<Instr>*, Seq<SmallSeq<int> >*, Seq<SmallSeq<int> >*) ()
#2 0x000000000800ea18 in regAlloc(Seq<SmallSeq<int> >*, Seq<Instr>*) ()
#3 0x0000000008002142 in compileKernel(Seq<Instr>*, Stmt*) ()
#4 0x0000000008001be6 in Kernel<Ptr<Int>, Ptr<Int> >::Kernel(void (*)(Ptr<Int>, Ptr<Int>)) ()
Here's a minimum version which will cause the fault.
#include <iostream>
#include "QPULib.h"
static Int smsigma0(Int x) {
return ror(x, 7) ^ ror(x, 18) ^ (x >> 3);
}
static Int smsigma1(Int x) {
return ror(x, 17) ^ ror(x, 19) ^ (x >> 10);
}
void execute_sha256_cpu(Ptr<Int> data, Ptr<Int> hash)
{
Int W[64];
Int a, b, c, d, e, f, g, h;
for (uint32_t i = 0; i < 16; i++)
W[i] = data[i*16];
for (uint32_t i = 16; i < 64; i++)
W[i] = smsigma1(W[i-2]) + W[i-7]+ smsigma0(W[i-15]) + W[i-16];
}
int main(int argc, char **argv)
{
// Compile the function to a QPU kernel k
auto k = compile(execute_sha256_cpu);
k.setNumQPUs(1);
// Allocate and initialise arrays shared between CPU and QPUs
SharedArray<int> data(16*64), hash(16*64);
for (uint32_t i = 0; i < 16*64; i++)
{
data[i] = 0;
hash[i] = 0;
}
k(&data,&hash);
}
Here's the output of the program when DEBUG is enabled
Attempting to implement SHA256 with QPULib and I've encountered a seg fault. Backtrack from GDB when compiled for emulation.
Here's a minimum version which will cause the fault.
Here's the output of the program when DEBUG is enabled
The text was updated successfully, but these errors were encountered: