Skip to content

Commit

Permalink
More changes for hidden visibility (pytorch#10692)
Browse files Browse the repository at this point in the history
Summary:
Let's run CI tests to see what fails given the changes that just landed in pytorch#10624

cc mingzhe09088 ezyang Yangqing
Pull Request resolved: pytorch#10692

Reviewed By: mingzhe09088

Differential Revision: D9423617

Pulled By: orionr

fbshipit-source-id: 3bda1f118d13f8dd8e823727c93167cae747d8cf
  • Loading branch information
orionr authored and facebook-github-bot committed Aug 21, 2018
1 parent 8a1739b commit edb3443
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 53 deletions.
2 changes: 1 addition & 1 deletion aten/src/ATen/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace at {
/// 1. A negative index represents the current device, a non-negative index
/// represents a specific, concrete device,
/// 2. When the device type is CPU, the device index must be zero.
struct Device {
struct AT_API Device {
using Type = at::DeviceType;

/// Constructs a new `Device` from a `DeviceType` and an optional device
Expand Down
4 changes: 3 additions & 1 deletion aten/src/ATen/Generator.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#pragma once

#include <ATen/ATenGeneral.h>

#include <stdint.h>

namespace at {

struct Generator {
struct AT_API Generator {
Generator() {};
Generator(const Generator& other) = delete;
Generator(Generator&& other) = delete;
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/OptionsGuard.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct DefaultTensorOptions {
/// Returns the current thread local default options.
/// Defined in OptionsGuard.cpp because we can't use optional in headers, due
/// to Windows and other compilers.
static TensorOptions& get();
AT_API static TensorOptions& get();

private:
/// This is an optional because of compiler bugs that mis-initialize static
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/function_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def TypedDict(name, attrs, total=True): # type: ignore

# add non-virtual declaration to Tensor.h
TENSOR_METHOD_DECLARATION = CodeTemplate("""\
AT_API ${return_type} ${api_name}(${method_formals_with_defaults})${const_mark};
${return_type} ${api_name}(${method_formals_with_defaults})${const_mark};
""")
# add non-virtual declaration to Tensor.cpp
TENSOR_METHOD_DEFINITION = CodeTemplate("""\
Expand Down
4 changes: 2 additions & 2 deletions aten/src/ATen/templates/Tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace at {
//
// Note that Tensor can also be NULL, i.e. it is not associated with any underlying TensorImpl, and
// special care must be taken to handle this.
struct Tensor : public detail::TensorBase {
struct AT_API Tensor : public detail::TensorBase {
using TensorBase = detail::TensorBase;
Tensor() : TensorBase() {}
Tensor(TensorImpl * self, bool retain) : TensorBase(self, retain) {}
Expand Down Expand Up @@ -204,7 +204,7 @@ struct Tensor : public detail::TensorBase {
friend struct WeakTensor;
};

struct WeakTensor : public detail::WeakTensorBase {
struct AT_API WeakTensor : public detail::WeakTensorBase {
using WeakTensorBase = detail::WeakTensorBase;
WeakTensor() : WeakTensorBase() {}
WeakTensor(TensorImpl * self, bool retain) : WeakTensorBase(self, retain) {}
Expand Down
3 changes: 2 additions & 1 deletion caffe2/contrib/script/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace caffe2 {
namespace script {

struct CompilationUnitImpl;
struct CompilationUnit {

struct CAFFE2_API CompilationUnit {
CompilationUnit();
void define(const std::string& str);
void defineExtern(const std::string& str, std::unique_ptr<NetDef> netdef);
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/blob_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ namespace BlobStat {
* Return size in bytes of the blob, if available for a blob of given type.
* If not available, return 0.
*/
size_t sizeBytes(const Blob& blob);
CAFFE2_API size_t sizeBytes(const Blob& blob);
}
}
12 changes: 6 additions & 6 deletions caffe2/core/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum Mode { READ, WRITE, NEW };
/**
* An abstract class for the cursor of the database while reading.
*/
class Cursor {
class CAFFE2_API Cursor {
public:
Cursor() { }
virtual ~Cursor() { }
Expand Down Expand Up @@ -58,7 +58,7 @@ class Cursor {
/**
* An abstract class for the current database transaction while writing.
*/
class Transaction {
class CAFFE2_API Transaction {
public:
Transaction() { }
virtual ~Transaction() { }
Expand All @@ -77,7 +77,7 @@ class Transaction {
/**
* An abstract class for accessing a database of key-value pairs.
*/
class DB {
class CAFFE2_API DB {
public:
DB(const string& /*source*/, Mode mode) : mode_(mode) {}
virtual ~DB() { }
Expand Down Expand Up @@ -141,7 +141,7 @@ inline bool DBExists(const string& db_type, const string& full_db_name) {
/**
* A reader wrapper for DB that also allows us to serialize it.
*/
class DBReader {
class CAFFE2_API DBReader {
public:

friend class DBReaderSerializer;
Expand Down Expand Up @@ -288,7 +288,7 @@ class DBReader {
AT_DISABLE_COPY_AND_ASSIGN(DBReader);
};

class DBReaderSerializer : public BlobSerializerBase {
class CAFFE2_API DBReaderSerializer : public BlobSerializerBase {
public:
/**
* Serializes a DBReader. Note that this blob has to contain DBReader,
Expand All @@ -300,7 +300,7 @@ class DBReaderSerializer : public BlobSerializerBase {
BlobSerializerBase::SerializationAcceptor acceptor) override;
};

class DBReaderDeserializer : public BlobDeserializerBase {
class CAFFE2_API DBReaderDeserializer : public BlobDeserializerBase {
public:
void Deserialize(const BlobProto& proto, Blob* blob) override;
};
Expand Down
4 changes: 2 additions & 2 deletions caffe2/core/logging_is_not_google_glog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const int INFO = 0;
const char CAFFE2_SEVERITY_PREFIX[] = "FEWIV";

namespace caffe2 {
class MessageLogger {
class CAFFE2_API MessageLogger {
public:
MessageLogger(const char *file, int line, int severity);
~MessageLogger();
Expand All @@ -46,7 +46,7 @@ class MessageLogger {
// This class is used to explicitly ignore values in the conditional
// logging macros. This avoids compiler warnings like "value computed
// is not used" and "statement has no effect".
class LoggerVoidify {
class CAFFE2_API LoggerVoidify {
public:
LoggerVoidify() { }
// This has to be an operator with a precedence lower than << but
Expand Down
4 changes: 2 additions & 2 deletions caffe2/core/memonger.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
namespace caffe2 {
namespace memonger {

NetDef optimize_inference_net(
CAFFE2_API NetDef optimize_inference_net(
const NetDef& net,
const std::set<string>& static_blobs);

NetDef compute_blob_recycling_for_dag(
CAFFE2_API NetDef compute_blob_recycling_for_dag(
const NetDef& net,
const std::vector<string>& heads,
const std::vector<int>& op_indices,
Expand Down
8 changes: 4 additions & 4 deletions caffe2/core/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace caffe2 {
* different modules. Currently, we only store the name and a simple
* description of what this module does.
*/
class ModuleSchema {
class CAFFE2_API ModuleSchema {
public:
ModuleSchema(const char* name, const char* description);

Expand All @@ -45,12 +45,12 @@ class ModuleSchema {
* the reason we do not include ".so" is for cross-platform compatibility
* on platforms like mac os.
*/
const CaffeMap<string, const ModuleSchema*>& CurrentModules();
CAFFE2_API const CaffeMap<string, const ModuleSchema*>& CurrentModules();

/**
* @brief Checks whether a module is already present in the current binary.
*/
bool HasModule(const string& name);
CAFFE2_API bool HasModule(const string& name);

/**
* @brief Load a module.
Expand All @@ -60,7 +60,7 @@ bool HasModule(const string& name);
* full path option to only experimental modules.
* filename: (optional) a filename that serves as a hint to load the module.
*/
void LoadModule(const string& name, const string& filename="");
CAFFE2_API void LoadModule(const string& name, const string& filename="");


#define CAFFE2_MODULE(name, description) \
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_async_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace tracing {
class Tracer;
}

class AsyncNetBase : public NetBase {
class CAFFE2_API AsyncNetBase : public NetBase {
public:
AsyncNetBase(const std::shared_ptr<const NetDef>& net_def, Workspace* ws);
~AsyncNetBase() override;
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_async_scheduling.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace caffe2 {

class AsyncSchedulingNet : public AsyncNetBase {
class CAFFE2_API AsyncSchedulingNet : public AsyncNetBase {
public:
AsyncSchedulingNet(
const std::shared_ptr<const NetDef>& net_def,
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/qtensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace caffe2 {

template <class Context>
class QTensor {
class CAFFE2_API QTensor {
public:
QTensor() {}
virtual ~QTensor() {}
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CAFFE2_API const TypeMeta& DataTypeToTypeMeta(const TensorProto::DataType& dt);
static_assert(sizeof(unsigned short) == 2,
"Short on this platform is not 16 bit.");
namespace caffe2 {
typedef struct CAFFE2_ALIGNED(2) __f16 { uint16_t x; } float16;
typedef struct CAFFE2_API CAFFE2_ALIGNED(2) __f16 { uint16_t x; } float16;

// Helpers to avoid using typeinfo with -rtti
template <typename T>
Expand Down
5 changes: 3 additions & 2 deletions caffe2/observers/runcnt_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
namespace caffe2 {

class RunCountNetObserver;
class RunCountOperatorObserver final : public ObserverBase<OperatorBase> {

class CAFFE2_API RunCountOperatorObserver final : public ObserverBase<OperatorBase> {
public:
explicit RunCountOperatorObserver(OperatorBase* op) = delete;
RunCountOperatorObserver(OperatorBase* op, RunCountNetObserver* netObserver);
Expand All @@ -25,7 +26,7 @@ class RunCountOperatorObserver final : public ObserverBase<OperatorBase> {
RunCountNetObserver* netObserver_;
};

class RunCountNetObserver final : public OperatorAttachingNetObserver<
class CAFFE2_API RunCountNetObserver final : public OperatorAttachingNetObserver<
RunCountOperatorObserver,
RunCountNetObserver> {
public:
Expand Down
9 changes: 5 additions & 4 deletions caffe2/observers/time_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
namespace caffe2 {

class TimeObserver;
class TimeCounter {

class CAFFE2_API TimeCounter {
public:
explicit TimeCounter() {}
inline float average_time() const {
Expand All @@ -27,8 +28,8 @@ class TimeCounter {
int iterations_ = 0;
};

class TimeOperatorObserver final : public TimeCounter,
public ObserverBase<OperatorBase> {
class CAFFE2_API TimeOperatorObserver final : public TimeCounter,
public ObserverBase<OperatorBase> {
public:
explicit TimeOperatorObserver(OperatorBase* subject) = delete;
explicit TimeOperatorObserver(
Expand All @@ -44,7 +45,7 @@ class TimeOperatorObserver final : public TimeCounter,
void Stop() override;
};

class TimeObserver final
class CAFFE2_API TimeObserver final
: public TimeCounter,
public OperatorAttachingNetObserver<TimeOperatorObserver, TimeObserver> {
public:
Expand Down
10 changes: 5 additions & 5 deletions caffe2/onnx/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using ::ONNX_NAMESPACE::ValueInfoProto;

using ValueInfoMap = std::unordered_map<std::string, ValueInfoProto>;

class ConversionContext {
class CAFFE2_API ConversionContext {
public:
ConversionContext(const ValueInfoMap& value_infos, int opset_version)
: value_infos_(value_infos), opset_version_(opset_version) {}
Expand All @@ -44,15 +44,15 @@ class ConversionContext {
// \brief This struct holds the converted ops after the onnx->c2 conversion.
// Notice that for RNN ops, it may create ops in init_net. Hence we have the
// `init_ops` field.
struct Caffe2Ops {
struct CAFFE2_API Caffe2Ops {
::google::protobuf::RepeatedPtrField<caffe2::OperatorDef> init_ops;
::google::protobuf::RepeatedPtrField<caffe2::OperatorDef> ops;
::google::protobuf::RepeatedPtrField<std::string> interface_blobs;
};

// A convenient class to query attributes of a NodeProto. Note that the
// NodeProto can not be modified during the query of OnnxAttributes object
class OnnxAttributes {
class CAFFE2_API OnnxAttributes {
public:
OnnxAttributes(const NodeProto& node);

Expand Down Expand Up @@ -120,15 +120,15 @@ template <>
const TensorProto* OnnxAttributes::get(const std::string& key) const;

// convenient class for onnx node
struct OnnxNode {
struct CAFFE2_API OnnxNode {
OnnxNode(const NodeProto& node_in) : node(node_in), attributes(node_in) {}

const NodeProto& node;

OnnxAttributes attributes;
};

class Caffe2Backend {
class CAFFE2_API Caffe2Backend {
public:
// Since we still have this Python-C++ hybrid flow, we will need to take the
// DummyName generator from Python as a pointer. In this case, Python env owns
Expand Down
2 changes: 1 addition & 1 deletion caffe2/onnx/backend_rep.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <vector>

namespace caffe2 { namespace onnx {
class Caffe2BackendRep {
class CAFFE2_API Caffe2BackendRep {
public:
void Run(
const caffe2::Predictor::TensorVector& inputs,
Expand Down
2 changes: 1 addition & 1 deletion caffe2/operators/counter_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace caffe2 {
template <typename T>
class Counter {
class CAFFE2_API Counter {
public:
explicit Counter(T count) : count_(count) {}
bool countDown() {
Expand Down
2 changes: 1 addition & 1 deletion caffe2/operators/create_scope_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace detail {
* Keeps track of forward and backward gradient workspaces in stack,
* reuses previously created workspaces, non-thread safe
*/
class WorkspaceStack {
class CAFFE2_API WorkspaceStack {
public:
explicit WorkspaceStack() : parent_ws_(nullptr), top_(-1) {}

Expand Down
2 changes: 1 addition & 1 deletion caffe2/operators/rnn/recurrent_network_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ std::unique_ptr<RecurrentNetworkExecutorBase> createRNNExecutor(
std::string timestep_blob,
ArgumentHelper rnn_args);

class ThreadedRecurrentNetworkExecutor : public RecurrentNetworkExecutorBase {
class CAFFE2_API ThreadedRecurrentNetworkExecutor : public RecurrentNetworkExecutorBase {
public:
ThreadedRecurrentNetworkExecutor(
const NetDef& step_net_def,
Expand Down
2 changes: 1 addition & 1 deletion caffe2/operators/rnn/recurrent_network_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct Link {
int32_t window{1};
};

struct ScratchWorkspaces {
struct CAFFE2_API ScratchWorkspaces {
std::vector<std::shared_ptr<Workspace>> stepWorkspaces;
std::shared_ptr<Workspace> sharedBlobsWs = nullptr;
};
Expand Down
Loading

0 comments on commit edb3443

Please sign in to comment.