@@ -1753,18 +1753,23 @@ void eraseInputDistinctRootDomains(Fusion* fusion) {
1753
1753
1754
1754
for (auto tv : ir_utils::filterByType<TensorView>(fusion->inputs ())) {
1755
1755
// Create a new logical domain and replacement TensorDomain.
1756
- // Given an logical domain, create a new IterDomain.
1757
- // Otherwise, clone the previous IterDomain
1758
1756
std::vector<IterDomain*> new_logical_domain;
1757
+
1758
+ // Ignore reduction ids for new tensordomain.
1759
1759
auto logical = TensorDomain::noReductions (tv->getLogicalDomain ());
1760
1760
new_logical_domain.reserve (logical.size ());
1761
1761
1762
1762
// Does the logical domain contain all concrete sized extents?
1763
- bool tv_is_concrete =
1764
- std::all_of (logical.begin (), logical.end (), [](IterDomain* id) {
1765
- return id->extent ()->isConstScalar ();
1766
- });
1763
+ bool tv_is_concrete = true ;
1764
+ for (auto id : logical) {
1765
+ if (!id->extent ()->isConstScalar ()) {
1766
+ tv_is_concrete = false ;
1767
+ break ;
1768
+ }
1769
+ }
1767
1770
1771
+ // Given an rfactor IterDomain, create a new IterDomain.
1772
+ // Otherwise, clone the previous IterDomain
1768
1773
for (const auto & id : logical) {
1769
1774
if (id->isRFactorProduct ()) {
1770
1775
// Create new symbolic extents for logical iterDomains
@@ -1784,13 +1789,15 @@ void eraseInputDistinctRootDomains(Fusion* fusion) {
1784
1789
TensorDomain* new_td = IrBuilder::create<TensorDomain>(new_logical_domain);
1785
1790
TransformReplay::selfReplay (tv->domain (), new_td, true );
1786
1791
if (!tv->domain ()->hasAllocation ()) {
1792
+ // The default contiguity for new_td is false. `selfReplay` does not
1793
+ // replay contiguity when no allocation domain is present.
1787
1794
const std::vector<std::optional<bool >> old_contiguity =
1788
1795
tv->domain ()->contiguity ();
1789
1796
std::vector<std::optional<bool >> no_red_contiguity;
1790
1797
no_red_contiguity.reserve (old_contiguity.size ());
1791
- for (const auto & [alloc_id , contiguity] :
1798
+ for (const auto & [id , contiguity] :
1792
1799
zip (tv->getLogicalDomain (), old_contiguity)) {
1793
- if (alloc_id ->isReduction ()) {
1800
+ if (id ->isReduction ()) {
1794
1801
continue ;
1795
1802
}
1796
1803
no_red_contiguity.push_back (contiguity);
0 commit comments