blob: bf1b1fff7a192cae2cd4e3da530e9e2342521966 [file] [log] [blame]
Jeremy Johnsonc8330812024-01-18 16:57:28 +00001// Copyright (c) 2023-2024, ARM Limited.
Jeremy Johnsonb20b0c92023-10-04 14:17:55 +01002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GENERATE_DOT_PRODUCT_H_
16#define GENERATE_DOT_PRODUCT_H_
17
18#include "generate_utils.h"
19
20#include <memory>
21
22namespace TosaReference
23{
24
25/// \brief Generic dot-product generator interface
26class IDotProductGenerator
27{
28public:
29 virtual float operator()(uint32_t k) = 0;
Jeremy Johnson65ba8092023-10-09 16:31:13 +010030 virtual ~IDotProductGenerator() = default;
Jeremy Johnsonc8330812024-01-18 16:57:28 +000031 virtual uint32_t nextIndex() = 0;
Jeremy Johnsonb20b0c92023-10-04 14:17:55 +010032};
33
34/// \brief Dot-product stage generator selector
35std::unique_ptr<IDotProductGenerator> pickDotProductGenerator(const GenerateConfig& cfg);
36
37/// \brief Perform dot-product based generation
38///
39/// \param cfg Generator related meta-data
40/// \param data Buffer to generate the data to
Jeremy Johnsond41feb72023-10-12 16:03:15 +010041/// \param size Size of the buffer
Jeremy Johnsonb20b0c92023-10-04 14:17:55 +010042///
43/// \return True on successful generation
44bool generateDotProduct(const GenerateConfig& cfg, void* data, size_t size);
45
46}; // namespace TosaReference
47
48#endif // GENERATE_DOT_PRODUCT_H_