Grok 10.0.5
print-inl.h
Go to the documentation of this file.
1// Copyright 2022 Google LLC
2// SPDX-License-Identifier: Apache-2.0
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16// Print() function
17
18#include <stdint.h>
19
21#include "hwy/highway.h"
22#include "hwy/print.h"
23
24// Per-target include guard
25#if defined(HIGHWAY_HWY_PRINT_INL_H_) == \
26 defined(HWY_TARGET_TOGGLE)
27#ifdef HIGHWAY_HWY_PRINT_INL_H_
28#undef HIGHWAY_HWY_PRINT_INL_H_
29#else
30#define HIGHWAY_HWY_PRINT_INL_H_
31#endif
32
34namespace hwy {
35namespace HWY_NAMESPACE {
36
37// Prints lanes around `lane`, in memory order.
38template <class D, class V = VFromD<D>>
39void Print(const D d, const char* caption, VecArg<V> v, size_t lane_u = 0,
40 size_t max_lanes = 7) {
41 const size_t N = Lanes(d);
42 using T = TFromD<D>;
43 auto lanes = AllocateAligned<T>(N);
44 Store(v, d, lanes.get());
45
46 const auto info = hwy::detail::MakeTypeInfo<T>();
47 hwy::detail::PrintArray(info, caption, lanes.get(), N, lane_u, max_lanes);
48}
49
50// NOLINTNEXTLINE(google-readability-namespace-comments)
51} // namespace HWY_NAMESPACE
52} // namespace hwy
54
55#endif // per-target include guard
d
Definition: rvv-inl.h:1998
V VecArg
Definition: ops/shared-inl.h:324
void Print(const D d, const char *caption, VecArg< V > v, size_t lane_u=0, size_t max_lanes=7)
Definition: print-inl.h:39
HWY_API constexpr size_t Lanes(Simd< T, N, kPow2 >)
Definition: arm_sve-inl.h:243
N
Definition: rvv-inl.h:1998
HWY_API void Store(Vec128< T, N > v, Simd< T, N, 0 > d, T *HWY_RESTRICT aligned)
Definition: arm_neon-inl.h:2934
const vfloat64m1_t v
Definition: rvv-inl.h:1998
typename D::T TFromD
Definition: ops/shared-inl.h:203
HWY_DLLEXPORT void PrintArray(const TypeInfo &info, const char *caption, const void *array_void, size_t N, size_t lane_u=0, size_t max_lanes=7)
Definition: aligned_allocator.h:27
HWY_AFTER_NAMESPACE()
HWY_BEFORE_NAMESPACE()
#define HWY_NAMESPACE
Definition: set_macros-inl.h:82