Skip to content

Commit 6e941c8

Browse files
authored
Add op_exetorch
Differential Revision: D77630177 Pull Request resolved: #2645
1 parent 22f9d31 commit 6e941c8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <torchao/experimental/ops/groupwise_lowbit_weight_lut/op_groupwise_lowbit_weight_lut-impl.h>
2+
3+
#define DEFINE_OP(weight_nbit) \
4+
Tensor _op_out_##weight_nbit( \
5+
RuntimeContext& ctx, \
6+
const Tensor& activations, \
7+
const Tensor& packed_weights, \
8+
const int64_t& scale_group_size, \
9+
const int64_t& lut_group_size, \
10+
const int64_t& n, \
11+
const int64_t& k, \
12+
Tensor& out) { \
13+
(void)ctx; \
14+
linear_out_cpu<weight_nbit>( \
15+
activations, \
16+
packed_weights, \
17+
scale_group_size, \
18+
lut_group_size, \
19+
n, \
20+
k, \
21+
out); \
22+
return out; \
23+
} \
24+
EXECUTORCH_LIBRARY( \
25+
torchao, \
26+
"_linear_groupwise_" #weight_nbit "bit_weight_with_lut.out", \
27+
_op_out_##weight_nbit)
28+
29+
DEFINE_OP(1);
30+
DEFINE_OP(2);
31+
DEFINE_OP(3);
32+
DEFINE_OP(4);

0 commit comments

Comments
 (0)