Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
naoyam committed Dec 11, 2024
1 parent 05ea88f commit 0ad9fea
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions csrc/id_model/indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,14 +845,18 @@ std::vector<Val*> TensorIndexer::getIndexFor(
const auto& replacement_map = getIndexReplacementMap(
expr, as_consumer, info.loop_domains, for_loops, info.index_map);

const auto index_groups = traversalGraph().toGroups(index_ids);
// Note that IDs of index_ids may be mapped as the traversal graph
// is the AlmostExact graph.

std::vector<Val*> result;
result.reserve(index_groups.size());
for (const auto& g : index_groups) {
auto it = info.index_map.find(g);
result.reserve(index_ids.size());
for (IterDomain* index_id : index_ids) {
const auto& index_group = traversalGraph().toGroup(index_id);
auto it = info.index_map.find(index_group);
NVF_ERROR(
it != info.index_map.end(), "Index not found for ", g->toString());
it != info.index_map.end(),
"Index not found for ",
index_id->toString());
result.push_back(
ir_utils::replaceValRecursively(it->second, replacement_map));
}
Expand Down

0 comments on commit 0ad9fea

Please sign in to comment.