diff --git a/backprop/backward.cc b/backprop/backward.cc index 7f06fd4..da63e3a 100644 --- a/backprop/backward.cc +++ b/backprop/backward.cc @@ -24,8 +24,10 @@ // Compiles this file for multiple architectures via "foreach_target.h", to // which we pass the filename via macro 'argument'. +// clang-format off #undef HWY_TARGET_INCLUDE #define HWY_TARGET_INCLUDE "backprop/backward.cc" // NOLINT +// clang-format on #include "hwy/foreach_target.h" // IWYU pragma: keep #include "hwy/highway.h" diff --git a/gemma/weights.cc b/gemma/weights.cc index a4d800e..405f409 100644 --- a/gemma/weights.cc +++ b/gemma/weights.cc @@ -15,13 +15,15 @@ #include "gemma/weights.h" -#include +#include + #include #include "compression/compress.h" #include "compression/io.h" // Path #include "gemma/common.h" #include "gemma/configs.h" +#include "util/allocator.h" #include "hwy/base.h" // HWY_ABORT #include "hwy/contrib/thread_pool/thread_pool.h" #include "hwy/profiler.h" @@ -72,7 +74,10 @@ struct LoadCompressedWeightsT { } HWY_ASSERT(scale_pos == TConfig::kNumTensorScales); } - c_weights->Reshape(); + { + PROFILER_ZONE("Startup.Reshape"); + c_weights->Reshape(); + } return c_weights_u8; } }; diff --git a/gemma/weights.h b/gemma/weights.h index 818ae8e..42fc23b 100644 --- a/gemma/weights.h +++ b/gemma/weights.h @@ -25,7 +25,6 @@ #include "hwy/aligned_allocator.h" #include "hwy/base.h" #include "hwy/contrib/thread_pool/thread_pool.h" -#include "hwy/profiler.h" namespace gcpp { @@ -122,8 +121,6 @@ struct CompressedLayer { // after loading weights via ForEachTensor. // TODO: update compression/convert_weights to bake this in. void Reshape() { - PROFILER_ZONE("Startup.Reshape"); - constexpr size_t kModelDim = TConfig::kModelDim; constexpr size_t kHeads = TConfig::kHeads; constexpr size_t kQKVDim = TConfig::kQKVDim; diff --git a/ops/matvec-inl.h b/ops/matvec-inl.h index ffc8677..5a56413 100644 --- a/ops/matvec-inl.h +++ b/ops/matvec-inl.h @@ -23,7 +23,6 @@ #include "hwy/base.h" #include "hwy/contrib/thread_pool/thread_pool.h" -#include "hwy/profiler.h" #endif // THIRD_PARTY_GEMMA_CPP_OPS_MATVEC_INL_H_ @@ -39,6 +38,7 @@ #include "ops/dot-inl.h" #include "hwy/contrib/math/math-inl.h" #include "hwy/contrib/matvec/matvec-inl.h" +#include "hwy/profiler.h" // also uses SIMD HWY_BEFORE_NAMESPACE(); namespace gcpp {