Skip to content

Commit

Permalink
Fix namespace errors in PyTorch CI (#532)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #532

PyTorch CI has some issues with the two namespaces such as Config defined in KINETO_NAMESPACE. Add using namespace to the failed areas.

Test Plan:
Fixes the errors on CI tests vulkan-bionic-py3.7-clang9, xenial-cuda11.3-py3.7-gcc7, xenial-py3.7-clang7-asan,xenial-py3.7-clang7-onnx, xenial-py3.7-gcc5.4, xenial-py3.7-gcc7, xenial-py3.6-gcc7-no-ops:
```
2022-02-15T17:42:01.5120839Z In file included from /var/lib/jenkins/workspace/torch/csrc/autograd/profiler_kineto.cpp:23:
2022-02-15T17:42:01.5122878Z In file included from /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/libkineto.h:18:
2022-02-15T17:42:01.5123681Z In file included from /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/ActivityProfilerInterface.h:12:
2022-02-15T17:42:01.5125190Z /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/IActivityProfiler.h:92:13: error: unknown type name 'Config'; did you mean 'KINETO_NAMESPACE::Config'?
2022-02-15T17:42:01.5127932Z       const Config& config) = 0;
2022-02-15T17:42:01.5128356Z             ^~~~~~
2022-02-15T17:42:01.5128871Z             KINETO_NAMESPACE::Config
2022-02-15T17:42:01.5129844Z /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/Config.h:19:7: note: 'KINETO_NAMESPACE::Config' declared here
2022-02-15T17:42:01.5130467Z class Config : public AbstractConfig {
2022-02-15T17:42:01.5132737Z       ^
2022-02-15T17:42:01.5133430Z In file included from /var/lib/jenkins/workspace/torch/csrc/autograd/profiler_kineto.cpp:23:
2022-02-15T17:42:01.5134143Z In file included from /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/libkineto.h:18:
2022-02-15T17:42:01.5134920Z In file included from /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/ActivityProfilerInterface.h:12:
2022-02-15T17:42:01.5136267Z /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/IActivityProfiler.h:99:13: error: unknown type name 'Config'; did you mean 'KINETO_NAMESPACE::Config'?
2022-02-15T17:42:01.5162842Z       const Config& config) = 0;
2022-02-15T17:42:01.5163525Z             ^~~~~~
2022-02-15T17:42:01.5165565Z             KINETO_NAMESPACE::Config
2022-02-15T17:42:01.5166108Z /var/lib/jenkins/workspace/third_party/kineto/libkineto/include/Config.h:19:7: note: 'KINETO_NAMESPACE::Config' declared here
2022-02-15T17:42:01.5166657Z class Config : public AbstractConfig {
2022-02-15T17:42:01.5166901Z       ^
2022-02-15T17:42:01.5167612Z
```

Reviewed By: briancoutinho

Differential Revision: D34249427

Pulled By: aaronenyeshi

fbshipit-source-id: 77bc184715579cc16d615c652ffebf54232e972b
  • Loading branch information
aaronenyeshi authored and facebook-github-bot committed Feb 16, 2022
1 parent 7176010 commit b654f58
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions libkineto/include/IActivityProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace libkineto {

using namespace KINETO_NAMESPACE;

#ifdef _MSC_VER
// workaround for the predefined ERROR macro on Windows
#undef ERROR
Expand Down
4 changes: 2 additions & 2 deletions libkineto/include/ILoggerObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ constexpr char kPostProcessingStage[] = "Post Processing";
#include <map>
#include <vector>

namespace KINETO_NAMESPACE {
namespace libkineto {

enum LoggerOutputType {
VERBOSE = 0,
Expand Down Expand Up @@ -45,6 +45,6 @@ class ILoggerObserver {

};

} // namespace KINETO_NAMESPACE
} // namespace libkineto

#endif // !USE_GOOGLE_LOG
4 changes: 2 additions & 2 deletions libkineto/src/ILoggerObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <array>
#include <fmt/format.h>

namespace KINETO_NAMESPACE {
namespace libkineto {

struct LoggerTypeName {
constexpr LoggerTypeName(const char* n, LoggerOutputType t) : name(n), type(t) {};
Expand Down Expand Up @@ -48,7 +48,7 @@ LoggerOutputType toLoggerOutputType(const std::string& str) {
throw std::invalid_argument(fmt::format("Invalid activity type: {}", str));
}

} // namespace KINETO_NAMESPACE
} // namespace libkineto


#endif // !USE_GOOGLE_LOG
2 changes: 2 additions & 0 deletions libkineto/src/LoggerCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

namespace KINETO_NAMESPACE {

using namespace libkineto;

class LoggerCollector : public ILoggerObserver {
public:
LoggerCollector() : buckets_() {}
Expand Down

0 comments on commit b654f58

Please sign in to comment.