Skip to content

Commit d58afae

Browse files
birukwcopybara-github
authored andcommitted
Miscellaneous cleanup.
* Updates NUMA binding guard in allocator.cc to match the include guard. * Initializes vectors in flash_attention.cc. * Excludes SCALAR for HWY_RISCV in compression/types.h. PiperOrigin-RevId: 922218487
1 parent 53bcd7a commit d58afae

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

compression/types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ namespace gcpp {
5353
(HWY_SCALAR | HWY_SSE2 | HWY_SSSE3 | HWY_SSE4 | HWY_AVX10_2)
5454
#elif HWY_ARCH_WASM
5555
#define GEMMA_DISABLED_TARGETS HWY_SCALAR
56+
#elif HWY_ARCH_RISCV
57+
#define GEMMA_DISABLED_TARGETS HWY_SCALAR
5658
#endif // HWY_ARCH_*
5759

5860
#endif // GEMMA_DISABLED_TARGETS

gemma/flash_attention.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ static HWY_INLINE void FlashAttentionTileStepAndApplySoftCap4(
571571
using VF4 = hn::Vec<DF4>;
572572
static_assert(kNumQueries >= 1 && kNumQueries <= 4);
573573
VF4 new_max = hn::Set(df4, kNegInf);
574-
VF max_0, max_1, max_2, max_3 = hn::Zero(df);
574+
VF max_0 = hn::Zero(df), max_1 = hn::Zero(df), max_2 = hn::Zero(df),
575+
max_3 = hn::Zero(df);
575576
max_0 = hn::Max(x_0_p0, x_0_p1);
576577
if constexpr (kNumQueries >= 2) {
577578
max_1 = hn::Max(x_1_p0, x_1_p1);

io/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ FILE_DEPS = select({
2929
# Placeholder for io deps, do not remove
3030
],
3131
":android": [],
32-
# Placeholder for internal build rules, do not remove
32+
# Placeholder 1 for internal build rules, do not remove
33+
# Placeholder 2 for internal build rules, do not remove
3334
})
3435

3536
cc_library(

util/allocator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ AlignedPtr<uint8_t[]> Allocator::AllocBytes(size_t bytes) const {
236236

237237
// Binding, or large vector/cache line size: use platform-specific allocator.
238238

239-
#if HWY_OS_LINUX && !defined(__ANDROID_API__)
239+
#if GEMMA_BIND && HWY_OS_LINUX && !defined(__ANDROID_API__)
240240
// `move_pages` is documented to require an anonymous/private mapping or
241241
// `MAP_SHARED`. A normal allocation might not suffice, so we use `mmap`.
242242
// `Init` verified that the page size is a multiple of `QuantumBytes()`.

0 commit comments

Comments
 (0)