forked from pytorch/FBGEMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TransposeUtils.h
58 lines (51 loc) · 1.3 KB
/
TransposeUtils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace fbgemm {
/**
* @brief Reference implementation of matrix transposition: B = A^T.
* @param M The height of the matrix.
* @param N The width of the matrix.
* @param src The memory buffer of the source matrix A.
* @param ld_src The leading dimension of the source matrix A.
* @param dst The memory buffer of the destination matrix B.
* @param ld_dst The leading dimension of the destination matrix B.
*/
void transpose_ref(
int M,
int N,
const float* src,
int ld_src,
float* dst,
int ld_dst);
namespace internal {
/**
* @brief Transpose a matrix using Intel AVX2.
*
* This is called if the code is running on a CPU with Intel AVX2 support.
*/
void transpose_8x8(
int M,
int N,
const float* src,
int ld_src,
float* dst,
int ld_dst);
/**
* @brief Transpose a matrix using Intel AVX512.
*
* This is called if the code is running on a CPU with Intel AVX512 support.
*/
void transpose_16x16(
int M,
int N,
const float* src,
int ld_src,
float* dst,
int ld_dst);
} // namespace internal
} // namespace fbgemm