Skip to content

Commit ef0066c

Browse files
committed
einsum: expression route is now the default for general products
With the strided-scale-path fix in place, the TA_EINSUM_DIFFERENTIAL audit of c6h14 PNO-CCSD shows the two routes agree except for: - sub-threshold result tiles that the legacy path implicitly hard-zeroes (its result shape derives from the harvested tile norms) while the expression route keeps them (standard estimate-derived contraction shape). Per the TA screening philosophy, norms are trusted as genuine and no implicit truncation is performed; users wanting the tighter shape call truncate() explicitly. - floating-point summation-order noise in tiny, heavily-cancelling tensors (absolute tile-norm^2 differences <= 1e-9, no structural pattern). Neither is a defect, so general products in einsum now default to the expression-layer evaluation (TensorProduct::General -> batched Summa: one task graph in one World, ZERO per-slab sub-Worlds). The legacy path remains available via TA_EINSUM_LEGACY_SUBWORLD (or detail::einsum_legacy_subworld()) as the reference implementation for differential testing. All suites pass with the new default (einsum suites against their reference data; the 2 pre-existing assign_subblock_block_base1 failures are unrelated); np = 1, 2, 3.
1 parent 0e04820 commit ef0066c

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

src/TiledArray/einsum/tiledarray.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,24 @@ namespace TiledArray::detail {
2929
/// through the expression layer's native support (TensorProduct::General,
3030
/// evaluated by the batched Summa: one task graph in one World, no per-slab
3131
/// sub-Worlds) or through the legacy path (one MPI_Comm_split + sub-World +
32-
/// fence per Hadamard slab). The legacy path is currently the DEFAULT:
33-
/// the expression route has known mismatches on PNO-CC (CSV) workloads
34-
/// (see TA_EINSUM_DIFFERENTIAL) that are under investigation. Set
35-
/// TA_EINSUM_LEGACY_SUBWORLD=0 in the environment (or assign \c false to
36-
/// the reference returned by this function) to opt into the expression
37-
/// route. The legacy implementation is retained indefinitely as a reference
38-
/// for differential testing.
32+
/// fence per Hadamard slab). The expression route is the DEFAULT; set
33+
/// TA_EINSUM_LEGACY_SUBWORLD in the environment (any non-empty value other
34+
/// than "0"), or assign \c true to the reference returned by this function,
35+
/// to force the legacy path. The legacy implementation is retained
36+
/// indefinitely as a reference for differential testing
37+
/// (TA_EINSUM_DIFFERENTIAL).
38+
///
39+
/// \note the two routes may legitimately differ on block-sparse data: the
40+
/// legacy path derives the result shape from the harvested tile norms and
41+
/// thus hard-zeroes sub-threshold result tiles, while the expression route
42+
/// keeps them (its shape is the standard estimate-derived contraction
43+
/// shape). Per the TA screening philosophy norms are trusted as genuine and
44+
/// no implicit truncation is performed; call truncate() explicitly if the
45+
/// tighter shape is desired.
3946
inline bool &einsum_legacy_subworld() {
4047
static bool flag = [] {
4148
const char *e = std::getenv("TA_EINSUM_LEGACY_SUBWORLD");
42-
// default: legacy; any value other than "0" (incl. unset) keeps legacy
43-
return e == nullptr || std::string_view(e) != "0";
49+
return e != nullptr && e[0] != char(0) && std::string_view(e) != "0";
4450
}();
4551
return flag;
4652
}

0 commit comments

Comments
 (0)