From acc21a670582d791c6790e1f995029f57a930784 Mon Sep 17 00:00:00 2001 From: Jan Wassenberg Date: Thu, 28 Oct 2021 03:49:01 -0700 Subject: [PATCH] cleanup: rename descriptor in documentation to tag. PiperOrigin-RevId: 406102290 --- g3doc/design_philosophy.md | 10 +++++----- g3doc/quick_reference.md | 2 +- hwy/base.h | 4 ++-- hwy/highway.h | 4 +++- hwy/ops/shared-inl.h | 18 +++++++++--------- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/g3doc/design_philosophy.md b/g3doc/design_philosophy.md index f0d48b659c..10fff8e9a8 100644 --- a/g3doc/design_philosophy.md +++ b/g3doc/design_philosophy.md @@ -91,12 +91,12 @@ runtime dispatch. ## Overloaded function API -Most C++ vector APIs rely on class templates. However, the ARM SVE vector -type is sizeless and cannot be wrapped in a class. We instead rely on overloaded +Most C++ vector APIs rely on class templates. However, the ARM SVE vector type +is sizeless and cannot be wrapped in a class. We instead rely on overloaded functions. Overloading based on vector types is also undesirable because SVE -vectors cannot be default-constructed. We instead use a dedicated 'descriptor' -type `Simd` for overloading, abbreviated to `D` for template arguments and -`d` in lvalues. +vectors cannot be default-constructed. We instead use a dedicated tag type +`Simd` for overloading, abbreviated to `D` for template arguments and `d` in +lvalues. Note that generic function templates are possible (see generic_ops-inl.h). diff --git a/g3doc/quick_reference.md b/g3doc/quick_reference.md index 03f7464713..4b59328ec1 100644 --- a/g3doc/quick_reference.md +++ b/g3doc/quick_reference.md @@ -64,7 +64,7 @@ HWY_AFTER_NAMESPACE(); * `d` is an lvalue of type `D`, passed as a function argument e.g. to Zero; * `V` is the type of a vector. -## Vector and descriptor types +## Vector and tag types Highway vectors consist of one or more 'lanes' of the same built-in type `uint##_t, int##_t` for `## = 8, 16, 32, 64`, plus `float##_t` for `## = 16, 32, diff --git a/hwy/base.h b/hwy/base.h index d48b2cf63a..5b64d0f4f9 100644 --- a/hwy/base.h +++ b/hwy/base.h @@ -282,8 +282,8 @@ HWY_API constexpr bool IsSame() { // vectors of AT MOST this many bits. // // Note that enabling for exactly 128 bits is unnecessary because a function can -// simply be overloaded with Vec128 and Full128 descriptor. Enabling for -// other sizes (e.g. 64 bit) can be achieved with Simd. +// simply be overloaded with Vec128 and/or Full128 tag. Enabling for other +// sizes (e.g. 64 bit) can be achieved via Simd. #define HWY_IF_LE128(T, N) hwy::EnableIf* = nullptr #define HWY_IF_LE64(T, N) hwy::EnableIf* = nullptr #define HWY_IF_LE32(T, N) hwy::EnableIf* = nullptr diff --git a/hwy/highway.h b/hwy/highway.h index ed2c246f1b..77574f71bf 100644 --- a/hwy/highway.h +++ b/hwy/highway.h @@ -31,7 +31,9 @@ namespace hwy { #define HWY_PATCH 2 //------------------------------------------------------------------------------ -// Shorthand for descriptors (defined in shared-inl.h) used to select overloads. +// Shorthand for tags (defined in shared-inl.h) used to select overloads. +// Note that ScalableTag is preferred over HWY_FULL, and CappedTag over +// HWY_CAPPED(T, N). // HWY_FULL(T[,LMUL=1]) is a native vector/group. LMUL is the number of // registers in the group, and is ignored on targets that do not support groups. diff --git a/hwy/ops/shared-inl.h b/hwy/ops/shared-inl.h index 71999e7bf8..4a4ed1e297 100644 --- a/hwy/ops/shared-inl.h +++ b/hwy/ops/shared-inl.h @@ -26,11 +26,11 @@ HWY_BEFORE_NAMESPACE(); namespace hwy { namespace HWY_NAMESPACE { -// SIMD operations are implemented as overloaded functions selected using a -// "descriptor" D := Simd. T is the lane type, N an opaque integer for -// internal use only. Users create D via aliases ScalableTag() (a full -// vector), CappedTag or FixedTag. The actual number of -// lanes (always a power of two) is Lanes(D()). +// SIMD operations are implemented as overloaded functions selected using a tag +// type D := Simd. T is the lane type, N an opaque integer for internal +// use only. Users create D via aliases ScalableTag() (a full vector), +// CappedTag or FixedTag. The actual number of lanes +// (always a power of two) is Lanes(D()). template struct Simd { constexpr Simd() = default; @@ -38,7 +38,7 @@ struct Simd { static_assert((N & (N - 1)) == 0 && N != 0, "N must be a power of two"); // Widening/narrowing ops change the number of lanes and/or their type. - // To initialize such vectors, we need the corresponding descriptor types: + // To initialize such vectors, we need the corresponding tag types: // PromoteTo/DemoteTo() with another lane type, but same number of lanes. template @@ -139,7 +139,7 @@ using FixedTag = typename detail::FixedTagChecker::type; template using TFromD = typename D::T; -// Descriptor for the same number of lanes as D, but with the LaneType T. +// Tag for the same number of lanes as D, but with the LaneType T. template using Rebind = typename D::template Rebind; @@ -150,7 +150,7 @@ using RebindToUnsigned = Rebind>, D>; template using RebindToFloat = Rebind>, D>; -// Descriptor for the same total size as D, but with the LaneType T. +// Tag for the same total size as D, but with the LaneType T. template using Repartition = typename D::template Repartition; @@ -159,7 +159,7 @@ using RepartitionToWide = Repartition>, D>; template using RepartitionToNarrow = Repartition>, D>; -// Descriptor for the same lane type as D, but half the lanes. +// Tag for the same lane type as D, but half the lanes. template using Half = typename D::Half;