Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6be7b6c
Lazy-initialization propagates through copies
achirkin Apr 29, 2026
21b7733
Require C++20
achirkin Apr 29, 2026
7a4d525
Merge branch 'main' into enh-predictable-resources
achirkin May 6, 2026
3afd7be
Merge branch 'main' into enh-predictable-resources
achirkin May 7, 2026
cf8c513
Merge branch 'main' into enh-predictable-resources
achirkin May 9, 2026
5054e97
Fix style
achirkin May 9, 2026
b8eae05
Merge branch 'main' into enh-predictable-resources
achirkin May 13, 2026
6fa6c54
Merge branch 'release/26.06' into enh-predictable-resources
achirkin May 15, 2026
76f7a3e
Merge branch 'release/26.06' into enh-predictable-resources
achirkin May 19, 2026
5c8c795
Merge branch 'main' into enh-predictable-resources
achirkin May 21, 2026
f306a4b
Merge branch 'main' into enh-predictable-resources
achirkin May 21, 2026
160d1c0
Merge branch 'main' into enh-predictable-resources
achirkin Jun 9, 2026
d782fc7
Merge branch 'main' into enh-predictable-resources
achirkin Jun 10, 2026
3157fd3
Merge branch 'main' into enh-predictable-resources
achirkin Jun 15, 2026
764f3c9
Merge remote-tracking branch 'rapidsai/main' into enh-predictable-res…
achirkin Jun 17, 2026
f8865fd
Follow up on merge commit
achirkin Jun 17, 2026
7c80d20
Follow up on merge commit
achirkin Jun 17, 2026
473bdc7
Merge branch 'main' into enh-predictable-resources
achirkin Jun 23, 2026
e942195
Merge branch 'main' into enh-predictable-resources
cjnolet Jul 1, 2026
34c4bfa
fix(clang): reconcile clang-format and verify-copyright
gforsyth Jul 1, 2026
3733629
Simplify nccl_comm_resource and avoid potential concurrent initializa…
achirkin Jul 3, 2026
adfd68c
revert/bring back res.has_resource_factory check in resource getters …
achirkin Jul 3, 2026
2b84498
Add rtype check in ensure_default_factory
achirkin Jul 3, 2026
700e4c9
revert/bring back res.has_resource_factory check in resource getters …
achirkin Jul 3, 2026
c98033b
revert/bring back res.has_resource_factory check in resource getters …
achirkin Jul 3, 2026
2602111
revert/bring back res.has_resource_factory check in resource getters …
achirkin Jul 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CommentPragmas: '^ ?[*]? ?(IWYU pragma:|SPDX-)'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# Kept the below 2 to be the same as `IndentWidth` to keep everything uniform
Expand Down
4 changes: 2 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# =============================================================================
# cmake-format: off
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# cmake-format: on
cmake_minimum_required(VERSION 4.0 FATAL_ERROR)
Expand Down Expand Up @@ -191,7 +191,7 @@ target_include_directories(
# Keep RAFT as lightweight as possible. Only CUDA libs and rmm should be used in global target.
target_link_libraries(raft INTERFACE rapids_logger::rapids_logger rmm::rmm CCCL::CCCL)

target_compile_features(raft INTERFACE cxx_std_17 $<BUILD_INTERFACE:cuda_std_17>)
target_compile_features(raft INTERFACE cxx_std_20 $<BUILD_INTERFACE:cuda_std_20>)
target_compile_options(
raft INTERFACE $<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:--expt-extended-lambda
--expt-relaxed-constexpr>
Expand Down
11 changes: 5 additions & 6 deletions cpp/include/raft/core/device_resources.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -37,10 +37,8 @@
#include <cusparse.h>

#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

Expand All @@ -60,9 +58,10 @@ class device_resources : public resources {
resource::set_workspace_resource(*this, std::move(workspace_resource), allocation_limit);
}

device_resources(const device_resources& handle) : resources{handle} {}
device_resources(device_resources&&) = delete;
device_resources& operator=(device_resources&&) = delete;
device_resources(const device_resources&) = default;
device_resources(device_resources&&) = default;
device_resources& operator=(const device_resources&) = default;
device_resources& operator=(device_resources&&) = default;

/**
* @brief Construct a resources instance with a stream view and stream pool
Expand Down
10 changes: 5 additions & 5 deletions cpp/include/raft/core/handle.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -27,10 +27,10 @@ class handle_t : public raft::device_resources {
{
}

handle_t(const handle_t& handle) : device_resources{handle} {}

handle_t(handle_t&&) = delete;
handle_t& operator=(handle_t&&) = delete;
handle_t(const handle_t&) = default;
handle_t(handle_t&&) = default;
handle_t& operator=(const handle_t&) = default;
handle_t& operator=(handle_t&&) = default;

/**
* @brief Construct a resources instance with a stream view and stream pool
Expand Down
15 changes: 7 additions & 8 deletions cpp/include/raft/core/memory_stats_resources.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -141,7 +141,7 @@ class memory_stats_resources : public resources {
};
}

std::vector<pair_resource> snapshot_;
std::vector<std::shared_ptr<resource::resource_cell>> snapshot_;

raft::mr::host_resource old_host_;
raft::mr::device_resource old_device_;
Expand Down Expand Up @@ -182,7 +182,7 @@ class memory_stats_resources : public resources {
auto pinned_ref = resource::get_pinned_memory_resource_ref(*this);
auto managed_ref = resource::get_managed_memory_resource_ref(*this);

snapshot_ = resources_;
snapshot_ = cells_;

// --- Host (global) ---
{
Expand All @@ -207,11 +207,10 @@ class memory_stats_resources : public resources {

// --- Device (global) ---
// Invalidate the cached thrust policy (the resource_ref it captured
// will be stale once we replace the global device resource).
factories_.at(resource::resource_type::THRUST_POLICY) = std::make_pair(
resource::resource_type::LAST_KEY, std::make_shared<resource::empty_resource_factory>());
resources_.at(resource::resource_type::THRUST_POLICY) = std::make_pair(
resource::resource_type::LAST_KEY, std::make_shared<resource::empty_resource>());
// will be stale once we replace the global device resource). Swapping in a
// fresh cell drops the cached factory/resource locally while snapshot_ keeps
// the originals alive, so it gets lazily rebuilt against the new device MR.
cells_[resource::resource_type::THRUST_POLICY] = std::make_shared<resource::resource_cell>();
{
device_stats_adaptor_t sa{rmm::device_async_resource_ref{old_device_}};
device_stats_ = sa.get_stats();
Expand Down
15 changes: 7 additions & 8 deletions cpp/include/raft/core/memory_tracking_resources.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -137,7 +137,7 @@ class memory_tracking_resources : public resources {
// snapshot_ is destroyed last (keeps original resource shared_ptrs alive).
// owned_stream_ outlives report_ (report_ writes to it).
// report_ is destroyed first of the three (stops background thread).
std::vector<pair_resource> snapshot_;
std::vector<std::shared_ptr<resource::resource_cell>> snapshot_;
std::unique_ptr<std::ofstream> owned_stream_;
raft::mr::resource_monitor report_;

Expand Down Expand Up @@ -177,7 +177,7 @@ class memory_tracking_resources : public resources {
auto managed_ref = raft::resource::get_managed_memory_resource_ref(*this);

// Keeps original resource objects alive while tracking refs point into them.
snapshot_ = resources_;
snapshot_ = cells_;

// --- Host (global) ---
{
Expand Down Expand Up @@ -209,11 +209,10 @@ class memory_tracking_resources : public resources {

// --- Device (global) ---
// Invalidate the cached thrust policy (the resource_ref it captured
// will be stale once we replace the global device resource).
factories_.at(resource::resource_type::THRUST_POLICY) = std::make_pair(
resource::resource_type::LAST_KEY, std::make_shared<resource::empty_resource_factory>());
resources_.at(resource::resource_type::THRUST_POLICY) = std::make_pair(
resource::resource_type::LAST_KEY, std::make_shared<resource::empty_resource>());
// will be stale once we replace the global device resource). Swapping in a
// fresh cell drops the cached factory/resource locally while snapshot_ keeps
// the originals alive, so it gets lazily rebuilt against the new device MR.
cells_[resource::resource_type::THRUST_POLICY] = std::make_shared<resource::resource_cell>();
{
device_stats_t sa{rmm::device_async_resource_ref{old_device_}};
report_.register_source("device", sa.get_stats());
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/core/resource/comms.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -58,7 +58,7 @@ inline comms::comms_t const& get_comms(resources const& res)
return *(*res.get_resource<std::shared_ptr<comms::comms_t>>(resource_type::COMMUNICATOR));
}

inline void set_comms(resources const& res, std::shared_ptr<comms::comms_t> communicator)
inline void set_comms(resources& res, std::shared_ptr<comms::comms_t> communicator)
Comment thread
achirkin marked this conversation as resolved.
{
res.add_resource_factory(std::make_shared<comms_resource_factory>(communicator));
}
Expand Down
5 changes: 2 additions & 3 deletions cpp/include/raft/core/resource/cublas_handle.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -60,8 +60,7 @@ class cublas_resource_factory : public resource_factory {
inline cublasHandle_t get_cublas_handle(resources const& res)
{
if (!res.has_resource_factory(resource_type::CUBLAS_HANDLE)) {
cudaStream_t stream = get_cuda_stream(res);
res.add_resource_factory(std::make_shared<cublas_resource_factory>(stream));
res.ensure_default_factory(std::make_shared<cublas_resource_factory>(get_cuda_stream(res)));
}
auto ret = *res.get_resource<cublasHandle_t>(resource_type::CUBLAS_HANDLE);
RAFT_CUBLAS_TRY(cublasSetStream(ret, get_cuda_stream(res)));
Expand Down
7 changes: 3 additions & 4 deletions cpp/include/raft/core/resource/cublaslt_handle.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -47,10 +47,9 @@ class cublaslt_resource_factory : public resource_factory {
inline auto get_cublaslt_handle(resources const& res) -> cublasLtHandle_t
{
if (!res.has_resource_factory(resource_type::CUBLASLT_HANDLE)) {
res.add_resource_factory(std::make_shared<cublaslt_resource_factory>());
res.ensure_default_factory(std::make_shared<cublaslt_resource_factory>());
}
auto ret = *res.get_resource<cublasLtHandle_t>(resource_type::CUBLASLT_HANDLE);
return ret;
return *res.get_resource<cublasLtHandle_t>(resource_type::CUBLASLT_HANDLE);
};

/**
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/raft/core/resource/cuda_stream.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -60,7 +60,7 @@ class cuda_stream_resource_factory : public resource_factory {
inline rmm::cuda_stream_view get_cuda_stream(resources const& res)
{
if (!res.has_resource_factory(resource_type::CUDA_STREAM_VIEW)) {
res.add_resource_factory(std::make_shared<cuda_stream_resource_factory>());
res.ensure_default_factory(std::make_shared<cuda_stream_resource_factory>());
}
return *res.get_resource<rmm::cuda_stream_view>(resource_type::CUDA_STREAM_VIEW);
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Expand All @@ -71,7 +71,7 @@ inline rmm::cuda_stream_view get_cuda_stream(resources const& res)
* @param[in] res raft resources object for managing resources
* @param[in] stream_view cuda stream view
*/
inline void set_cuda_stream(resources const& res, rmm::cuda_stream_view stream_view)
inline void set_cuda_stream(resources& res, rmm::cuda_stream_view stream_view)
{
res.add_resource_factory(std::make_shared<cuda_stream_resource_factory>(stream_view));
};
Expand Down
9 changes: 4 additions & 5 deletions cpp/include/raft/core/resource/cuda_stream_pool.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -70,7 +70,7 @@ inline bool is_stream_pool_initialized(const resources& res)
inline const rmm::cuda_stream_pool& get_cuda_stream_pool(const resources& res)
{
if (!res.has_resource_factory(resource_type::CUDA_STREAM_POOL)) {
res.add_resource_factory(std::make_shared<cuda_stream_pool_resource_factory>());
res.ensure_default_factory(std::make_shared<cuda_stream_pool_resource_factory>());
}
return *(
*res.get_resource<std::shared_ptr<rmm::cuda_stream_pool>>(resource_type::CUDA_STREAM_POOL));
Expand All @@ -82,8 +82,7 @@ inline const rmm::cuda_stream_pool& get_cuda_stream_pool(const resources& res)
* @param res
* @param stream_pool
*/
inline void set_cuda_stream_pool(const resources& res,
std::shared_ptr<rmm::cuda_stream_pool> stream_pool)
inline void set_cuda_stream_pool(resources& res, std::shared_ptr<rmm::cuda_stream_pool> stream_pool)
{
res.add_resource_factory(std::make_shared<cuda_stream_pool_resource_factory>(stream_pool));
};
Expand Down Expand Up @@ -166,7 +165,7 @@ inline void sync_stream_pool(const resources& res, const std::vector<std::size_t
inline void wait_stream_pool_on_stream(const resources& res)
{
if (!res.has_resource_factory(resource_type::CUDA_STREAM_POOL)) {
res.add_resource_factory(std::make_shared<cuda_stream_pool_resource_factory>());
res.ensure_default_factory(std::make_shared<cuda_stream_pool_resource_factory>());
}

cudaEvent_t event = detail::get_cuda_stream_sync_event(res);
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/raft/core/resource/cusolver_dn_handle.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -66,8 +66,8 @@ class cusolver_dn_resource_factory : public resource_factory {
inline cusolverDnHandle_t get_cusolver_dn_handle(resources const& res)
{
if (!res.has_resource_factory(resource_type::CUSOLVER_DN_HANDLE)) {
cudaStream_t stream = get_cuda_stream(res);
res.add_resource_factory(std::make_shared<cusolver_dn_resource_factory>(stream));
res.ensure_default_factory(
std::make_shared<cusolver_dn_resource_factory>(get_cuda_stream(res)));
}
return *res.get_resource<cusolverDnHandle_t>(resource_type::CUSOLVER_DN_HANDLE);
};
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/raft/core/resource/cusolver_sp_handle.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -63,8 +63,8 @@ class cusolver_sp_resource_factory : public resource_factory {
inline cusolverSpHandle_t get_cusolver_sp_handle(resources const& res)
{
if (!res.has_resource_factory(resource_type::CUSOLVER_SP_HANDLE)) {
cudaStream_t stream = get_cuda_stream(res);
res.add_resource_factory(std::make_shared<cusolver_sp_resource_factory>(stream));
res.ensure_default_factory(
std::make_shared<cusolver_sp_resource_factory>(get_cuda_stream(res)));
}
return *res.get_resource<cusolverSpHandle_t>(resource_type::CUSOLVER_SP_HANDLE);
};
Expand Down
5 changes: 2 additions & 3 deletions cpp/include/raft/core/resource/cusparse_handle.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -58,8 +58,7 @@ class cusparse_resource_factory : public resource_factory {
inline cusparseHandle_t get_cusparse_handle(resources const& res)
{
if (!res.has_resource_factory(resource_type::CUSPARSE_HANDLE)) {
rmm::cuda_stream_view stream = get_cuda_stream(res);
res.add_resource_factory(std::make_shared<cusparse_resource_factory>(stream));
res.ensure_default_factory(std::make_shared<cusparse_resource_factory>(get_cuda_stream(res)));
}
return *res.get_resource<cusparseHandle_t>(resource_type::CUSPARSE_HANDLE);
};
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/core/resource/custom_resource.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -72,7 +72,7 @@ auto get_custom_resource(resources const& res) -> ResourceT*
{
static_assert(std::is_default_constructible_v<ResourceT>);
if (!res.has_resource_factory(resource_type::CUSTOM)) {
res.add_resource_factory(std::make_shared<custom_resource_factory>());
res.ensure_default_factory(std::make_shared<custom_resource_factory>());
}
return res.get_resource<custom_resource>(resource_type::CUSTOM)->load<ResourceT>();
};
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/core/resource/detail/stream_sync_event.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -34,7 +34,7 @@ class cuda_stream_sync_event_resource_factory : public resource_factory {
inline cudaEvent_t& get_cuda_stream_sync_event(resources const& res)
{
if (!res.has_resource_factory(resource_type::CUDA_STREAM_SYNC_EVENT)) {
res.add_resource_factory(std::make_shared<cuda_stream_sync_event_resource_factory>());
res.ensure_default_factory(std::make_shared<cuda_stream_sync_event_resource_factory>());
}
return *res.get_resource<cudaEvent_t>(resource_type::CUDA_STREAM_SYNC_EVENT);
};
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/core/resource/device_id.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -56,7 +56,7 @@ class device_id_resource_factory : public resource_factory {
inline int get_device_id(resources const& res)
{
if (!res.has_resource_factory(resource_type::DEVICE_ID)) {
res.add_resource_factory(std::make_shared<device_id_resource_factory>());
res.ensure_default_factory(std::make_shared<device_id_resource_factory>());
}
return *res.get_resource<int>(resource_type::DEVICE_ID);
};
Expand Down
Loading
Loading