Skip to content

Commit

Permalink
Remove DisableOption::UnrollWithRng (#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
zasdfgbnm authored Aug 17, 2022
1 parent ee8ef33 commit 98febf6
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test/test_jit_cuda_fuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
CUDA_MAJOR, CUDA_MINOR = (int(x) for x in torch.version.cuda.split('.')[:2])

os.environ['PYTORCH_NVFUSER_ENABLE'] = 'linear_decomposition,conv_decomposition'
os.environ['PYTORCH_NVFUSER_DISABLE'] = 'fallback,fma,unroll_with_rng'
os.environ['PYTORCH_NVFUSER_DISABLE'] = 'fallback,fma'
os.environ['PYTORCH_NVFUSER_JIT_OPT_LEVEL'] = '0'
# TODO: enable complex when we fixes the extremal cases in OpInfo
# see issue https://github.com/csarofeen/pytorch/issues/1730"
Expand Down
6 changes: 0 additions & 6 deletions torch/csrc/jit/codegen/cuda/scheduler/pointwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ std::shared_ptr<PointwiseParams> getPointwiseHeuristics(
ceilDiv(n_elems, device_multiprocessor_count * kThreadX));
}

// If we use RNG don't unroll so we can do correctness testing
if (fusion->isStochastic() &&
isOptionDisabled(DisableOption::UnrollWithRng)) {
max_unroll_factor = 1;
}

auto params = std::make_shared<PointwiseParams>("Pointwise heuristics");

/*
Expand Down
6 changes: 0 additions & 6 deletions torch/csrc/jit/codegen/cuda/scheduler/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2149,12 +2149,6 @@ size_t expandVectorizationToContigMergedDomains(
TensorView* reference_tv,
int break_point,
size_t default_word_size) {
// Don't vectorize when RNG is used
if (fusion->isStochastic() &&
isOptionDisabled(DisableOption::UnrollWithRng)) {
return default_word_size;
}

size_t max_expand_size = SchedulerRuntimeInfo::max_alignment_size_in_byte;
size_t common_alignment_size =
SchedulerRuntimeInfo::max_alignment_size_in_byte;
Expand Down
8 changes: 2 additions & 6 deletions torch/csrc/jit/codegen/cuda/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ auto parseDisableOptions() {
{DisableOption::Fma, false},
{DisableOption::IndexHoist, false},
{DisableOption::Nvtx, false},
{DisableOption::PredicateElimination, false},
{DisableOption::UnrollWithRng, false}};
{DisableOption::PredicateElimination, false}};

if (const char* dump_options = std::getenv("PYTORCH_NVFUSER_DISABLE")) {
c10::string_view options_view(dump_options);
Expand All @@ -148,16 +147,13 @@ auto parseDisableOptions() {
options_map[DisableOption::Nvtx] = true;
} else if (token == "predicate_elimination") {
options_map[DisableOption::PredicateElimination] = true;
} else if (token == "unroll_with_rng") {
options_map[DisableOption::UnrollWithRng] = true;
} else {
TORCH_CHECK(
false,
"Invalid disable option: '",
token,
"'\nAvailable options:\n",
"\tarch_check, fallback, fma, index_hoist, nvtx, predicate_elimination\n",
"unroll_with_rng");
"\tarch_check, fallback, fma, index_hoist, nvtx, predicate_elimination\n");
}
options_view = (end_pos != c10::string_view::npos)
? options_view.substr(end_pos + 1)
Expand Down
3 changes: 1 addition & 2 deletions torch/csrc/jit/codegen/cuda/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ enum class DisableOption {
Fma, //! Disable FMA instructions
IndexHoist, //! Disable index hoisting
Nvtx, //! Disable NVTX instrumentation
PredicateElimination, //! Disable predicate elimination
UnrollWithRng //! Disable unrolling for kernels with RNG in them
PredicateElimination //! Disable predicate elimination
};

TORCH_CUDA_CU_API bool isOptionDisabled(DisableOption option);
Expand Down

0 comments on commit 98febf6

Please sign in to comment.