Hello,
I've been facing an issue with running PolyBench.jl: When "kernel_ludcmp" 's SCoP is being processed by PPCGCodeGeneration, getStmtAcesses queries for the number of dimensions of an array through a ScopArrayInfo object,
gpu_stmt_access *getStmtAccesses(ScopStmt &Stmt) {
gpu_stmt_access *Accesses = nullptr;
for (MemoryAccess *Acc : Stmt) {
auto Access = isl_alloc_type(S->getIslCtx(), struct gpu_stmt_access);
Access->read = Acc->isRead();
[...]
Access->n_index = Acc->getScopArrayInfo()->getNumberOfDimensions();
Accesses = Access;
}
return Accesses;
}
But, getScopArrayInfo returns NULL and crashes the program when getNumberOfDimensions attempts to access the object's Kind member (valgrind reported an "invalid read of 4 bytes" ). An assert(this) at the beginning of getNumberOfDimensions revealed the issue concretely.
const ScopArrayInfo *getScopArrayInfo() const {
return getOriginalScopArrayInfo();
}
const ScopArrayInfo *MemoryAccess::getOriginalScopArrayInfo() const {
isl::id ArrayId = getArrayId();
void *User = ArrayId.get_user();
const ScopArrayInfo *SAI = static_cast<ScopArrayInfo *>(User);
+ if( SAI==NULL )
+ dbgs() << __func__ << "SAI be NULL\n";
return SAI;
}
It happened that SAI had been NULL for cases where the Julia didn't crash, e.g. for other kernels in PolyBench and 85 times while processing kernel_ludcmp itself,
This seems surprising since there are asserts surrounding the value returned by getOriginalScopArrayInfo and member access (->) on the pointer returned by getScopArrayInfo, as far as I've seen.
What's even more surprising is that opt -polly-codegen-ppcg processes the file dumped by "-polly-dump-before" without issues,
opt -polly-codegen-ppcg -disable-output kernel_ludcmp-before.ll
Scop Region: %if20---%L73 | Function: japi1_kernel_ludcmp_66122 does not have permutable bands. Bailing out
Scop Region: %if20---%L73 | Function: japi1_kernel_ludcmp_66122 has empty PPCGGen->tree. Bailing out.
Scop Region: %if18---%L42 | Function: japi1_kernel_ludcmp_66122 does not have permutable bands. Bailing out
Scop Region: %if18---%L42 | Function: japi1_kernel_ludcmp_66122 has empty PPCGGen->tree. Bailing out.
I'd like to understand when and why a ScopArrayInfo object's isl_id.user would be unitialised ( set to NULL ).
Thanks,
Sanjay