summaryrefslogtreecommitdiffstats
path: root/thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp
diff options
context:
space:
mode:
authorDario <dariosamo@gmail.com>2023-09-18 10:05:20 -0300
committerDario <dariosamo@gmail.com>2023-09-25 14:53:45 -0300
commitab65effed015df76b0858df27127f62b3aa94e0e (patch)
treecab7bbbdd2b63235b809560e47c3ac3784fa892b /thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp
parent1b2b726502eabaae4a15d544d92735cc2efe35b5 (diff)
downloadredot-engine-ab65effed015df76b0858df27127f62b3aa94e0e.tar.gz
Remove denoise module and thirdparty OIDN.
This is replaced by a much lighter weight and faster JNLM denoiser. OIDN is still much more accurate, and may be provided as an optional backend in the future, but the JNLM denoiser seems good enough for most use cases and removing OIDN reduces the build system complexity, binary size, and build times very significantly.
Diffstat (limited to 'thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp')
-rw-r--r--thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp112
1 files changed, 0 insertions, 112 deletions
diff --git a/thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp b/thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp
deleted file mode 100644
index 6bc14fc72a..0000000000
--- a/thirdparty/oidn/mkl-dnn/src/common/scratchpad.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
-* Copyright 2017-2018 Intel Corporation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*******************************************************************************/
-
-#include "mkldnn_thread.hpp"
-#include "utils.hpp"
-
-#include "scratchpad.hpp"
-
-namespace mkldnn {
-namespace impl {
-
-/* Allocating memory buffers on a page boundary to reduce TLB/page misses */
-const size_t page_size = 2097152;
-
-/*
- Implementation of the scratchpad_t interface that is compatible with
- a concurrent execution
-*/
-struct concurent_scratchpad_t : public scratchpad_t {
- concurent_scratchpad_t(size_t size) {
- size_ = size;
- scratchpad_ = (char *) malloc(size, page_size);
- assert(scratchpad_ != nullptr);
- }
-
- ~concurent_scratchpad_t() {
- free(scratchpad_);
- }
-
- virtual char *get() const {
- return scratchpad_;
- }
-
-private:
- char *scratchpad_;
- size_t size_;
-};
-
-/*
- Implementation of the scratchpad_t interface that uses a global
- scratchpad
-*/
-
-struct global_scratchpad_t : public scratchpad_t {
- global_scratchpad_t(size_t size) {
- if (size > size_) {
- if (scratchpad_ != nullptr) free(scratchpad_);
- size_ = size;
- scratchpad_ = (char *) malloc(size, page_size);
- assert(scratchpad_ != nullptr);
- }
- reference_count_++;
- }
-
- ~global_scratchpad_t() {
- reference_count_--;
- if (reference_count_ == 0) {
- free(scratchpad_);
- scratchpad_ = nullptr;
- size_ = 0;
- }
- }
-
- virtual char *get() const {
- return scratchpad_;
- }
-
-private:
- /*
- Using thread-local here is unnecessary and even buggy! All threads
- actually share the same scratchpad, which is created and queried only
- on the main thread. If the scratchpad is queried on some thread other
- than the one it was created on (e.g. the application calls the API from
- multiple threads), thread-local causes a segfault because the scratchpad
- is uninitialized on the current thread.
- */
- /*thread_local*/ static char *scratchpad_;
- /*thread_local*/ static size_t size_;
- /*thread_local*/ static unsigned int reference_count_;
-};
-
-/*thread_local*/ char *global_scratchpad_t::scratchpad_ = nullptr;
-/*thread_local*/ size_t global_scratchpad_t::size_ = 0;
-/*thread_local*/ unsigned int global_scratchpad_t::reference_count_ = 0;
-
-
-/*
- Scratchpad creation routine
-*/
-scratchpad_t *create_scratchpad(size_t size) {
-#ifndef MKLDNN_ENABLE_CONCURRENT_EXEC
- return new global_scratchpad_t(size);
-#else
- return new concurent_scratchpad_t(size);
-#endif
-}
-
-}
-}