DPC++ Runtime
Runtime libraries for oneAPI DPC++
kernel_arg_mask.hpp
Go to the documentation of this file.
1 //==----------- kernel_arg_mask.hpp - SYCL KernelArgMask -------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
11 #include <vector>
12 
13 namespace sycl {
14 inline namespace _V1 {
15 namespace detail {
16 using KernelArgMask = std::vector<bool>;
18  const int NBytesForSize = 8;
19  const int NBitsInElement = 8;
20  std::uint64_t SizeInBits = 0;
21 
22  KernelArgMask Result;
23  for (int I = 0; I < NBytesForSize; ++I)
24  SizeInBits |= static_cast<std::uint64_t>(Bytes[I]) << I * NBitsInElement;
25 
26  Result.reserve(SizeInBits);
27  for (std::uint64_t I = 0; I < SizeInBits; ++I) {
28  std::uint8_t Byte = Bytes[NBytesForSize + (I / NBitsInElement)];
29  Result.push_back(Byte & (1 << (I % NBitsInElement)));
30  }
31  return Result;
32 }
33 } // namespace detail
34 } // namespace _V1
35 } // namespace sycl
std::vector< bool > KernelArgMask
KernelArgMask createKernelArgMask(const ByteArray &Bytes)
Definition: access.hpp:18