Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions bindings/cpp/include/svs/runtime/api_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ enum class StorageKind {
FP16,
SQI8,
LVQ4x0,
LVQ8x0,
LVQ4x4,
LVQ4x8,
LeanVec4x4,
Expand Down
21 changes: 14 additions & 7 deletions bindings/cpp/src/svs_runtime_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ namespace storage {

// Consolidated storage kind checks using constexpr functions
inline constexpr bool is_lvq_storage(StorageKind kind) {
return kind == StorageKind::LVQ4x0 || kind == StorageKind::LVQ4x4 ||
kind == StorageKind::LVQ4x8;
return kind == StorageKind::LVQ4x0 || kind == StorageKind::LVQ8x0 ||
kind == StorageKind::LVQ4x4 || kind == StorageKind::LVQ4x8;
}

inline constexpr bool is_leanvec_storage(StorageKind kind) {
Expand Down Expand Up @@ -129,6 +129,7 @@ SVS_DEFINE_STORAGE_KIND_TAG(FP32);
SVS_DEFINE_STORAGE_KIND_TAG(FP16);
SVS_DEFINE_STORAGE_KIND_TAG(SQI8);
SVS_DEFINE_STORAGE_KIND_TAG(LVQ4x0);
SVS_DEFINE_STORAGE_KIND_TAG(LVQ8x0);
SVS_DEFINE_STORAGE_KIND_TAG(LVQ4x4);
SVS_DEFINE_STORAGE_KIND_TAG(LVQ4x8);
SVS_DEFINE_STORAGE_KIND_TAG(LeanVec4x4);
Expand Down Expand Up @@ -235,18 +236,22 @@ struct StorageFactory<SQStorageType> {

// LVQ Storage support
#ifdef SVS_LVQ_HEADER
template <size_t Primary, size_t Residual>
template <size_t Primary, size_t Residual, typename Strategy>
using LVQDatasetType = svs::quantization::lvq::LVQDataset<
Primary,
Residual,
svs::Dynamic,
svs::quantization::lvq::Turbo<16, 8>,
Strategy,
svs::data::Blocked<svs::lib::Allocator<std::byte>>>;

using Sequential = svs::quantization::lvq::Sequential;
using Turbo16x8 = svs::quantization::lvq::Turbo<16, 8>;

// clang-format off
template <> struct StorageType<LVQ4x0Tag> { using type = LVQDatasetType<4, 0>; };
template <> struct StorageType<LVQ4x4Tag> { using type = LVQDatasetType<4, 4>; };
template <> struct StorageType<LVQ4x8Tag> { using type = LVQDatasetType<4, 8>; };
template <> struct StorageType<LVQ4x0Tag> { using type = LVQDatasetType<4, 0, Turbo16x8>; };
template <> struct StorageType<LVQ8x0Tag> { using type = LVQDatasetType<8, 0, Sequential>; };
template <> struct StorageType<LVQ4x4Tag> { using type = LVQDatasetType<4, 4, Turbo16x8>; };
template <> struct StorageType<LVQ4x8Tag> { using type = LVQDatasetType<4, 8, Turbo16x8>; };
// clang-format on

template <svs::quantization::lvq::IsLVQDataset LVQStorageType>
Expand Down Expand Up @@ -332,6 +337,8 @@ auto dispatch_storage_kind(StorageKind kind, F&& f, Args&&... args) {
return f(SQI8Tag{}, std::forward<Args>(args)...);
case StorageKind::LVQ4x0:
return f(LVQ4x0Tag{}, std::forward<Args>(args)...);
case StorageKind::LVQ8x0:
return f(LVQ8x0Tag{}, std::forward<Args>(args)...);
case StorageKind::LVQ4x4:
return f(LVQ4x4Tag{}, std::forward<Args>(args)...);
case StorageKind::LVQ4x8:
Expand Down
Loading