Skip to content

Commit

Permalink
Revert D13304654: [pytorch][PR] Introduce LegacyTHDispatcher for disp…
Browse files Browse the repository at this point in the history
…atching to TH functions.

Differential Revision:
D13304654

Original commit changeset: cfe3e1a28adc

fbshipit-source-id: 06669d3c88f83e1d959e2c266fd608316539d42a
  • Loading branch information
ezyang authored and facebook-github-bot committed Dec 4, 2018
1 parent 264111b commit 9e58c4e
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 150 deletions.
11 changes: 0 additions & 11 deletions aten/src/ATen/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,6 @@ TypeExtendedInterface& getType(const Tensor& t) {
return getType(t.unsafeGetTensorImpl());
}

LegacyTHDispatcher& getLegacyTHDispatcher(TensorOptions options) {
return globalContext().getLegacyTHDispatcher(
options.backend(), typeMetaToScalarType(options.dtype()));
}

LegacyTHDispatcher& getLegacyTHDispatcher(const TensorImpl* impl) {
Backend backend = tensorTypeIdToBackend(impl->type_id());
return globalContext().getLegacyTHDispatcher(
backend, typeMetaToScalarType(impl->dtype()));
}

Allocator* getCPUAllocator() {
return getTHDefaultAllocator();
}
Expand Down
13 changes: 0 additions & 13 deletions aten/src/ATen/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "ATen/Type.h"
#include "ATen/TypeExtendedInterface.h"
#include "ATen/Utils.h"
#include "ATen/LegacyTHDispatch.h"
#include "ATen/LegacyTHDispatcher.h"
#include "ATen/core/ATenGeneral.h"
#include "ATen/core/Generator.h"
#include "ATen/core/LegacyTypeDispatch.h"
Expand Down Expand Up @@ -41,21 +39,13 @@ class CAFFE2_API Context {
TypeExtendedInterface & getType(Backend p, ScalarType s, bool is_variable) {
return static_cast<TypeExtendedInterface&>(globalLegacyTypeDispatch().getType(p, s, is_variable));
}
LegacyTHDispatcher& getLegacyTHDispatcher(Backend p, ScalarType s) {
return globalLegacyTHDispatch().getLegacyTHDispatcher(p, s);
}
// The passed in Type must be delete'able
// TODO: Just make it take a unique_ptr
void registerType(Backend b, ScalarType s, Type* t) {
globalLegacyTypeDispatch().registerType(b, s,
LegacyTypeDispatch::TypeUniquePtr{t, LegacyTypeDeleter([](Type* p) { delete p; }) });
}

void registerLegacyTHDispatcher(Backend b, ScalarType s, LegacyTHDispatcher* t) {
globalLegacyTHDispatch().registerDispatcher(b, s,
LegacyTHDispatch::LegacyTHDispatcherUniquePtr{t, LegacyTHDispatcherDeleter([](LegacyTHDispatcher* p) { delete p; }) });
}

Generator & defaultGenerator(DeviceType device_type) {
initCUDAIfNeeded(device_type);
initHIPIfNeeded(device_type);
Expand Down Expand Up @@ -192,9 +182,6 @@ static inline TypeExtendedInterface& HIP(ScalarType s) {
return getNonVariableType(Backend::HIP, s);
}

CAFFE2_API LegacyTHDispatcher& getLegacyTHDispatcher(TensorOptions options);
CAFFE2_API LegacyTHDispatcher& getLegacyTHDispatcher(const Tensor&);

static inline bool hasCUDA() {
return globalContext().hasCUDA();
}
Expand Down
12 changes: 0 additions & 12 deletions aten/src/ATen/LegacyTHDispatch.cpp

This file was deleted.

91 changes: 0 additions & 91 deletions aten/src/ATen/LegacyTHDispatch.h

This file was deleted.

5 changes: 0 additions & 5 deletions aten/src/ATen/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ def check_all_files_written(self):
TYPE_DEFAULT_H = CodeTemplate.from_file(TEMPLATE_PATH + "/TypeDefault.h")
TYPE_DEFAULT_CPP = CodeTemplate.from_file(TEMPLATE_PATH + "/TypeDefault.cpp")

LEGACY_TH_DISPATCHER_H = CodeTemplate.from_file(TEMPLATE_PATH + "/LegacyTHDispatcher.h")

REGISTER_CPU_H = CodeTemplate.from_file(TEMPLATE_PATH + "/RegisterCPU.h")
REGISTER_CPU_CPP = CodeTemplate.from_file(TEMPLATE_PATH + "/RegisterCPU.cpp")

Expand Down Expand Up @@ -346,7 +344,6 @@ def declare_outputs():
for f in core_files:
core_file_manager.will_write(f)
files = ['Declarations.yaml', 'TypeExtendedInterface.h', 'TypeDefault.cpp', 'TypeDefault.h',
'LegacyTHDispatcher.h',
'Functions.h', 'NativeFunctions.h', 'RegisterCPU.cpp', 'RegisterCPU.h']
for f in files:
file_manager.will_write(f)
Expand Down Expand Up @@ -426,8 +423,6 @@ def generate_outputs():
file_manager.write('TypeDefault.h', TYPE_DEFAULT_H, top_env)
file_manager.write('TypeDefault.cpp', TYPE_DEFAULT_CPP, top_env)

file_manager.write('LegacyTHDispatcher.h', LEGACY_TH_DISPATCHER_H, top_env)

file_manager.write('RegisterCPU.h', REGISTER_CPU_H, top_env)
file_manager.write('RegisterCPU.cpp', REGISTER_CPU_CPP, top_env)

Expand Down
18 changes: 0 additions & 18 deletions aten/src/ATen/templates/LegacyTHDispatcher.h

This file was deleted.

0 comments on commit 9e58c4e

Please sign in to comment.