-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
This following kernel results in a segmentation fault on master:
#include "taco.h"
using namespace taco;
int main(int argc, char* argv[]) {
Format csr({Dense,Sparse});
Format sv({Sparse});
Format dv({Dense});
int dimension = 1000;
int sparsity_factor = 3;
Tensor<double> y("y", {dimension}, sv);
Tensor<double> A("A", {dimension,dimension}, csr);
Tensor<double> x("x", {dimension}, dv);
Tensor<double> beta("b");
for (int i=0; i<dimension; ++i) {
for (int j=0; j<dimension; ++j) {
if ((i + j) % (1 << sparsity_factor) == 0){
A(i,j) = double(i * j + j);
}
}
}
for (int i=0; i<dimension; ++i) {
x(i) = double(i);
}
beta() = 1.2;
A.pack();
x.pack();
IndexVar i, j, k;
IndexExpr precomputedExpr = A(i,k) * x(k);
y(i) = beta() * A(i,j) * precomputedExpr;
IndexStmt stmt = y.getAssignment().concretize();
// Add workspace for A(i,k) * x(k)
TensorVar workspace("workspace", Type(Float64, {Dimension(dimension)}), taco::dense);
stmt = stmt.precompute(precomputedExpr, {i}, {i}, workspace);
stmt = stmt.concretize();
y.compile(stmt);
y.assemble();
y.compute();
}
It works fine if I remove the workspace, also when I use the workspace but remove beta
(a constant) from the expression.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior