[Fix] Set HF32 default value of matmul to False in all version.
This commit is contained in:
@@ -87,11 +87,11 @@ void GetAndSetDefaultJitCompileByAcl() {
|
||||
void SetHF32DefaultValue() {
|
||||
// The default value of the flag used to control whether HF32 is allowed on conv is True.
|
||||
// The default value of the flag used to control whether HF32 is allowed on matmul is True,
|
||||
// but this flag defaults to False in PyTorch 1.12 and later.
|
||||
// and this flag defaults to False in all PyTorch versions.
|
||||
|
||||
// When the flag of matmul is False, and the flag of conv is True,
|
||||
// the value of option "ACL_ALLOW_HF32" should be set to "10";
|
||||
std::string allow_hf32 = "11";
|
||||
std::string allow_hf32 = "10";
|
||||
auto ret = at_npu::native::AclSetCompileopt(aclCompileOpt::ACL_ALLOW_HF32, allow_hf32.c_str());
|
||||
if (ret == ACL_SUCCESS) {
|
||||
ASCEND_LOGI("Set ACL option ACL_ALLOW_HF32 default value to %s.", allow_hf32.c_str());
|
||||
|
||||
@@ -105,10 +105,10 @@ REGISTER_OPTION_BOOL_FUNCTION_UNIQ(CheckForbidInternalFormat, ALLOW_INTERNAL_FOR
|
||||
REGISTER_OPTION_HOOK(ALLOW_CONV_HF32, [](const std::string &val) {
|
||||
static const std::string mm_hf32_option_name = "ALLOW_MATMUL_HF32";
|
||||
auto mm_hf32_val = c10_npu::option::GetOption(mm_hf32_option_name);
|
||||
// default value is True;
|
||||
std::string mm_hf32 = "1";
|
||||
if (mm_hf32_val.has_value() && (mm_hf32_val.value() == "disable")) {
|
||||
mm_hf32 = "0";
|
||||
// default value is False;
|
||||
std::string mm_hf32 = "0";
|
||||
if (mm_hf32_val.has_value() && (mm_hf32_val.value() == "enable")) {
|
||||
mm_hf32 = "1";
|
||||
}
|
||||
|
||||
std::string conv_hf32 = (val == "enable") ? "1" : "0";
|
||||
|
||||
Reference in New Issue
Block a user