ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
Find a file
Chih-Hsuan Yen 4e73cc83d6
Fix building DNNL EP with clang (#10014)
Before this change, building DNNL EP from onnxruntime 1.10.0 with clang fails with:

In file included from /build/python-onnxruntime/src/onnxruntime/onnxruntime/core/providers/dnnl/subgraph/dnnl_squeeze.cc:4:
In file included from /build/python-onnxruntime/src/onnxruntime/onnxruntime/core/providers/dnnl/subgraph/dnnl_squeeze.h:5:
In file included from /build/python-onnxruntime/src/onnxruntime/onnxruntime/core/providers/dnnl/subgraph/dnnl_subgraph.h:10:
In file included from /build/python-onnxruntime/src/onnxruntime/onnxruntime/core/providers/shared_library/provider_api.h:19:
In file included from /build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/common.h:36:
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:33:6: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup
  ss << t;
     ^
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:39:3: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<std::vector<long>>' requested here
  MakeStringImpl(ss, args...);
  ^
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:39:3: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<const char *, std::vector<long>>' requested here
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:39:3: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<long, const char *, std::vector<long>>' requested here
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:39:3: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<const char *, long, const char *, std::vector<long>>' requested here
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:39:3: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<unsigned long, const char *, long, const char *, std::vector<long>>' requested here
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:46:3: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<const char *, unsigned long, const char *, long, const char *, std::vector<long>>' requested here
  MakeStringImpl(ss, args...);
  ^
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/make_string.h:93:18: note: in instantiation of function template specialization 'onnxruntime::detail::MakeStringImpl<const char *, unsigned long, const char *, long, const char *, std::vector<long>>' requested here
  return detail::MakeStringImpl(detail::if_char_array_make_ptr_t<Args const&>(args)...);
                 ^
/build/python-onnxruntime/src/onnxruntime/onnxruntime/core/providers/dnnl/subgraph/dnnl_squeeze.cc:46:7: note: in instantiation of function template specialization 'onnxruntime::MakeString<char [20], unsigned long, char [23], long, char [9], std::vector<long>>' requested here
      ORT_ENFORCE(data_dims[i] == 1, "Dimension of input ", i, " must be 1 instead of ", data_dims[i],
      ^
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/common/common.h:184:64: note: expanded from macro 'ORT_ENFORCE'
                                                ::onnxruntime::MakeString(__VA_ARGS__)); \
                                                               ^
/build/python-onnxruntime/src/onnxruntime/include/onnxruntime/core/framework/tensor_shape.h:147:15: note: 'operator<<' should be declared prior to the call site
std::ostream& operator<<(std::ostream& out, const TensorShape& shape);
              ^
1 error generated.
make[2]: *** [CMakeFiles/onnxruntime_providers_dnnl.dir/build.make:384: CMakeFiles/onnxruntime_providers_dnnl.dir/build/python-onnxruntime/src/onnxruntime/onnxruntime/core/providers/dnnl/subgraph/dnnl_squeeze.cc.o] Error 1

Two-phase lookups fail as:

1. visible in the template definition - fails as `std::ostream& operator<<(std::ostream& out, const TensorShape& shape)` (from include/onnxruntime/core/framework/tensor_shape.h) is defined after `template <typename... Args> std::string MakeString(const Args&... args)` (from include/onnxruntime/core/common/make_string.h) as per `clang++ -E`
2. argument-dependent lookup - fails as the argument data_dims has type `std::vector<long>` (via typedef in dnnl.hpp), while `std::ostream& operator<<(std::ostream& out, const TensorShape& shape)` is in namespace onnxruntime instead of std

There are several possible fixes:

* Make operator<< appear before MakeString by adjust the order of header files - I consider it fragile
* Also define operator<< in namespace std - may results in namespace pollution
* Use an argument of a class in onnxruntime namespace - this commit
2021-12-15 17:08:57 -08:00
.gdn Update compliance tasks in python packaging pipeline and fix some compile warnings (#8471) 2021-07-30 17:16:37 -07:00
.github Automate generation of C/C++ API docs (#9997) 2021-12-10 17:45:50 -08:00
cgmanifests add copyright (#9943) (#9970) 2021-12-08 14:34:53 -08:00
cmake Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
csharp Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
dockerfiles [OpenVINO-EP] V3.4 Release with OpenVINO 2021.4.2 LTS Release (#9848) 2021-11-23 13:12:08 -08:00
docs Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
include/onnxruntime/core Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
java Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
js Bump master version to 1.11 (#9957) 2021-12-14 23:32:06 -08:00
objectivec [Objective-C API] WIgnore clang documentation warnings from C/C++ header usage. (#9057) 2021-09-14 13:03:48 -07:00
onnxruntime Fix building DNNL EP with clang (#10014) 2021-12-15 17:08:57 -08:00
orttraining Yield op supports bf16 (#10035) 2021-12-14 13:12:37 -08:00
package/rpm Bump master version to 1.11 (#9957) 2021-12-14 23:32:06 -08:00
samples Add Python checks pipeline (#7032) 2021-08-09 10:37:05 -07:00
server Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
tools Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
winml Merge pull request #9917 from microsoft/user/dwayner/FnsCandyTolerance30696168 2021-12-02 22:45:45 -08:00
.clang-format
.clang-tidy
.dockerignore Update dockerfiles (#5929) 2020-11-25 15:38:22 -08:00
.flake8 Add Python checks pipeline (#7032) 2021-08-09 10:37:05 -07:00
.gitattributes
.gitignore Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
.gitmodules Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
build.amd64.1411.bat
build.bat
build.sh
CODEOWNERS Update ORTTraiing frontend codeowner (#9427) 2021-10-18 23:56:21 -07:00
CONTRIBUTING.md fixed the link (#8757) 2021-08-18 11:45:42 -07:00
LICENSE Remove year from license (#6658) 2021-02-12 00:25:56 -08:00
NuGet.config Delete nuget extra configs (#6477) 2021-01-27 20:25:45 -08:00
ort.wprp
packages.config Update to 1.8.0 2021-11-19 04:44:32 -08:00
README.md Fix typo 2021-08-12 15:57:15 -07:00
requirements-dev.txt Add post-install command to build PyTorch CPP extensions from within onnxruntime package (#8027) 2021-06-28 18:11:58 -07:00
requirements-doc.txt Add auto doc gen for ORTModule API during CI build (#7046) 2021-03-22 10:20:33 -07:00
requirements-training.txt Add post-install command to build PyTorch CPP extensions from within onnxruntime package (#8027) 2021-06-28 18:11:58 -07:00
requirements.txt.in Chang how numpy version is handled. (#8130) 2021-06-23 14:08:37 -07:00
setup.py Standalone TVM Executor Provider (#10019) 2021-12-15 16:59:20 -08:00
ThirdPartyNotices.txt add copyright (#9943) (#9970) 2021-12-08 14:34:53 -08:00
VERSION_NUMBER Bump master version to 1.11 (#9957) 2021-12-14 23:32:06 -08:00

ONNX Runtime is a cross-platform inference and training machine-learning accelerator.

ONNX Runtime inference can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. Learn more →

ONNX Runtime training can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. Learn more →

Get Started

General Information: onnxruntime.ai

Usage documention and tutorials: onnxruntime.ai/docs

Companion sample repositories:

Build Pipeline Status

System CPU GPU EPs
Windows Build Status Build Status Build Status
Linux Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Mac Build Status
Build Status
Android Build Status
iOS Build Status
WebAssembly Build Status

Data/Telemetry

Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.

Contributions and Feedback

We welcome contributions! Please see the contribution guidelines.

For feature requests or bug reports, please file a GitHub Issue.

For general discussion or questions, please use GitHub Discussions.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

This project is licensed under the MIT License.