Fix include order, required to build with profiler enabled

PiperOrigin-RevId: 680574177
This commit is contained in:
Jan Wassenberg 2024-09-30 07:52:17 -07:00 committed by Copybara-Service
parent 5e812f07f5
commit 897f902d28
4 changed files with 10 additions and 6 deletions

View File

@ -24,8 +24,10 @@
// Compiles this file for multiple architectures via "foreach_target.h", to // Compiles this file for multiple architectures via "foreach_target.h", to
// which we pass the filename via macro 'argument'. // which we pass the filename via macro 'argument'.
// clang-format off
#undef HWY_TARGET_INCLUDE #undef HWY_TARGET_INCLUDE
#define HWY_TARGET_INCLUDE "backprop/backward.cc" // NOLINT #define HWY_TARGET_INCLUDE "backprop/backward.cc" // NOLINT
// clang-format on
#include "hwy/foreach_target.h" // IWYU pragma: keep #include "hwy/foreach_target.h" // IWYU pragma: keep
#include "hwy/highway.h" #include "hwy/highway.h"

View File

@ -15,13 +15,15 @@
#include "gemma/weights.h" #include "gemma/weights.h"
#include <cstdio> #include <stdio.h>
#include <cstdlib> #include <cstdlib>
#include "compression/compress.h" #include "compression/compress.h"
#include "compression/io.h" // Path #include "compression/io.h" // Path
#include "gemma/common.h" #include "gemma/common.h"
#include "gemma/configs.h" #include "gemma/configs.h"
#include "util/allocator.h"
#include "hwy/base.h" // HWY_ABORT #include "hwy/base.h" // HWY_ABORT
#include "hwy/contrib/thread_pool/thread_pool.h" #include "hwy/contrib/thread_pool/thread_pool.h"
#include "hwy/profiler.h" #include "hwy/profiler.h"
@ -72,7 +74,10 @@ struct LoadCompressedWeightsT {
} }
HWY_ASSERT(scale_pos == TConfig::kNumTensorScales); HWY_ASSERT(scale_pos == TConfig::kNumTensorScales);
} }
c_weights->Reshape(); {
PROFILER_ZONE("Startup.Reshape");
c_weights->Reshape();
}
return c_weights_u8; return c_weights_u8;
} }
}; };

View File

@ -25,7 +25,6 @@
#include "hwy/aligned_allocator.h" #include "hwy/aligned_allocator.h"
#include "hwy/base.h" #include "hwy/base.h"
#include "hwy/contrib/thread_pool/thread_pool.h" #include "hwy/contrib/thread_pool/thread_pool.h"
#include "hwy/profiler.h"
namespace gcpp { namespace gcpp {
@ -122,8 +121,6 @@ struct CompressedLayer {
// after loading weights via ForEachTensor. // after loading weights via ForEachTensor.
// TODO: update compression/convert_weights to bake this in. // TODO: update compression/convert_weights to bake this in.
void Reshape() { void Reshape() {
PROFILER_ZONE("Startup.Reshape");
constexpr size_t kModelDim = TConfig::kModelDim; constexpr size_t kModelDim = TConfig::kModelDim;
constexpr size_t kHeads = TConfig::kHeads; constexpr size_t kHeads = TConfig::kHeads;
constexpr size_t kQKVDim = TConfig::kQKVDim; constexpr size_t kQKVDim = TConfig::kQKVDim;

View File

@ -23,7 +23,6 @@
#include "hwy/base.h" #include "hwy/base.h"
#include "hwy/contrib/thread_pool/thread_pool.h" #include "hwy/contrib/thread_pool/thread_pool.h"
#include "hwy/profiler.h"
#endif // THIRD_PARTY_GEMMA_CPP_OPS_MATVEC_INL_H_ #endif // THIRD_PARTY_GEMMA_CPP_OPS_MATVEC_INL_H_
@ -39,6 +38,7 @@
#include "ops/dot-inl.h" #include "ops/dot-inl.h"
#include "hwy/contrib/math/math-inl.h" #include "hwy/contrib/math/math-inl.h"
#include "hwy/contrib/matvec/matvec-inl.h" #include "hwy/contrib/matvec/matvec-inl.h"
#include "hwy/profiler.h" // also uses SIMD
HWY_BEFORE_NAMESPACE(); HWY_BEFORE_NAMESPACE();
namespace gcpp { namespace gcpp {