@@ -36,8 +36,6 @@ TEST(workspaces, tile_vecElemMul_NoTail) {
3636 .split (i_bounded, i0, i1, 4 )
3737 .precompute (precomputedExpr, i1, i1, precomputed);
3838
39- // cout << stmt << endl;
40-
4139 A.compile (stmt);
4240 A.assemble ();
4341 A.compute ();
@@ -159,16 +157,11 @@ TEST(workspaces, tile_denseMatMul) {
159157
160158 IndexStmt stmt = A.getAssignment ().concretize ();
161159 TensorVar precomputed (" precomputed" , Type (Float64, {Dimension (i1)}), taco::dense);
162- cout << " ------STMT1------" << endl;
163160 stmt = stmt.bound (i, i_bounded, 16 , BoundType::MaxExact)
164161 .split (i_bounded, i0, i1, 4 );
165- cout << stmt << endl;
166162
167- cout << " ------STMT2------" << endl;
168163 stmt = stmt.precompute (precomputedExpr, i1, i1, precomputed);
169164
170- cout << stmt << endl;
171-
172165 A.compile (stmt.concretize ());
173166 A.assemble ();
174167 A.compute ();
@@ -313,7 +306,7 @@ TEST(workspaces, precompute4D_multireduce) {
313306 ASSERT_TENSOR_EQ (A, expected);
314307}
315308
316- TEST (workspaces, precompute3D_MspV ) {
309+ TEST (workspaces, precompute3D_TspV ) {
317310 int N = 16 ;
318311 Tensor<double > A (" A" , {N, N}, Format{Dense, Dense});
319312 Tensor<double > B (" B" , {N, N, N, N}, Format{Dense, Dense, Dense, Dense});
@@ -339,8 +332,7 @@ TEST(workspaces, precompute3D_MspV) {
339332 TensorVar ws (" ws" , Type (Float64, {(size_t )N, (size_t )N, (size_t )N}), Format{Dense, Dense, Dense});
340333 stmt = stmt.precompute (precomputedExpr, {i, j, k}, {i, j, k}, ws);
341334 stmt = stmt.concretize ();
342- cout << " ----------STMT----------" << endl;
343- cout << stmt << endl;
335+
344336 A.compile (stmt);
345337 A.assemble ();
346338 A.compute ();
@@ -380,14 +372,10 @@ TEST(workspaces, precompute3D_multipleWS) {
380372 IndexStmt stmt = A.getAssignment ().concretize ();
381373 TensorVar ws (" ws" , Type (Float64, {(size_t )N, (size_t )N, (size_t )N}), Format{Dense, Dense, Dense});
382374 TensorVar t (" t" , Type (Float64, {(size_t ) N, (size_t )N}), Format{Dense, Dense});
383- cout << " ----------STMT1----------" << endl;
384375 stmt = stmt.precompute (precomputedExpr, {i, j, k}, {i, j, k}, ws);
385- cout << stmt << endl;
386376
387- cout << " ----------STMT2----------" << endl;
388377 stmt = stmt.precompute (ws (i, j, k) * c (k), {i, j}, {i, j}, t);
389378 stmt = stmt.concretize ();
390- cout << stmt << endl;
391379
392380 A.compile (stmt);
393381 A.assemble ();
@@ -402,3 +390,45 @@ TEST(workspaces, precompute3D_multipleWS) {
402390
403391}
404392
393+ TEST (workspaces, precompute3D_renamedIVars_TspV) {
394+ int N = 16 ;
395+ Tensor<double > A (" A" , {N, N}, Format{Dense, Dense});
396+ Tensor<double > B (" B" , {N, N, N, N}, Format{Dense, Dense, Dense, Dense});
397+ Tensor<double > c (" c" , {N}, Format{Sparse});
398+
399+ for (int i = 0 ; i < N; i++) {
400+ c.insert ({i}, (double ) i);
401+ for (int j = 0 ; j < N; j++) {
402+ for (int k = 0 ; k < N; k++) {
403+ for (int l = 0 ; l < N; l++) {
404+ B.insert ({i, j, k, l}, (double ) i + j);
405+ }
406+ }
407+ }
408+ }
409+
410+ IndexVar i (" i" ), j (" j" ), k (" k" ), l (" l" );
411+ IndexExpr precomputedExpr = B (i, j, k, l) * c (l);
412+ A (i, j) = precomputedExpr * c (k);
413+
414+
415+ IndexStmt stmt = A.getAssignment ().concretize ();
416+ TensorVar ws (" ws" , Type (Float64, {(size_t )N, (size_t )N, (size_t )N}),
417+ Format{Dense, Dense, Dense});
418+
419+ IndexVar iw (" iw" ), jw (" jw" ), kw (" kw" );
420+ stmt = stmt.precompute (precomputedExpr, {i, j, k}, {iw, jw, kw}, ws);
421+ stmt = stmt.concretize ();
422+
423+ A.compile (stmt);
424+ A.assemble ();
425+ A.compute ();
426+
427+ Tensor<double > expected (" expected" , {N, N}, Format{Dense, Dense});
428+ expected (i, j) = (B (i, j, k, l) * c (l)) * c (k);
429+ expected.compile ();
430+ expected.assemble ();
431+ expected.compute ();
432+ ASSERT_TENSOR_EQ (A, expected);
433+
434+ }
0 commit comments