Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compareDomain fails to recognize additional IDs when those IDs are transformed #3502

Open
naoyam opened this issue Nov 30, 2024 · 0 comments · May be fixed by #3514
Open

compareDomain fails to recognize additional IDs when those IDs are transformed #3502

naoyam opened this issue Nov 30, 2024 · 0 comments · May be fixed by #3514
Assignees

Comments

@naoyam
Copy link
Collaborator

naoyam commented Nov 30, 2024

Repro:

  Fusion fusion;
  FusionGuard fg(&fusion);

  // [i0]
  auto tv0 = makeSymbolicTensor(1);
  fusion.addInput(tv0);
  // [i1, i0]
  auto tv1 = makeSymbolicTensor(2);
  fusion.addInput(tv1);

  // [i0]
  auto tv2 = set(tv0);
  // [b2, i0]
  auto tv3 = broadcast(tv2, {true, false});
  // [i1, i0]
  auto tv4 = add(tv1, tv3);
  fusion.addOutput(tv4);

  // [i3]
  tv4->merge(0);

  // Set the loop domain of tv2 as the same as tv4 loop domain. Note that tv4 loop domain is already different from its logical domain because of its merge op

  // tv2
  {
    // tv2 is missing the first logical ID of tv4, i.e., i1. Use a clone of i1.
    auto missing_id = tv4->getLogicalDomain().at(0)->cloneWithoutRFactor();
    std::vector<IterDomain*> new_loop_domain{IterDomain::merge(missing_id, tv2->getLogicalDomain().at(0))};
    tv2->setLoopDomain(new_loop_domain);
  }

It's such a simple pattern but the current compareDomain falsely reports there's a redundant ID because of this assertion: https://github.com/NVIDIA/Fuser/blob/main/csrc/ir/utils.cpp#L931-L937.

iS3{i0} is redundant in iS10{( i2 * i0 )}

iS3 is the logical ID of tv2, which is obviously not redundant.

@naoyam naoyam self-assigned this Nov 30, 2024
@naoyam naoyam linked a pull request Dec 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant