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

patching nvfuser conv cudnn test numerics mismatch #2048

Merged
merged 2 commits into from
Oct 11, 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
1 change: 1 addition & 0 deletions torch/csrc/jit/codegen/cuda/test/test_gpu_shift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2976,6 +2976,7 @@ TEST_F(NVFuserTest, FusionConv2D_CUDA) {
TEST_F(NVFuserTest, FusionConv2DNoPadding_CUDA) {
Fusion fusion;
FusionGuard fg(&fusion);
ContextCudnnTF32Disabled disabling_tf32_cudnn;

// Input: [C, H, W]
auto inp = makeSymbolicTensor(3);
Expand Down
16 changes: 16 additions & 0 deletions torch/csrc/jit/codegen/cuda/test/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <torch/csrc/jit/codegen/cuda/lower_magic_zero.h>
#include <torch/csrc/jit/codegen/cuda/transform_replay.h>

#include <ATen/Context.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDACachingAllocator.h>
#include <torch/torch.h>
Expand Down Expand Up @@ -340,6 +341,21 @@ struct TransformPropagatorWithCheck : public TransformPropagator {

} // namespace

class ContextCudnnTF32Disabled {
public:
ContextCudnnTF32Disabled() {
flag_ = at::globalContext().allowTF32CuDNN();
at::globalContext().setAllowTF32CuDNN(false);
}

~ContextCudnnTF32Disabled() {
at::globalContext().setAllowTF32CuDNN(flag_);
}

private:
bool flag_;
};

// Fixture class must be uniquely identified, i.e., can't be in an
// anonymous namespace
class NVFuserTest : public ::testing::Test {
Expand Down