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

[WIP] Compute bounds for Index scalars in lowered kernel #3850

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions csrc/index_compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <expr_simplifier.h>
#include <instrumentation.h>
#include <ir/all_nodes.h>
#include <ir/builder.h>
#include <ir/iostream.h>
#include <ir/utils.h>
#include <logical_domain_map.h>
Expand Down Expand Up @@ -2717,6 +2718,14 @@ std::pair<Val*, Val*> Index::getCpAsyncBulkGmemIndex(
auto indices_inner_to_outer =
indexer.getIndexFor(ldst, !is_load, ids_to_index, loops);

// These are the box coordinates of the TMA box, which must be of type
// int32_t. Possible overflow in each of these dims should be checked
// elsewhere.
for (size_t i : c10::irange(indices_inner_to_outer.size())) {
indices_inner_to_outer[i] =
IrBuilder::maybeCastExpr(DataType::Int32, indices_inner_to_outer[i]);
}

auto coordinate = IrBuilder::arrayExpr(indices_inner_to_outer);
auto descriptor = tma_info.tensorMap();
if (is_load) {
Expand Down
5 changes: 5 additions & 0 deletions csrc/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <ir/base_nodes.h>
#include <ir/builder.h>
#include <parallel_dimension_map.h>
#include <type.h>
#include <utils.h>
#include <vectorization_info.h>
#include <visibility.h>
Expand Down Expand Up @@ -223,6 +224,10 @@ class NVF_API Kernel final : public Fusion {
return index_type_;
}

void setIndexType(PrimDataType new_index_type) {
index_type_ = new_index_type;
}

//! Checks if parallel type is padded
bool isParallelTypePadded(ParallelType ptype) const {
return ptype == ParallelType::TIDx &&
Expand Down
Loading
Loading