1 | /******************************************************************************* |
2 | * Copyright 2020 Intel Corporation |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | *******************************************************************************/ |
16 | |
17 | #ifndef COMMON_SCRATCHPAD_DEBUG_HPP |
18 | #define COMMON_SCRATCHPAD_DEBUG_HPP |
19 | |
20 | #include <stdint.h> |
21 | |
22 | #include "memory_debug.hpp" |
23 | #include "memory_tracking.hpp" |
24 | |
25 | namespace dnnl { |
26 | namespace impl { |
27 | namespace scratchpad_debug { |
28 | // Static inline for optimization purposes when memory_debug is disabled |
29 | static inline bool is_protect_scratchpad() { |
30 | return memory_debug::is_mem_debug(); |
31 | } |
32 | void protect_scratchpad_buffer(void *scratchpad_ptr, engine_kind_t engine_kind, |
33 | const memory_tracking::registry_t ®istry); |
34 | void unprotect_scratchpad_buffer(const void *scratchpad_ptr, |
35 | engine_kind_t engine_kind, const memory_tracking::registry_t ®istry); |
36 | void protect_scratchpad_buffer(const memory_storage_t *storage, |
37 | const memory_tracking::registry_t ®istry); |
38 | void unprotect_scratchpad_buffer(const memory_storage_t *storage, |
39 | const memory_tracking::registry_t ®istry); |
40 | |
41 | } // namespace scratchpad_debug |
42 | } // namespace impl |
43 | } // namespace dnnl |
44 | #endif |
45 | |