MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / brute_force_gemm

Function brute_force_gemm

src/opr/test/blas.cpp:18–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace {
17template <typename dt_src, typename dt_dst>
18void brute_force_gemm(
19 size_t M, size_t N, size_t K, bool transa, bool transb, const dt_src* x,
20 const dt_src* y, dt_dst* z) {
21 for (size_t m = 0; m < M; ++m)
22 for (size_t n = 0; n < N; ++n) {
23 dt_dst cur = dt_dst(0);
24 for (size_t k = 0; k < K; ++k) {
25 cur += x[transa ? (k * M + m) : (m * K + k)] *
26 y[transb ? (n * K + k) : (k * N + n)];
27 }
28 z[m * N + n] = cur;
29 }
30}
31
32float brute_force_dot(const HostTensorND& a, const HostTensorND& b) {
33 auto sz = std::max(a.shape(0), b.shape(0));

Callers 1

run_sgemm_testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected