-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differential Revision: D63991820 Pull Request resolved: #1027
- Loading branch information
Showing
5 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...imental/ops/linear_8bit_act_xbit_weight/op_linear_8bit_act_xbit_weight_executorch/w6s.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Meta Platforms, Inc. and affiliates. | ||
// All rights reserved. | ||
// | ||
// This source code is licensed under the license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
// Unlike ATen, ExecuTorch op registration appears to only allow on | ||
// EXECUTORCH_LIBRARY per cpp file due to a name redefinition error, so a new | ||
// file is needed for each variant | ||
|
||
#include <torchao/experimental/ops/linear_8bit_act_xbit_weight/op_linear_8bit_act_xbit_weight-impl.h> | ||
|
||
namespace { | ||
Tensor _op_out( | ||
RuntimeContext& ctx, | ||
const Tensor& activations, | ||
const Tensor& packed_weights, | ||
const Tensor& group_size_tensor, | ||
const Tensor& n_tensor, | ||
const Tensor& k_tensor, | ||
Tensor& out) { | ||
(void)ctx; | ||
linear_out_cpu</*weight_nbit*/ 6, /*has_weight_zeros*/ false>( | ||
activations, packed_weights, group_size_tensor, n_tensor, k_tensor, out); | ||
return out; | ||
} | ||
} // namespace | ||
|
||
EXECUTORCH_LIBRARY(torchao, "_linear_8bit_act_6bit0zp_weight.out", _op_out); |
29 changes: 29 additions & 0 deletions
29
...mental/ops/linear_8bit_act_xbit_weight/op_linear_8bit_act_xbit_weight_executorch/w6sz.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Meta Platforms, Inc. and affiliates. | ||
// All rights reserved. | ||
// | ||
// This source code is licensed under the license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
// Unlike ATen, ExecuTorch op registration appears to only allow on | ||
// EXECUTORCH_LIBRARY per cpp file due to a name redefinition error, so a new | ||
// file is needed for each variant | ||
|
||
#include <torchao/experimental/ops/linear_8bit_act_xbit_weight/op_linear_8bit_act_xbit_weight-impl.h> | ||
|
||
namespace { | ||
Tensor _op_out( | ||
RuntimeContext& ctx, | ||
const Tensor& activations, | ||
const Tensor& packed_weights, | ||
const Tensor& group_size_tensor, | ||
const Tensor& n_tensor, | ||
const Tensor& k_tensor, | ||
Tensor& out) { | ||
(void)ctx; | ||
linear_out_cpu</*weight_nbit*/ 6, /*has_weight_zeros*/ true>( | ||
activations, packed_weights, group_size_tensor, n_tensor, k_tensor, out); | ||
return out; | ||
} | ||
} // namespace | ||
|
||
EXECUTORCH_LIBRARY(torchao, "_linear_8bit_act_6bit_weight.out", _op_out); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters