Skip to content

Remove DisableOption::UnrollWithRng #1913

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

Merged
merged 1 commit into from
Aug 17, 2022
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
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 @@ -2194,12 +2194,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 @@ -120,8 +120,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 @@ -142,16 +141,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 @@ -64,8 +64,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