已合并
always use aclnnGeLUV2 in 950 #5316
XianglongZeng创建于 6月30日
always use aclnnGeLUV2 in 950 #5316
已合并
共 2 个文件变更+3-3
| @@ -28,7 +28,7 @@ at::Tensor gelu_backward(const at::Tensor & grad_output, const at::Tensor & self | |||
| 28 | grad_output.options().dtype(output_dtype_0)); | 28 | grad_output.options().dtype(output_dtype_0)); |
| 29 | auto approximate_str = op_infer::npu_gelu_approximate_str(approximate); | 29 | auto approximate_str = op_infer::npu_gelu_approximate_str(approximate); |
| 30 | auto approximate_ptr = const_cast<char *>(approximate_str.c_str()); | 30 | auto approximate_ptr = const_cast<char *>(approximate_str.c_str()); |
| 31 | - if (!gelu_sc) { | 31 | + if (!c10_npu::IsAclnnOnly() && !gelu_sc) { |
| 32 | DO_COMPATIBILITY(aclnnGeluBackward, acl_op::gelu_backward(grad_output, self, approximate)); | 32 | DO_COMPATIBILITY(aclnnGeluBackward, acl_op::gelu_backward(grad_output, self, approximate)); |
| 33 | EXEC_NPU_CMD(aclnnGeluBackward, grad_output, self, grad_input); | 33 | EXEC_NPU_CMD(aclnnGeluBackward, grad_output, self, grad_input); |
| 34 | } else { | 34 | } else { |
| @@ -21,7 +21,7 @@ using npu_preparation = at_npu::native::OpPreparation; | |||
| 21 | at::Tensor& gelu_out(const at::Tensor & self, c10::string_view approximate, at::Tensor& out) | 21 | at::Tensor& gelu_out(const at::Tensor & self, c10::string_view approximate, at::Tensor& out) |
| 22 | { | 22 | { |
| 23 | static auto gelu_sc = at_npu::native::env::CheckCompatibleImpl(); | 23 | static auto gelu_sc = at_npu::native::env::CheckCompatibleImpl(); |
| 24 | - if (!gelu_sc) { | 24 | + if (!c10_npu::IsAclnnOnly() && !gelu_sc) { |
| 25 | DO_COMPATIBILITY(aclnnGelu, acl_op::gelu_out(self, approximate, out)); | 25 | DO_COMPATIBILITY(aclnnGelu, acl_op::gelu_out(self, approximate, out)); |
| 26 | EXEC_NPU_CMD(aclnnGelu, self, out); | 26 | EXEC_NPU_CMD(aclnnGelu, self, out); |
| 27 | } else { | 27 | } else { |
| @@ -30,4 +30,4 @@ at::Tensor& gelu_out(const at::Tensor & self, c10::string_view approximate, at:: | |||
| 30 | } | 30 | } |
| 31 | return out; | 31 | return out; |
| 32 | } | 32 | } |
| 33 | -} | 33 | +} |