-
Notifications
You must be signed in to change notification settings - Fork 7
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
Transform propagator skip replay when possible #1782
Conversation
…ropagator-skip-replay
This PR is rebased |
// See note [Using multiple TransformPropagators] | ||
int new_pos = | ||
TransformReplay::getMatchedLeafPosWithoutReplayCasP(to, from, pos); | ||
if (new_pos < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like I'm missing something here, why would new_pos be less than 0 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is by protocol. <0
means impossible to find matched position without replay, that is, replay is required. See comment:
// Returns the leaf position in consumer that matches with `producer_pos` in
// producer. Returns -1 if matching is impossible. This function can be used
// to test if replay is needed for getting matching outer dims.
++it_consumer; | ||
++it_producer; | ||
if (consumer_pos) { | ||
if (consumer_or_producer_pos == mismatched_consumer_pos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was what was confusing me. We're not returning the actual mismatched location, we're just returning the provided position if the mismatched position is further to the right. So this function can only return the provided position, or -1 meaning there's a mismatch before we hit the provided position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should either return this function to just being a bool, or we should actually return the position of the mismatch and compare that position outside of this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're just returning the provided position if the mismatched position is further to the right.
I think we are not just returning the provided position, but instead, if you provide a consumer position, we are returning the corresponding producer position of the given consumer position. In this case, we can not return the actual mismatch position, because it does not provide the information about the corresponding producer position of the given consumer position?
I copy-pasted this function from computeAt, and actually, there is one thing that I don't understand about this function. Why are we skipping unmappable dims in the consumer but not in the producer? What breaks the symmetry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy-pasted this function from computeAt
Yeah it's my fault, this function is really just returning yes or no, it shouldn't be returning an int. It could return an int, but should be rewritten to do so.
Why are we skipping unmappable dims in the consumer but not in the producer? What breaks the symmetry?
Unmappable dims (might be a bad name) come from patterns associated with reductions, and really associated with normalization patterns.
If I have:
T1 = set(T0)
T2 = sum(T1, {1})
T3 = broadcast(T2, {false, true})
T4 = add(T1, T3)
T1 cannot be fully inlined to T4. So T1's second dimension (I believe) is marked as unmappable to T4. It's not okay to fully inline T2 into T4, but it's fine to fully inline T1 with T2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naoyam can tell me if I'm wrong on the details of the example, but I believe the principles stand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't be returning an int. It could return an int, but should be rewritten to do so.
I still don't understand. Are you saying that the algorithm we used to compute the corresponding position is wrong, and we should rewrite to compute it differently? Or are you saying that the algorithm is OK, but we should split up the testing of "needs play" and "find the corresponding position" into two things? Or something else?
If I have:
T1 = set(T0)
T2 = sum(T1, {1})
T3 = broadcast(T2, {false, true})
T4 = add(T1, T3)
Hmm, I am not sure if this example is a related. I think getMatchedLeafPosWithoutReplay
only looks at PairwiseRootDomainMap
, which will map all the dims in T4 to T1?
TEST_F(NVFuserTest, TMP) {
auto fusion = std::make_unique<Fusion>();
FusionGuard fg(fusion.get());
auto tv0 = makeSymbolicTensor(2);
fusion->addInput(tv0);
auto tv1 = set(tv0);
auto tv2 = sum(tv1, {1});
auto tv3 = broadcast(tv2, {false, true});
auto tv4 = add(tv1, tv3);
fusion->addOutput(tv4);
auto producer = tv1;
auto consumer = tv4;
const auto c2p_root_map =
PairwiseRootDomainMap(producer, consumer)
.mapConsumerToProducer(consumer->domain(), producer->domain());
// IterDomains in consumer root also in producer root
std::unordered_set<Val*> mapped_consumer_roots;
for (auto entry : c2p_root_map) {
mapped_consumer_roots.emplace(entry.first);
}
fusion->print();
std::cout << ir_utils::toString(mapped_consumer_roots) << std::endl;
}
This gives iS8{i1}, iS9{i2}
.
I think "unmapped IDs in consumer but not in producer" here refers to new broadcasting dims, and we are saying that, if we see a leaf ID that completely comes from new broadcasting dims, then we can ignore it. But why don't we want to symmetrically do the same for reductions in the producer? For non-trivial reduction, I think this is because it could not be inlined, but for trivial reduction, it should be safe to just ignore it as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the algorithm is correct, and it should not be symmetric. I was considering trivial reduction, but trivial reduction could likely be ignored as well.
I was trying to say the asymmetry is due to the unmappable dims, which are related to particular graph patterns with reduction (the pattern mentioned above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my mistake, I misread the return statements, I thought we were checking the return value was equal to the provided value to return that value. We're swapping produce/consume so they're different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The algorithm is actually not correct😉: #1791
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't be returning an int. It could return an int, but should be rewritten to do so.
I still don't understand. Are you saying that the algorithm we used to compute the corresponding position is wrong, and we should rewrite to compute it differently? Or are you saying that the algorithm is OK, but we should split up the testing of "needs play" and "find the corresponding position" into two things? Or something else?
If I have:
T1 = set(T0)
T2 = sum(T1, {1})
T3 = broadcast(T2, {false, true})
T4 = add(T1, T3)Hmm, I am not sure if this example is a related. I think
getMatchedLeafPosWithoutReplay
only looks atPairwiseRootDomainMap
, which will map all the dims in T4 to T1?TEST_F(NVFuserTest, TMP) { auto fusion = std::make_unique<Fusion>(); FusionGuard fg(fusion.get()); auto tv0 = makeSymbolicTensor(2); fusion->addInput(tv0); auto tv1 = set(tv0); auto tv2 = sum(tv1, {1}); auto tv3 = broadcast(tv2, {false, true}); auto tv4 = add(tv1, tv3); fusion->addOutput(tv4); auto producer = tv1; auto consumer = tv4; const auto c2p_root_map = PairwiseRootDomainMap(producer, consumer) .mapConsumerToProducer(consumer->domain(), producer->domain()); // IterDomains in consumer root also in producer root std::unordered_set<Val*> mapped_consumer_roots; for (auto entry : c2p_root_map) { mapped_consumer_roots.emplace(entry.first); } fusion->print(); std::cout << ir_utils::toString(mapped_consumer_roots) << std::endl; }This gives
iS8{i1}, iS9{i2}
.I think "unmapped IDs in consumer but not in producer" here refers to new broadcasting dims, and we are saying that, if we see a leaf ID that completely comes from new broadcasting dims, then we can ignore it. But why don't we want to symmetrically do the same for reductions in the producer? For non-trivial reduction, I think this is because it could not be inlined, but for trivial reduction, it should be safe to just ignore it as well?
The constraint about reductions not being able to get inlined is reflected in ComputeAtRootDomainMap
. PairwiseRootDomainMap
does not consider constraints due to inlining but just looks at a pair of a producer and consumer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ropagator-skip-replay
@@ -644,24 +644,173 @@ std::pair<TensorDomain*, unsigned int> TransformReplay::replayCasP( | |||
return replayCasP(consumer, producer, compute_at_axis, root_map); | |||
} | |||
|
|||
namespace { | |||
|
|||
int getMatchedLeafPosWithoutReplay( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments on the parameters and the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that these functions need a better doc. I will work on it in a new PR.
const TensorView* producer, | ||
const TensorView* consumer, | ||
int consumer_or_producer_pos, | ||
bool consumer_pos = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We often use names like consumer_pos
to indicate a position in a consumer domain, so this could be confusing. Maybe something like is_producer_as_consumer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the code has been replace by #1791, no more such issue 😉
++it_consumer; | ||
++it_producer; | ||
if (consumer_pos) { | ||
if (consumer_or_producer_pos == mismatched_consumer_pos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't be returning an int. It could return an int, but should be rewritten to do so.
I still don't understand. Are you saying that the algorithm we used to compute the corresponding position is wrong, and we should rewrite to compute it differently? Or are you saying that the algorithm is OK, but we should split up the testing of "needs play" and "find the corresponding position" into two things? Or something else?
If I have:
T1 = set(T0)
T2 = sum(T1, {1})
T3 = broadcast(T2, {false, true})
T4 = add(T1, T3)Hmm, I am not sure if this example is a related. I think
getMatchedLeafPosWithoutReplay
only looks atPairwiseRootDomainMap
, which will map all the dims in T4 to T1?TEST_F(NVFuserTest, TMP) { auto fusion = std::make_unique<Fusion>(); FusionGuard fg(fusion.get()); auto tv0 = makeSymbolicTensor(2); fusion->addInput(tv0); auto tv1 = set(tv0); auto tv2 = sum(tv1, {1}); auto tv3 = broadcast(tv2, {false, true}); auto tv4 = add(tv1, tv3); fusion->addOutput(tv4); auto producer = tv1; auto consumer = tv4; const auto c2p_root_map = PairwiseRootDomainMap(producer, consumer) .mapConsumerToProducer(consumer->domain(), producer->domain()); // IterDomains in consumer root also in producer root std::unordered_set<Val*> mapped_consumer_roots; for (auto entry : c2p_root_map) { mapped_consumer_roots.emplace(entry.first); } fusion->print(); std::cout << ir_utils::toString(mapped_consumer_roots) << std::endl; }This gives
iS8{i1}, iS9{i2}
.I think "unmapped IDs in consumer but not in producer" here refers to new broadcasting dims, and we are saying that, if we see a leaf ID that completely comes from new broadcasting dims, then we can ignore it. But why don't we want to symmetrically do the same for reductions in the producer? For non-trivial reduction, I think this is because it could not be inlined, but for trivial reduction, it should be safe to just ignore it as well?
The constraint about reductions not being able to get inlined is reflected in ComputeAtRootDomainMap
. PairwiseRootDomainMap
does not consider constraints due to inlining but just looks at a pair of a producer and consumer.
* Refactor TransormPropagator to allow specifying a position and propagating to part of the DAG (#1775) `MaxInfoPropagator` is renamed to `MaxInfoSpanningTree`, it now only does path-finding, and the propagation is in a separate class `MaxInfoSpanningTree::Propagator`. Same for `MaxRootDomainInfoPropagator`. `MaxInfoSpanningTree` and `MaxRootDomainInfoSpanningTree` now allow specifying a selector, which controls which subgraph should be included in path-finding. `MaxRootDomainInfoSpanningTree` also gets a few new constructors for convenience to use. `TransormPropagator` is now a subclass of `MaxInfoSpanningTree::Propagator`, so the way to use it has changed. Now `MaxInfoSpanningTree` and `MaxRootDomainInfoSpanningTree` will store the path after generation so that the same path can be traversed multiple times. This will be useful to support use cases like new `computeAt`. Pseudo-code: ```C++ void TensorView::computeAt(TensorView tv, int pos) { auto ComputeAtSubgraphSelector selector(this, tv); MaxRootDomainInfoSpanningTree path(tv, pos, &selector); TransformPropagator propagator(tv, pos); path.traverse(&propagator); ComputeAtPosPropagator ca_propagator(tv, pos); path.traverse(&ca_propagator); } ``` * Revert scheduling changes. Cleanup only. * Start drafting grid persistent kernels. * Extend mma dimension and layout checking to support strided batched matmul and tensor contractions (#1761) Co-authored-by: Christian Sarofeen <csarofeen@nvidia.com> * Fix FusionMaxRootDomainInfoSpanningTreePrintTwice_CUDA (#1781) * Fix div(Val, TensorView) (#1778) * Fix div(scalar, tensor) * lintrunner: clang-format * Adding sibling path for MaxInfoSpanningTree (#1776) The sibling path is required to generate consistent replay for some cases where `MaxInfoSpanningTree` is used with a selector. For example, when the producer of a Welford is excluded from the propagation section. See test `FusionTransformPropagateSelectorSibling_CUDA` for a detailed example. Besides, since we know that siblings should be transformed exactly the same, the sibling path is a perfect next hop for preserving information. If you want a spanning tree without a sibling path, you can override `allowSibling` as `return false` in your selector; * Save. * Disable register reuse across serial broadcast ops (#1787) Disable memory aliasing for inner sharing across serial broadcast. * Fix isIntegralType error msg (#1789) * Transform propagator skip replay when possible (#1782) This comment in the code describes what this PR is doing: ```C++ // Note: [Using multiple TransformPropagators] // There are cases that we use multiple TransformPropagators along different // spanning trees with different references in the same fusion. Some of these // spanning trees could overlap. In cases when there are overlapping nodes, // TransformPropagator needs to respect the replay of others, because the // current TransformPropagator might not contain the most amount of // information on how to do the correct transformation. The logic below tells // TransformPropagator to skip the replay when not necessary. ``` * Output allocate patch (#1790) Caching strides along with sizes. This is to support current expand, which introduces non-contiguous output tensor * Add SpanningTreePrinter (#1786) * New compute at interface (#1743) Rewrite of the compute at pass to rely on the new propagation mechanisms. * Fix TransformReplay::getMatchedLeafPosWithoutReplay* (#1791) * Some further cleanup for the new computeAt interface (#1793) Revert MaxProducerPosUpdater to old algo. * Use TransformPropagatorWithCheck in many tests (#1795) * validateDomain in TransformPropagator (#1796) * InlinePropagator please don't replay (#1797) This PR makes `InlinePropagator` just set compute-at positions. It will not replay any tensor. If you want to replay, please use `TransformPropagator` and friends to do so. Currently, `InlinePropagator` is already asserting no replay for standard and best effort compute at. So this PR is mostly about making most inlined compute at works as well. This PR also does a lot of cleanups to remove the word "replay" from comments and variable and function names from `InlinePropagator`. I also cleaned up `recordReplayedPos` and `retrieveReplayedPos`, now the logic is much easier to understand. * Coding style cleanups (#1798) Per offline discussion with @csarofeen, this PR does many renaming for better coding style: For all propagation-related things, I am now using the names `P2C` and `C2P` instead of `CasP` and `PasC`. Because "A as B" somewhat implies we want to replay A the same as B, but "B to A" sounds more general and is a better word for this case. Also, I modified the order of function arguments to match the order in its name. For example `PasC` should have `(producer, consumer)` or `(to, from)`, but not `(consumer, producer)` or `(from, to)`, and `C2P` should have `(consumer, producer)` or `(from, to)`, but not `(producer, consumer)` or `(to, from)`. * Add parsing support for `_to_copy` to handle AMP casts. (#1756) 1. Add support for _to_copy() to support AMP casts. 2. refactored cast, accept none for dtype 3. python tests Co-authored-by: jjsjann123 <jiej@nvidia.com> * MMA Rfactor support for cross-warp and cross-CTA split on K dimension (#1554) * Indexing refactor stage 2 : Remove reference tensor in predicate indexing logic (#1784) Co-authored-by: Christian Sarofeen <csarofeen@nvidia.com> * More cleanup on InlinePropagator (#1800) I just realized that `InlinePropagator` can be further simplified because it no longer replays. Since `InlinePropagator` is no longer doing replay, it is more like a "for each" problem rather than a propagation problem: For each tensor `tv`, if we already know what is the max position of `tv` that is mapped to the reference tensor's selected outer dimensions(stored in `mapped_reference_pos_` in the code), setting the CA position is a very local operation, and is as simple as checking `tv` itself and all its consumers to determine the inline position. `InlinePropagator` is not completely a "for each" problem only because the computation of `mapped_reference_pos_` is a propagation problem. This cleanup reorganizes the code of `InlinePropagator` so it is clear that `InlinePropagator` is nothing but a two-step process: Step 1: Do a propagation to find the `mapped_reference_pos_` for all tensors. Step 2: For each tensor, check itself and its consumers to determine the CA position. Conceptually, I would like to split step 1 with step 2. Because this split makes these concepts decoupled. Especially, this PR makes `mapped_reference_pos_` only contain info about the reference tensor, and is independent of the CA position (Currently, this is not true for best effort and most inlined computeAt without this PR). Now, in my view, `InlinePropagator` is conceptually very simple and easy to understand. In terms of implementation, step 1 and step 2 can be interleaved, because when we don't need to know the `mapped_reference_pos_` for `tv`'s consumer in order to compute the CA position of `tv`. So a one-pass traverse could do both step 1 and step 2 altogether. * Temporarily disable test requring large shared memory. (#1802) * Grouping grid allreduces across iterations (#1755) * Extend the grouped grid reduction kernel The kernel itself should work with an arbitrary number of inputs, but the underlying data structure, Tuple, still explicitly needs to be specialized for the number of values, which is currently limited to 8. * Check siblings in getMaxPosAll (#1805) * remove dead indexing code (#1806) * Broadcast in dim with expand (#1794) Fixes #1788 Added expand in broadcast_in_dim to support expanding to concrete size. Note that we are not supporting dynamic shape for concrete size at this moment. * spam nvrtc options (#1783) TORCH_WARN on nvrtc debug option impacting performance. Co-authored-by: Gao, Xiang <qasdfgtyuiop@gmail.com> Co-authored-by: S. Song <41357537+shmsong@users.noreply.github.com> Co-authored-by: Ivan Yashchuk <IvanYashchuk@users.noreply.github.com> Co-authored-by: Sergey Lebedev <sergeyle@nvidia.com> Co-authored-by: jjsjann123 <jiej@nvidia.com> Co-authored-by: Kevin Stephano <kevin.stephano@gmail.com> Co-authored-by: Naoya Maruyama <naoyam@users.noreply.github.com>
Syncing nvfuser devel branch to upstream master. https://github.com/csarofeen/pytorch/ Code changes includes: - codegen improvements: 1. Indexing refactor -> Remove reference tensor in predicate indexing logic 2. MMA Rfactor support for cross-warp and cross-CTA split on K dimension 3. Grouping grid allreduces across iterations 4. Swizzle op formulation for non-affine swizzles 5. Use scheduler_utils to cache inputs and outputs in schedulePointwise - scheduler refactor 1. New compute at interface - transformation propagation refactor on MaxInfoSpanningTree 1. Added sibling path that is required to generate consistent replay for some cases where `MaxInfoSpanningTree` is used with a selector. 2. Optimization to skip Transform propagator 3. SpanningTreePrinter for debugging - parser update 1. Fixes `div` 2. Added `_to_copy` 3. Broadcast in dim with expand to support expanding to concrete size 4. Dropout prob extremal patch - executor patch on caching strides for output allocation Squashed commits to WAR github API Commits that's actually in this PR from the devel branch: ``` 3b87896 Fix allocation of work buffers and `fused_reduction::ParallelReduce` with unswitch (csarofeen#1818) 4cae122 schedulePointwise cleanup: - computeAt + InlinePropagator (csarofeen#1815) 3df9742 Use scheduler_utils to cache inputs and outputs in schedulePointwise (csarofeen#1811) 03180aa improve broadcast resolution (csarofeen#1792) bee6c69 bug fix (csarofeen#1819) 4413c8f Support PYTORCH_NVFUSER_DUMP=transform_propagator (csarofeen#1812) de6b7ca Fix negative position in InlinePropagator (csarofeen#1813) 10a996c Remove redundant check in schedulePointwise (csarofeen#1810) acd5ed4 Swizzle op formulation for non-affine swizzles (csarofeen#1441) 3ed8330 Kernel args patch to show zero_init buffer (csarofeen#1809) 037a75a Dropout prob extremal patch (csarofeen#1804) 282c429 spam nvrtc options (csarofeen#1783) 3ba6a5f Broadcast in dim with expand (csarofeen#1794) fd4be12 remove dead indexing code (csarofeen#1806) fa4e6a4 Check siblings in getMaxPosAll (csarofeen#1805) 025c840 Grouping grid allreduces across iterations (csarofeen#1755) 37c579e Temporarily disable test requring large shared memory. (csarofeen#1802) 5f375d0 More cleanup on InlinePropagator (csarofeen#1800) 8d384da Indexing refactor stage 2 : Remove reference tensor in predicate indexing logic (csarofeen#1784) f008140 MMA Rfactor support for cross-warp and cross-CTA split on K dimension (csarofeen#1554) 76b3cca Add parsing support for `_to_copy` to handle AMP casts. (csarofeen#1756) ef04f6c Coding style cleanups (csarofeen#1798) 38c7f3c InlinePropagator please don't replay (csarofeen#1797) 3f2c263 validateDomain in TransformPropagator (csarofeen#1796) c077085 Use TransformPropagatorWithCheck in many tests (csarofeen#1795) d0d0908 Some further cleanup for the new computeAt interface (csarofeen#1793) 45f5203 Fix TransformReplay::getMatchedLeafPosWithoutReplay* (csarofeen#1791) 28cbaf9 New compute at interface (csarofeen#1743) 635ebfc Add SpanningTreePrinter (csarofeen#1786) 59f3c32 Output allocate patch (csarofeen#1790) fe93bf5 Transform propagator skip replay when possible (csarofeen#1782) ebf23a5 Fix isIntegralType error msg (csarofeen#1789) 0c82ecf Disable register reuse across serial broadcast ops (csarofeen#1787) 33a824d Adding sibling path for MaxInfoSpanningTree (csarofeen#1776) 86f46aa Fix div(Val, TensorView) (csarofeen#1778) d3de227 Fix FusionMaxRootDomainInfoSpanningTreePrintTwice_CUDA (csarofeen#1781) ecc7a87 Extend mma dimension and layout checking to support strided batched matmul and tensor contractions (csarofeen#1761) ``` [ghstack-poisoned]
Syncing nvfuser devel branch to upstream master. https://github.com/csarofeen/pytorch/ Code changes includes: - codegen improvements: 1. Indexing refactor -> Remove reference tensor in predicate indexing logic 2. MMA Rfactor support for cross-warp and cross-CTA split on K dimension 3. Grouping grid allreduces across iterations 4. Swizzle op formulation for non-affine swizzles 5. Use scheduler_utils to cache inputs and outputs in schedulePointwise - scheduler refactor 1. New compute at interface - transformation propagation refactor on MaxInfoSpanningTree 1. Added sibling path that is required to generate consistent replay for some cases where `MaxInfoSpanningTree` is used with a selector. 2. Optimization to skip Transform propagator 3. SpanningTreePrinter for debugging - parser update 1. Fixes `div` 2. Added `_to_copy` 3. Broadcast in dim with expand to support expanding to concrete size 4. Dropout prob extremal patch - executor patch on caching strides for output allocation Squashed commits to WAR github API Commits that's actually in this PR from the devel branch: ``` 3b87896 Fix allocation of work buffers and `fused_reduction::ParallelReduce` with unswitch (csarofeen#1818) 4cae122 schedulePointwise cleanup: - computeAt + InlinePropagator (csarofeen#1815) 3df9742 Use scheduler_utils to cache inputs and outputs in schedulePointwise (csarofeen#1811) 03180aa improve broadcast resolution (csarofeen#1792) bee6c69 bug fix (csarofeen#1819) 4413c8f Support PYTORCH_NVFUSER_DUMP=transform_propagator (csarofeen#1812) de6b7ca Fix negative position in InlinePropagator (csarofeen#1813) 10a996c Remove redundant check in schedulePointwise (csarofeen#1810) acd5ed4 Swizzle op formulation for non-affine swizzles (csarofeen#1441) 3ed8330 Kernel args patch to show zero_init buffer (csarofeen#1809) 037a75a Dropout prob extremal patch (csarofeen#1804) 282c429 spam nvrtc options (csarofeen#1783) 3ba6a5f Broadcast in dim with expand (csarofeen#1794) fd4be12 remove dead indexing code (csarofeen#1806) fa4e6a4 Check siblings in getMaxPosAll (csarofeen#1805) 025c840 Grouping grid allreduces across iterations (csarofeen#1755) 37c579e Temporarily disable test requring large shared memory. (csarofeen#1802) 5f375d0 More cleanup on InlinePropagator (csarofeen#1800) 8d384da Indexing refactor stage 2 : Remove reference tensor in predicate indexing logic (csarofeen#1784) f008140 MMA Rfactor support for cross-warp and cross-CTA split on K dimension (csarofeen#1554) 76b3cca Add parsing support for `_to_copy` to handle AMP casts. (csarofeen#1756) ef04f6c Coding style cleanups (csarofeen#1798) 38c7f3c InlinePropagator please don't replay (csarofeen#1797) 3f2c263 validateDomain in TransformPropagator (csarofeen#1796) c077085 Use TransformPropagatorWithCheck in many tests (csarofeen#1795) d0d0908 Some further cleanup for the new computeAt interface (csarofeen#1793) 45f5203 Fix TransformReplay::getMatchedLeafPosWithoutReplay* (csarofeen#1791) 28cbaf9 New compute at interface (csarofeen#1743) 635ebfc Add SpanningTreePrinter (csarofeen#1786) 59f3c32 Output allocate patch (csarofeen#1790) fe93bf5 Transform propagator skip replay when possible (csarofeen#1782) ebf23a5 Fix isIntegralType error msg (csarofeen#1789) 0c82ecf Disable register reuse across serial broadcast ops (csarofeen#1787) 33a824d Adding sibling path for MaxInfoSpanningTree (csarofeen#1776) 86f46aa Fix div(Val, TensorView) (csarofeen#1778) d3de227 Fix FusionMaxRootDomainInfoSpanningTreePrintTwice_CUDA (csarofeen#1781) ecc7a87 Extend mma dimension and layout checking to support strided batched matmul and tensor contractions (csarofeen#1761) ``` RUN_TORCHBENCH: nvfuser Differential Revision: [D38043938](https://our.internmc.facebook.com/intern/diff/D38043938) [ghstack-poisoned]
Syncing nvfuser devel branch to upstream master. https://github.com/csarofeen/pytorch/ Code changes includes: - codegen improvements: 1. Indexing refactor -> Remove reference tensor in predicate indexing logic 2. MMA Rfactor support for cross-warp and cross-CTA split on K dimension 3. Grouping grid allreduces across iterations 4. Swizzle op formulation for non-affine swizzles 5. Use scheduler_utils to cache inputs and outputs in schedulePointwise - scheduler refactor 1. New compute at interface - transformation propagation refactor on MaxInfoSpanningTree 1. Added sibling path that is required to generate consistent replay for some cases where `MaxInfoSpanningTree` is used with a selector. 2. Optimization to skip Transform propagator 3. SpanningTreePrinter for debugging - parser update 1. Fixes `div` 2. Added `_to_copy` 3. Broadcast in dim with expand to support expanding to concrete size 4. Dropout prob extremal patch - executor patch on caching strides for output allocation Squashed commits to WAR github API Commits that's actually in this PR from the devel branch: ``` 3b87896 Fix allocation of work buffers and `fused_reduction::ParallelReduce` with unswitch (#1818) 4cae122 schedulePointwise cleanup: - computeAt + InlinePropagator (#1815) 3df9742 Use scheduler_utils to cache inputs and outputs in schedulePointwise (#1811) 03180aa improve broadcast resolution (#1792) bee6c69 bug fix (#1819) 4413c8f Support PYTORCH_NVFUSER_DUMP=transform_propagator (#1812) de6b7ca Fix negative position in InlinePropagator (#1813) 10a996c Remove redundant check in schedulePointwise (#1810) acd5ed4 Swizzle op formulation for non-affine swizzles (#1441) 3ed8330 Kernel args patch to show zero_init buffer (#1809) 037a75a Dropout prob extremal patch (#1804) 282c429 spam nvrtc options (#1783) 3ba6a5f Broadcast in dim with expand (#1794) fd4be12 remove dead indexing code (#1806) fa4e6a4 Check siblings in getMaxPosAll (#1805) 025c840 Grouping grid allreduces across iterations (#1755) 37c579e Temporarily disable test requring large shared memory. (#1802) 5f375d0 More cleanup on InlinePropagator (#1800) 8d384da Indexing refactor stage 2 : Remove reference tensor in predicate indexing logic (#1784) f008140 MMA Rfactor support for cross-warp and cross-CTA split on K dimension (#1554) 76b3cca Add parsing support for `_to_copy` to handle AMP casts. (#1756) ef04f6c Coding style cleanups (#1798) 38c7f3c InlinePropagator please don't replay (#1797) 3f2c263 validateDomain in TransformPropagator (#1796) c077085 Use TransformPropagatorWithCheck in many tests (#1795) d0d0908 Some further cleanup for the new computeAt interface (#1793) 45f5203 Fix TransformReplay::getMatchedLeafPosWithoutReplay* (#1791) 28cbaf9 New compute at interface (#1743) 635ebfc Add SpanningTreePrinter (#1786) 59f3c32 Output allocate patch (#1790) fe93bf5 Transform propagator skip replay when possible (#1782) ebf23a5 Fix isIntegralType error msg (#1789) 0c82ecf Disable register reuse across serial broadcast ops (#1787) 33a824d Adding sibling path for MaxInfoSpanningTree (#1776) 86f46aa Fix div(Val, TensorView) (#1778) d3de227 Fix FusionMaxRootDomainInfoSpanningTreePrintTwice_CUDA (#1781) ecc7a87 Extend mma dimension and layout checking to support strided batched matmul and tensor contractions (#1761) ``` RUN_TORCHBENCH: nvfuser Differential Revision: [D38043938](https://our.internmc.facebook.com/intern/diff/D38043938) Pull Request resolved: pytorch#81861 Approved by: https://github.com/davidberard98
This comment in the code describes what this PR is doing: