Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
Loading...
Searching...
No Matches
Profile.h File Reference

Per-LAYER, phase-level timing accumulator. More...

#include <chrono>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <utility>

Go to the source code of this file.

Classes

struct  Deep::ProfileAccumulator
 One layer's accumulated time-per-phase, in seconds – see the file-level note for the reconciliation invariants (PhaseSum() vs. the top-level totals vs. external wall-clock). More...
struct  Deep::ProfileEntry
 One registered layer's profiling data: its print label paired with its accumulator. More...
class  Deep::ScopedTimer
 No-op stand-in for the PCN_PROFILE build of ScopedTimer above, so PCN_TIME() call sites compile identically either way. More...

Namespaces

namespace  Deep
 This file exists to provide both Tensor.h and IComputeBackend.h with device types without introducing circular dependencies.

Macros

#define PCN_TIME(accumulator)
 No-op unless PCN_PROFILE is defined – see the PCN_PROFILE branch above.

Functions

std::vector< std::pair< const void *, ProfileEntry > > & Deep::ProfileRegistry ()
 The process-wide table of every layer that's had LayerProfile() called on it at least once, in first-call order.
template<typename LayerT>
ProfileAccumulator & Deep::LayerProfile (LayerT *layer)
 Looks up (or creates, on first call) layer's accumulator in the process-wide registry, keyed by its address.
void Deep::PrintAllProfiles (double wallClockSeconds)
 Prints every registered layer's profile, then a grand-total reconciliation against an independently measured wall-clock time.

Detailed Description

Per-LAYER, phase-level timing accumulator.

Changes from the first draft, per review:

  1. Accumulators are now PER LAYER (keyed by layer pointer), not one global blob – so "feedback GEMM" for the 784->512 layer is reported separately from the 512->10 layer, per review point 4.
  2. Added calculateStateTotal/updateStateTotal top-level timers, so you can see e.g. "UpdateState 78%" before drilling into its sub-phases.
  3. Print() no longer claims to BE wall-clock time – PrintAllProfiles() takes an explicit externally-measured wall-clock duration and prints it alongside the phase sum as a reconciliation check, per review point 2. If they don't roughly match, that's itself a finding.
  4. "ownGradientTerm" renamed to "localErrorTerm" (it's dz_dt = -p*e, not a conventional backprop gradient – review point 5).

Still gated behind PCN_PROFILE; a no-op in normal builds.

Macro Definition Documentation

◆ PCN_TIME

#define PCN_TIME ( accumulator)
Value:
do {} while (0)

No-op unless PCN_PROFILE is defined – see the PCN_PROFILE branch above.