Merge branch 'dev' into gemma.cpp-windows-build-fix

This commit is contained in:
Hitesh K V 2025-10-22 16:53:48 +05:30 committed by GitHub
commit 027288b5e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 4 deletions

View File

@ -159,7 +159,6 @@ class IntCodec {
const hn::Rebind<int32_t, decltype(df)> di32; const hn::Rebind<int32_t, decltype(df)> di32;
const hn::Rebind<int16_t, decltype(di32)> di16; const hn::Rebind<int16_t, decltype(di32)> di16;
const hn::Rebind<int8_t, decltype(di16)> di8; const hn::Rebind<int8_t, decltype(di16)> di8;
const hn::Rebind<int8_t, decltype(df)> df8;
const size_t N = hn::Lanes(di8); const size_t N = hn::Lanes(di8);
const size_t N32 = hn::Lanes(df); const size_t N32 = hn::Lanes(df);
@ -387,7 +386,6 @@ class IntCodec {
const hn::Rebind<int32_t, decltype(df)> di32; const hn::Rebind<int32_t, decltype(df)> di32;
const hn::Rebind<int16_t, decltype(di32)> di16; const hn::Rebind<int16_t, decltype(di32)> di16;
const hn::Rebind<int8_t, decltype(di16)> di8; const hn::Rebind<int8_t, decltype(di16)> di8;
const hn::Rebind<int8_t, decltype(df)> df8;
const size_t N = hn::Lanes(di8); const size_t N = hn::Lanes(di8);
using VI8 = hn::Vec<decltype(di8)>; using VI8 = hn::Vec<decltype(di8)>;

View File

@ -156,6 +156,7 @@ CacheInfo::CacheInfo(const BoundedTopology& topology) {
Allocator::Allocator(const BoundedTopology& topology, Allocator::Allocator(const BoundedTopology& topology,
const CacheInfo& cache_info, bool enable_bind) const CacheInfo& cache_info, bool enable_bind)
: line_bytes_(cache_info.LineBytes()), : line_bytes_(cache_info.LineBytes()),
step_bytes_(cache_info.StepBytes()),
base_page_bytes_(DetectPageSize()), base_page_bytes_(DetectPageSize()),
total_mib_(DetectTotalMiB(base_page_bytes_)) { total_mib_(DetectTotalMiB(base_page_bytes_)) {
quantum_bytes_ = cache_info.StepBytes(); // may overwrite below quantum_bytes_ = cache_info.StepBytes(); // may overwrite below
@ -239,9 +240,8 @@ AlignedPtr<uint8_t[]> Allocator::AllocBytes(size_t bytes) const {
static_cast<uint8_t*>(p), static_cast<uint8_t*>(p),
DeleterFunc([bytes](void* ptr) { HWY_ASSERT(munmap(ptr, bytes) == 0); })); DeleterFunc([bytes](void* ptr) { HWY_ASSERT(munmap(ptr, bytes) == 0); }));
#elif HWY_OS_WIN #elif HWY_OS_WIN
const size_t alignment = HWY_MAX(vector_bytes_, line_bytes_);
return AlignedPtr<uint8_t[]>( return AlignedPtr<uint8_t[]>(
static_cast<uint8_t*>(_aligned_malloc(bytes, alignment)), static_cast<uint8_t*>(_aligned_malloc(bytes, step_bytes_)),
DeleterFunc([](void* ptr) { _aligned_free(ptr); })); DeleterFunc([](void* ptr) { _aligned_free(ptr); }));
#else #else
return AlignedPtr<uint8_t[]>(nullptr, DeleterFunc()); return AlignedPtr<uint8_t[]>(nullptr, DeleterFunc());

View File

@ -176,6 +176,7 @@ class Allocator {
private: private:
const size_t line_bytes_; const size_t line_bytes_;
const size_t step_bytes_;
const size_t base_page_bytes_; const size_t base_page_bytes_;
const size_t total_mib_; const size_t total_mib_;