-
Notifications
You must be signed in to change notification settings - Fork 225
Changing threading control interfaces (WIP) #2466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
olegkkruglov
wants to merge
76
commits into
uxlfoundation:main
Choose a base branch
from
olegkkruglov:tbb-arena
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 47 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
c06d49a
Add create_task_arena method
olegkkruglov a637a20
Add task_arena parameter to DAAL thread-pinner
olegkkruglov ea1f2c9
Rewrite dispatch_by_cpu method to send tasks into task_arena
olegkkruglov 109410c
Add TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION define
olegkkruglov 717a140
Move create_task_arena to cpp, add namespaces, rewrite threading_poli…
olegkkruglov bdced8d
Remove unnecessary print, move TBB-related define to the right place
olegkkruglov 1a5c3e1
Add returning value for thread_pinner.execute (WIP)
olegkkruglov 55258d6
WIP
olegkkruglov 36c53cb
Add thread_pinner and task_arena functionality to oneapi part
olegkkruglov 4ec54ba
policy(false, 1)
olegkkruglov 9920973
policy(false, 0)
olegkkruglov 64f776e
policy(true, 0)
olegkkruglov 30d2c0d
policy(true, 1)
olegkkruglov 3139371
Add threading_policy to host_policy and cpu_context
olegkkruglov 2c4c5b6
Changing interfaces to keep backward compatibility (WIP)
olegkkruglov 6084f0a
Codefactor fixes
olegkkruglov f5fa870
Remove redundant include
olegkkruglov ebf746e
Change task variable name
olegkkruglov 3e0c6be
Remove AVX and SSSE3 from dispatch_by_cpu
olegkkruglov 3569055
Add create_task_arena method
olegkkruglov d8379b0
Add task_arena parameter to DAAL thread-pinner
olegkkruglov 4b75be5
Rewrite dispatch_by_cpu method to send tasks into task_arena
olegkkruglov 0ee81ea
Add TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION define
olegkkruglov 62a7ba5
Move create_task_arena to cpp, add namespaces, rewrite threading_poli…
olegkkruglov 82e321f
Remove unnecessary print, move TBB-related define to the right place
olegkkruglov 7a162ea
Add returning value for thread_pinner.execute (WIP)
olegkkruglov 9be6702
WIP
olegkkruglov 07b2128
Add thread_pinner and task_arena functionality to oneapi part
olegkkruglov 9e21b9c
policy(false, 1)
olegkkruglov da9f2a7
policy(false, 0)
olegkkruglov 69676bd
policy(true, 0)
olegkkruglov cf56876
policy(true, 1)
olegkkruglov cd89718
Add threading_policy to host_policy and cpu_context
olegkkruglov efab72e
Changing interfaces to keep backward compatibility (WIP)
olegkkruglov d46b695
Codefactor fixes
olegkkruglov d2587d1
Remove redundant include
olegkkruglov c363ae0
Change task variable name
olegkkruglov 0d2176f
Apply clang-format
inteldimitrius 39248a5
Minor fixes
inteldimitrius 64e741b
Remove AVX and SSE3 dispatches
inteldimitrius 2a1fa57
Merge from inteldimitrius
olegkkruglov 898707f
Merge from master
olegkkruglov bf68169
Temporarily remove kmeans from BUILD file
olegkkruglov 458291c
Fix format
olegkkruglov 5c3a1ae
Return kmeans to BUILD file
olegkkruglov 8c87583
Merge branch 'master' into tbb-arena
olegkkruglov f5072ac
Merge branch 'master' into pr/olegkkruglov/2466
Alexsandruss 87abfdc
Merge branch 'tbb-arena' of https://github.com/olegkkruglov/oneDAL in…
olegkkruglov a64614c
Merge branch 'master' into pr/olegkkruglov/2466
Alexsandruss c0a1e4c
Merge branch 'master' into pr/olegkkruglov/2466
Alexsandruss 65473b3
Change threading policy API, add max_concurrency
Alexsandruss afb9ece
Merge branch 'tbb-arena' of https://github.com/olegkkruglov/oneDAL in…
olegkkruglov ed98fbb
Make default host_policy non-static
olegkkruglov 20d70e0
Fix clang-format
olegkkruglov 0502f7c
Remove setters from default_host_policy
olegkkruglov b93e768
Fix max_concurrency setting
olegkkruglov ba87921
Return hyperthreading disabling to DAAL side
olegkkruglov 6de90c2
Merge branch 'oneapi-src:master' into tbb-arena
olegkkruglov a782a6f
Revert "Return hyperthreading disabling to DAAL side"
Alexsandruss bb970ac
Enable external threading control in DAAL interface
Alexsandruss 63b92dc
Remove extra variable
Alexsandruss 457a681
Add macros to remove thread_pinner on macOS
olegkkruglov 440c40b
Fix for init of cpu context
Alexsandruss e8830f9
Set default max_threads_per_core parameter to 1
olegkkruglov ddacb17
Merge branch 'oneapi-src:master' into tbb-arena
olegkkruglov bf9b006
Change task_executor interfaces
olegkkruglov 7d61ae2
Disable new code on macOS
olegkkruglov de80db1
Fix
olegkkruglov 2776392
clang-format fix
olegkkruglov a95276e
Merge branch 'oneapi-src:master' into tbb-arena
olegkkruglov 4eb47a5
Remove new interfaces from windows
olegkkruglov bee0243
Add user_cpu_context and ability to provide host_policy via it
olegkkruglov ff5afff
Add forgotten pragma once
olegkkruglov 85d0ff3
Replace tbb include and turn on new interfaces on windows
olegkkruglov 8c8930a
Merge branch 'oneapi-src:master' into tbb-arena
olegkkruglov 9734264
Add new lines before EOF
olegkkruglov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/******************************************************************************* | ||
* Copyright 2023 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. | ||
*******************************************************************************/ | ||
#define TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION 1 | ||
|
||
#include "oneapi/dal/backend/threading.hpp" | ||
#include "src/threading/service_thread_pinner.h" | ||
ethanglaser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include "src/services/service_topo.h" | ||
ethanglaser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
namespace oneapi::dal::backend { | ||
|
||
struct task_daal : public daal::services::internal::thread_pinner_task_t { | ||
task_daal(task& f) : task_oneapi(f) {} | ||
void operator()() final { | ||
task_oneapi(); | ||
} | ||
task& task_oneapi; | ||
}; | ||
|
||
class thread_pinner_impl { | ||
public: | ||
thread_pinner_impl() { | ||
daal_thread_pinner = std::shared_ptr<daal::services::internal::thread_pinner_t>( | ||
daal::services::internal::getThreadPinner(true, read_topology, delete_topology)); | ||
} | ||
thread_pinner_impl(tbb::task_arena& task_arena) { | ||
daal_thread_pinner = std::shared_ptr<daal::services::internal::thread_pinner_t>( | ||
daal::services::internal::getThreadPinnerFromTaskArena(true, | ||
read_topology, | ||
delete_topology, | ||
task_arena)); | ||
} | ||
void execute(task& task_) { | ||
auto task_daal_ = task_daal(task_); | ||
daal_thread_pinner->execute(task_daal_); | ||
} | ||
|
||
private: | ||
std::shared_ptr<daal::services::internal::thread_pinner_t> daal_thread_pinner; | ||
}; | ||
|
||
tbb::task_arena* task_executor::create_task_arena( | ||
const oneapi::dal::detail::threading_policy& policy) { | ||
if (policy.max_threads_per_core) { | ||
static tbb::task_arena task_arena{ tbb::task_arena::constraints{}.set_max_threads_per_core( | ||
policy.max_threads_per_core) }; | ||
if (policy.thread_pinning) { | ||
using daal::services::internal::thread_pinner_t; | ||
thread_pinner_t* thread_pinner_ptr = | ||
daal::services::internal::getThreadPinnerFromTaskArena(true, | ||
read_topology, | ||
delete_topology, | ||
task_arena); | ||
return thread_pinner_ptr->get_task_arena(); | ||
} | ||
return &task_arena; | ||
} | ||
else { | ||
static tbb::task_arena task_arena{}; | ||
if (policy.thread_pinning) { | ||
using daal::services::internal::thread_pinner_t; | ||
thread_pinner_t* thread_pinner_ptr = | ||
daal::services::internal::getThreadPinnerFromTaskArena(true, | ||
read_topology, | ||
delete_topology, | ||
task_arena); | ||
return thread_pinner_ptr->get_task_arena(); | ||
} | ||
return &task_arena; | ||
} | ||
} | ||
|
||
} // namespace oneapi::dal::backend |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.