MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / main

Function main

examples/neon_gemm_qasymm8.cpp:96–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96int main(int argc, char **argv)
97{
98 Tensor src1;
99 Tensor src2;
100 Tensor dst0;
101 Tensor q_src1;
102 Tensor q_src2;
103 Tensor q_dst0;
104 Tensor q_res;
105 Tensor q_res_output;
106 size_t M = 4;
107 size_t N = 4;
108 size_t K = 4;
109 bool default_input = true;
110
111 // Parse args
112 if (argc < 3) /* case default matrix sizes */
113 {
114 // Print help
115 std::cout << "Usage: ./build/neon_gemm_qasymm8 M N K\n";
116 std::cout << "Too few or no inputs provided. Using default M=4, N=4, K=4\n\n";
117 }
118 else /* case M N K arguments provided */
119 {
120 M = strtol(argv[1], nullptr, 10);
121 N = strtol(argv[2], nullptr, 10);
122 K = strtol(argv[3], nullptr, 10);
123 default_input = false;
124 }
125
126 /*** Floating point matrix multiplication ***/
127
128 // Initialise input matrices
129 NEGEMM fgemm{};
130
131 src1.allocator()->init(TensorInfo(TensorShape(K, M), 1, DataType::F32));
132 src2.allocator()->init(TensorInfo(TensorShape(N, K), 1, DataType::F32));
133 dst0.allocator()->init(TensorInfo(TensorShape(N, M), 1, DataType::F32));
134 fgemm.configure(&src1, &src2, nullptr, &dst0, 1, 0);
135
136 // Allocate matrices
137 src1.allocator()->allocate();
138 src2.allocator()->allocate();
139 dst0.allocator()->allocate();
140
141 // Fill in tensors, by default fill in with known data - for easy testing
142 auto *src1_ptr = reinterpret_cast<float *>(src1.buffer());
143 auto *src2_ptr = reinterpret_cast<float *>(src2.buffer());
144 auto *dst0_ptr = reinterpret_cast<float *>(dst0.buffer());
145
146 // Fill in: one is the identity matrix, other is sequential values
147 // src1: Identity matrix
148 for (size_t i = 0; i < M * K; i++)
149 {
150 src1_ptr[i] = 0;
151 }
152 for (size_t i = 0; i < M; i++)
153 {

Callers

nothing calls this directly

Calls 15

fill_random_tensorFunction · 0.85
scaleMethod · 0.80
offsetMethod · 0.80
find_min_maxFunction · 0.70
TensorInfoClass · 0.50
TensorShapeClass · 0.50
initMethod · 0.45
allocatorMethod · 0.45
configureMethod · 0.45
allocateMethod · 0.45

Tested by

no test coverage detected