Skip to content

Commit

Permalink
Create variable from structured binding so that it can be captured in…
Browse files Browse the repository at this point in the history
… lambda.

PiperOrigin-RevId: 725077126
  • Loading branch information
chsigg authored and copybara-github committed Feb 10, 2025
1 parent 2cef0d9 commit dabb220
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ FactorsToEdgeMap createSourceMap(
}
for (const auto& [oldFactorSharding, newFactorSharding] : llvm::zip_equal(
oldValue.factorIndexToSharding, newValue.factorIndexToSharding)) {
if (oldFactorSharding.second.axisRefs ==
newFactorSharding.second.axisRefs) {
const auto& newAxisRefs = newFactorSharding.second.axisRefs;
if (newAxisRefs == oldFactorSharding.second.axisRefs) {
continue;
}
SmallVector<AxisRefAttr> newlyIntroducedAxes;
Expand All @@ -149,7 +149,7 @@ FactorsToEdgeMap createSourceMap(
// dims, the dimension sharding will contain the conflicting axes,
// but the factor sharding will not. And we don't want this axis
// as it isn't a newly introduced axis.
for (AxisRefAttr newAxisRef : newFactorSharding.second.axisRefs) {
for (AxisRefAttr newAxisRef : newAxisRefs) {
if (newAxisRef.prefixOf(axisRef)) {
return true;
}
Expand All @@ -158,15 +158,15 @@ FactorsToEdgeMap createSourceMap(
});
}
// This factor sharding has changed, let's find who changed it.
if (std::optional<int64_t> operandSource = findNewAxisRefMatch(
newFactorSharding.second.axisRefs, oldFactorSharding.first,
oldShardingProjection.getOperands())) {
if (std::optional<int64_t> operandSource =
findNewAxisRefMatch(newAxisRefs, oldFactorSharding.first,
oldShardingProjection.getOperands())) {
saveEdges(newlyIntroducedAxes, oldFactorSharding.second.axisRefs,
EdgeNode{EdgeNodeType::OPERAND, *operandSource},
EdgeNode{valueType, valueIndex}, valueSourceMap[valueIndex]);
} else if (std::optional<int64_t> resultSource = findNewAxisRefMatch(
newFactorSharding.second.axisRefs, oldFactorSharding.first,
oldShardingProjection.getResults())) {
} else if (std::optional<int64_t> resultSource =
findNewAxisRefMatch(newAxisRefs, oldFactorSharding.first,
oldShardingProjection.getResults())) {
saveEdges(newlyIntroducedAxes, oldFactorSharding.second.axisRefs,
EdgeNode{EdgeNodeType::RESULT, *resultSource},
EdgeNode{valueType, valueIndex}, valueSourceMap[valueIndex]);
Expand Down

0 comments on commit dabb220

Please sign in to comment.