#include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h"
#include <algorithm>
#include <array>
#include <cinttypes>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <functional>
#include <limits>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include "xnnpack.h"
#include "Eigen/Core"
#include "pthreadpool.h"
#include "tensorflow/lite/builtin_ops.h"
#include "tensorflow/lite/c/c_api_types.h"
#include "tensorflow/lite/core/api/profiler.h"
#include "tensorflow/lite/core/c/builtin_op_data.h"
#include "tensorflow/lite/core/c/common.h"
#include "tensorflow/lite/core/subgraph.h"
#include "tensorflow/lite/delegates/xnnpack/quantization_util.h"
#include "tensorflow/lite/delegates/xnnpack/weight_cache.h"
#include "tensorflow/lite/kernels/cpu_backend_context.h"
#include "tensorflow/lite/kernels/internal/compatibility.h"
#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "tensorflow/lite/kernels/internal/utils/sparsity_format_converter.h"
#include "tensorflow/lite/kernels/kernel_util.h"
#include "tensorflow/lite/kernels/padding.h"
#include "tensorflow/lite/logger.h"
#include "tensorflow/lite/minimal_logging.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/tools/optimize/reduced_precision_support.h"
struct TfLiteXNNPackDelegateWeightsCache;
namespace tflite {
namespace xnnpack {
namespace {
constexpr char kOdmlSDPA[] = …;
template <typename T>
void SafeCopyCustomData(const TfLiteNode& node, T* target) { … }
void CopyTensorDataInt32OrInt64(int64_t* dst, const TfLiteTensor& tensor,
size_t n) { … }
xnn_datatype GetXNNPackDatatype(TfLiteContext* context,
const TfLiteTensor& tensor, int t) { … }
std::vector<size_t> TfLiteDimensionsToXNNPackDimensions(
const std::vector<int>& tflite_dims) { … }
TfLiteStatus DelegatePrepare(TfLiteContext* context, TfLiteDelegate* delegate);
template <typename T>
inline void hash_combine(size_t seed, T v) { … }
struct PairHash { … };
class VariableHolder { … };
class Subgraph;
class Delegate { … };
class Subgraph { … };
TfLiteIntArray* Delegate::PrepareOpsToDelegate(TfLiteContext* context) { … }
void* SubgraphInit(TfLiteContext* context, const char* buffer, size_t length) { … }
TfLiteStatus SubgraphPrepare(TfLiteContext* context, TfLiteNode* node) { … }
TfLiteStatus SubgraphInvoke(TfLiteContext* context, TfLiteNode* node) { … }
void SubgraphFree(TfLiteContext* context, void* buffer) { … }
const TfLiteRegistration kSubgraphRegistration = …;
TfLiteStatus DelegatePrepare(TfLiteContext* context, TfLiteDelegate* delegate) { … }
}
}
}
TfLiteXNNPackDelegateWeightsCache* TfLiteXNNPackDelegateWeightsCacheCreate() { … }
TfLiteXNNPackDelegateWeightsCache*
TfLiteXNNPackDelegateWeightsCacheCreateWithSize(size_t size) { … }
bool TfLiteXNNPackDelegateWeightsCacheFinalizeSoft(
TfLiteXNNPackDelegateWeightsCache* cache) { … }
bool TfLiteXNNPackDelegateWeightsCacheFinalizeHard(
TfLiteXNNPackDelegateWeightsCache* cache) { … }
void TfLiteXNNPackDelegateWeightsCacheDelete(
TfLiteXNNPackDelegateWeightsCache* cache) { … }
TfLiteXNNPackDelegateOptions TfLiteXNNPackDelegateOptionsDefault() { … }
TfLiteDelegate* TfLiteXNNPackDelegateCreate(
const TfLiteXNNPackDelegateOptions* options) { … }
TfLiteDelegate* TfLiteXNNPackDelegateCreateWithThreadpool(
const TfLiteXNNPackDelegateOptions* options, TfLiteContext* context) { … }
void* TfLiteXNNPackDelegateGetThreadPool(TfLiteDelegate* delegate) { … }
const TfLiteXNNPackDelegateOptions* TfLiteXNNPackDelegateGetOptions(
TfLiteDelegate* delegate) { … }
int TfLiteXNNPackDelegateGetFlags(TfLiteDelegate* delegate) { … }
void TfLiteXNNPackDelegateDelete(TfLiteDelegate* delegate) { … }