[CPU] Fix mamtulnbits accuracy level (#22963)

### Description
Fix mamtulnbits accuracy level



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
This commit is contained in:
Jing Fang 2024-11-28 01:40:04 +00:00 committed by GitHub
parent a24723df16
commit 08abab0b14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -33,6 +33,7 @@ constexpr size_t A = 0,
};
typedef enum {
Level0, /*!< input fp32, accumulator fp32 */
Level1, /*!< input fp32, accumulator fp32 */
Level2, /*!< input fp16, accumulator fp16 */
Level3, /*!< input bf16, accumulator fp32 */

View file

@ -274,11 +274,12 @@ void TestMatMulNBitsTyped() {
base_opts.block_size = block_size;
base_opts.accuracy_level = accuracy_level;
if constexpr (std::is_same<AType, MLFloat16>::value) {
if (base_opts.accuracy_level == 4) {
base_opts.output_abs_error = 0.1f;
base_opts.output_rel_error = 0.02f;
} else if constexpr (std::is_same<AType, MLFloat16>::value) {
base_opts.output_abs_error = 0.055f;
base_opts.output_rel_error = 0.02f;
} else if (base_opts.accuracy_level == 4) {
base_opts.output_abs_error = 0.1f;
}
{