Skip to content

selective validation in TensorDomain constructor #5383

@jjsjann123

Description

@jjsjann123

Original conversation started from this thread

TensorDomain constructor run domain equivalence check on logical to loop and logical to allocation, which makes sense for most TVs.

Meanwhile, special cases like:

  1. ScatterOp where the loop domain doesn't cover the entirety of logical domain, see link;
  2. PreprocessGroupedMatmulInputSf has larger allocation domain than logical domain, see link.

These special cases means, when we clone a TensorDomain with some modification, we shouldn't blindly run equivalency checks on domains that's inherited, but rather only on new domain that's being modified.

e.g. In transform_replay.cpp, we have patterns like

 870     TensorDomain* replayed = IrBuilder::createInContainer<TensorDomain>(
 871         consumer->container(),
 872         consumer->getRootDomain(),
 873         consumer->getLogicalDomain(),
 874         consumer->getAllocationDomain(),
 875         new_loop,
 876         consumer->domain()->contiguity());

Where only loop domain is changed, and hence validation check should only be limited to that.

@naoyam proposed to add a TensorDomainBuilder to facilitate such pattern.

auto replayed = TensorDomainBuilder(consumer).loop(new_loop).build();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions