3838#include < svs/orchestrators/dynamic_vamana.h>
3939#include < svs/quantization/scalar/scalar.h>
4040
41- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
41+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
4242#ifndef SVS_LVQ_HEADER
4343#define SVS_LVQ_HEADER " svs/quantization/lvq/lvq.h"
4444#endif
@@ -94,7 +94,7 @@ inline auto runtime_error_wrapper(Callable&& func) noexcept -> Status {
9494 }
9595}
9696
97- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
97+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
9898using LeanVecMatricesType = svs::leanvec::LeanVecMatrices<svs::Dynamic>;
9999#endif
100100
@@ -109,7 +109,7 @@ inline constexpr bool is_simple_dataset<svs::data::SimpleData<Elem, Extent, Allo
109109template <typename T>
110110concept IsSimpleDataset = is_simple_dataset<T>;
111111
112- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
112+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
113113// Consolidated storage kind checks using constexpr functions
114114inline constexpr bool is_lvq_storage (StorageKind kind) {
115115 return kind == StorageKind::LVQ4x0 || kind == StorageKind::LVQ4x4 ||
@@ -135,7 +135,7 @@ template <StorageKind K> struct StorageKindTag {
135135SVS_DEFINE_STORAGE_KIND_TAG (FP32);
136136SVS_DEFINE_STORAGE_KIND_TAG (FP16);
137137SVS_DEFINE_STORAGE_KIND_TAG (SQI8);
138- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
138+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
139139SVS_DEFINE_STORAGE_KIND_TAG (LVQ4x0);
140140SVS_DEFINE_STORAGE_KIND_TAG (LVQ4x4);
141141SVS_DEFINE_STORAGE_KIND_TAG (LVQ4x8);
@@ -161,7 +161,7 @@ template <typename T>
161161using SQDatasetType = svs::quantization::scalar::
162162 SQDataset<T, svs::Dynamic, svs::data::Blocked<svs::lib::Allocator<T>>>;
163163
164- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
164+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
165165template <size_t Primary, size_t Residual>
166166using LVQDatasetType = svs::quantization::lvq::LVQDataset<
167167 Primary,
@@ -191,7 +191,7 @@ template <StorageTag Tag> using StorageType_t = typename StorageType<Tag>::type;
191191DEFINE_STORAGE_TYPE (FP32, SimpleDatasetType<float >);
192192DEFINE_STORAGE_TYPE (FP16, SimpleDatasetType<svs::Float16>);
193193DEFINE_STORAGE_TYPE (SQI8, SQDatasetType<std::int8_t >);
194- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
194+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
195195DEFINE_STORAGE_TYPE (LVQ4x0, LVQDatasetType<4 , 0 >);
196196DEFINE_STORAGE_TYPE (LVQ4x4, LVQDatasetType<4 , 4 >);
197197DEFINE_STORAGE_TYPE (LVQ4x8, LVQDatasetType<4 , 8 >);
@@ -223,7 +223,7 @@ SQStorageType make_storage(const svs::data::ConstSimpleDataView<float>& data, Po
223223 return SQStorageType::compress (data, pool);
224224}
225225
226- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
226+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
227227template <
228228 svs::quantization::lvq::IsLVQDataset LVQStorageType,
229229 svs::threads::ThreadPool Pool>
@@ -252,30 +252,30 @@ auto make_storage(Tag&& SVS_UNUSED(tag), Args&&... args) {
252252 return make_storage<StorageType_t<Tag>>(std::forward<Args>(args)...);
253253}
254254
255- inline bool is_supported_storage_kind (StorageKind SVS_UNUSED (kind)) {
256- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
255+ inline bool is_supported_storage_kind (StorageKind kind) {
257256 if (is_lvq_storage (kind) || is_leanvec_storage (kind)) {
258257 return svs::detail::lvq_leanvec_enabled ();
259258 }
260- #endif
261259 return true ;
262260}
263261
264262template <typename F, typename ... Args>
265263auto dispatch_storage_kind (StorageKind kind, F&& f, Args&&... args) {
264+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
266265 if (!is_supported_storage_kind (kind)) {
267266 throw StatusException (
268267 ErrorCode::NOT_IMPLEMENTED, " Requested storage kind is not supported by CPU"
269268 );
270269 }
270+ #endif
271271 switch (kind) {
272272 case StorageKind::FP32:
273273 return f (FP32Tag{}, std::forward<Args>(args)...);
274274 case StorageKind::FP16:
275275 return f (FP16Tag{}, std::forward<Args>(args)...);
276276 case StorageKind::SQI8:
277277 return f (SQI8Tag{}, std::forward<Args>(args)...);
278- #if SVS_RUNTIME_ENABLE_LVQ_LEANVEC
278+ #ifdef SVS_RUNTIME_ENABLE_LVQ_LEANVEC
279279 case StorageKind::LVQ4x0:
280280 return f (LVQ4x0Tag{}, std::forward<Args>(args)...);
281281 case StorageKind::LVQ4x4:
0 commit comments