/*
 * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */

#pragma once

#include <execution>
#include <type_traits>

namespace nv {
namespace execution {
template <typename _ExecutionPolicy>
struct no_sync_policy
{
    _ExecutionPolicy __exec_;

  public:
    no_sync_policy(_ExecutionPolicy&& __exec): __exec_(__exec) {}
    no_sync_policy(_ExecutionPolicy const& __exec): __exec_(__exec) {}

    operator _ExecutionPolicy() { return __exec_; }
};
}
}

namespace std {
inline namespace __p1673_version_0 {
namespace linalg {
namespace impl {
template<> inline constexpr bool is_custom_linalg_execution_policy_v<nv::execution::no_sync_policy<std::execution::parallel_policy>> = true;
}
}
}
}

namespace nv {
namespace execution {
template <typename _ExecutionPolicy>
auto no_sync(_ExecutionPolicy&& __exec)
{
    using __Striped = std::remove_cv_t<std::remove_reference_t<_ExecutionPolicy>>;
    return no_sync_policy<__Striped>((_ExecutionPolicy&&)__exec);
}
}
}
