@@ -47,6 +47,8 @@ namespace dlib
4747 bool is_inverse{};
4848 };
4949
50+ // ----------------------------------------------------------------------------------------------------------------
51+
5052 inline bool operator ==(const plan_key& a, const plan_key& b)
5153 {
5254 return a.size == b.size &&
@@ -57,40 +59,26 @@ namespace dlib
5759 }
5860
5961// ----------------------------------------------------------------------------------------------------------------
60-
61- }
62- }
63-
64- // ----------------------------------------------------------------------------------------------------------------
65-
66- template <>
67- struct std ::hash<dlib::mkl_details::plan_key>
68- {
69- std::size_t operator ()(const dlib::mkl_details::plan_key& s) const noexcept
70- {
71- uint32_t hash = 0 ;
72- hash = dlib::hash (s.size , hash);
73- hash = dlib::hash ((uint32_t )s.is_inplace , hash);
74- hash = dlib::hash ((uint32_t )s.is_single_precision , hash);
75- hash = dlib::hash ((uint32_t )s.is_complex , hash);
76- hash = dlib::hash ((uint32_t )s.is_inverse , hash);
77- return hash;
78- }
79- };
80-
81- // ----------------------------------------------------------------------------------------------------------------
82-
83- namespace dlib
84- {
85-
86- namespace mkl_details
87- {
62+
63+ struct hasher
64+ {
65+ uint32_t operator ()(const plan_key& s) const noexcept
66+ {
67+ uint32_t hash = 0 ;
68+ hash = dlib::hash (s.size , hash);
69+ hash = dlib::hash ((uint32_t )s.is_inplace , hash);
70+ hash = dlib::hash ((uint32_t )s.is_single_precision , hash);
71+ hash = dlib::hash ((uint32_t )s.is_complex , hash);
72+ hash = dlib::hash ((uint32_t )s.is_inverse , hash);
73+ return hash;
74+ }
75+ };
8876
8977// ----------------------------------------------------------------------------------------------------------------
9078
9179 inline const auto & get_handle (const plan_key& key)
9280 {
93- thread_local std::unordered_map<plan_key, mkl_ptr> plans;
81+ thread_local std::unordered_map<plan_key, mkl_ptr, hasher > plans;
9482
9583 if (plans.find (key) == plans.end ())
9684 {
@@ -191,7 +179,7 @@ namespace dlib
191179 DLIB_ASSERT (dims.num_dims () < 3 , " we currently only support up to 2D FFT. Please submit an issue on github if 3D or above is required." );
192180 DLIB_ASSERT (dims.back () % 2 == 0 , " last dimension needs to be even" );
193181
194- #ifdef QDSP_USE_MKL_WITH_TBB
182+ #ifdef DLIB_USE_MKL_WITH_TBB
195183 (void )TBB_runtime_version ();
196184 #endif
197185
@@ -223,7 +211,7 @@ namespace dlib
223211 DLIB_ASSERT (dims.num_dims () < 3 , " we currently only support up to 2D FFT. Please submit an issue on github if 3D or above is required." );
224212 DLIB_ASSERT (dims.back () % 2 == 0 , " last dimension needs to be even" );
225213
226- #ifdef QDSP_USE_MKL_WITH_TBB
214+ #ifdef DLIB_USE_MKL_WITH_TBB
227215 (void )TBB_runtime_version ();
228216 #endif
229217
0 commit comments