Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/op/builtin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ TVM_REGISTER_PASS_CONFIG_OPTION(kDisableDataRaceCheck, Bool);
TVM_REGISTER_PASS_CONFIG_OPTION(kEnableLowerLDGSTG, Bool);
TVM_REGISTER_PASS_CONFIG_OPTION(kEnableLowerLDGSTGPredicated, Bool);
TVM_REGISTER_PASS_CONFIG_OPTION(kDisableLoopUnswitching, Bool);
TVM_REGISTER_PASS_CONFIG_OPTION(kDisableOutOfBoundWarning, Bool);

DataType cuTensorMapType() { return DataType::UInt(8, 128); }

Expand Down
3 changes: 3 additions & 0 deletions src/op/builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ static constexpr const char *kDisableThreadStorageSync =
*/
static constexpr const char *kForceLetInline = "tl.force_let_inline";

static constexpr const char *kDisableOutOfBoundWarning =
"tl.disable_out_of_bound_warning";

/*!
* \brief Get the type of the CUDA tensor map
*
Expand Down
13 changes: 10 additions & 3 deletions src/transform/legalize_safe_memory_access.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ using arith::IRMutatorWithAnalyzer;
// log a warning (local/shared) or handle accordingly (global).
struct SafeMemChecker : public StmtExprVisitor {

bool disableOOBWarning = false;

SafeMemChecker(arith::Analyzer *analyzer, bool recursively_collect_conds)
: analyzer_(analyzer),
recursively_collect_conds_(recursively_collect_conds) {}
recursively_collect_conds_(recursively_collect_conds) {
disableOOBWarning =
tvm::transform::PassContext::Current()
->GetConfig(kDisableOutOfBoundWarning, Optional<Bool>())
.value_or(false);
}
void VisitExpr_(const BufferLoadNode *op) final {
// If the buffer is in global scope, we will check its indices and add
// corresponding bound checks.
Expand All @@ -42,7 +49,7 @@ struct SafeMemChecker : public StmtExprVisitor {
// we are writing TilePrograms. Therefore we only log warnings if there
// are possible out-of-bounds.
CheckBufferIndices(op->buffer, op->indices, /*is_load=*/true,
!IsGlobalBuffer(op->buffer));
!disableOOBWarning && !IsGlobalBuffer(op->buffer));
if (recursively_collect_conds_) {
StmtExprVisitor::VisitExpr_(op);
}
Expand All @@ -51,7 +58,7 @@ struct SafeMemChecker : public StmtExprVisitor {
void VisitStmt_(const BufferStoreNode *op) final {
// Check if the buffer is in global scope
CheckBufferIndices(op->buffer, op->indices, /*is_load=*/false,
!IsGlobalBuffer(op->buffer));
!disableOOBWarning && !IsGlobalBuffer(op->buffer));
if (recursively_collect_conds_) {
StmtExprVisitor::VisitStmt_(op);
}
Expand Down
3 changes: 3 additions & 0 deletions tilelang/transform/pass_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,6 @@ class PassConfigKey(str, Enum):

CUDA_KERNELS_OUTPUT_DIR = "cuda.kernels_output_dir"
"""Output directory for generated CUDA kernels. Default: empty string"""

TL_DISABLE_OUT_OF_BOUND_WARNING = "tl.disable_out_of_bound_warning"
"""Disable out-of-bound access warnings in safe memory access legalization. Default: False"""
Loading