From 01db6b13dae2122ba146e082db155449e6c3630e Mon Sep 17 00:00:00 2001 From: Jerry Zhang Jian Date: Thu, 12 Sep 2024 02:38:07 -0700 Subject: [PATCH] [NFC] Put bfloat type into constants Signed-off-by: Jerry Zhang Jian --- .../rvv_intrinsic_gen/bfloat16_inst.py | 57 ++++++++++--------- .../rvv_intrinsic_gen/constants.py | 1 + 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/rvv-intrinsic-generator/rvv_intrinsic_gen/bfloat16_inst.py b/rvv-intrinsic-generator/rvv_intrinsic_gen/bfloat16_inst.py index 7f4a79b3d..9ab9918ef 100644 --- a/rvv-intrinsic-generator/rvv_intrinsic_gen/bfloat16_inst.py +++ b/rvv-intrinsic-generator/rvv_intrinsic_gen/bfloat16_inst.py @@ -31,11 +31,10 @@ from templates import misc_op_template from templates import cvt_op_template from templates import mac_template -from constants import LMULS, WLMULS, NCVTLMULS +from constants import LMULS, WLMULS, NCVTLMULS, BFTYPES SEWS = [16] NSEWS = [32] -TYPES = ["bfloat"] def gen(g): @@ -47,33 +46,33 @@ def gen(g): g.start_group("BFloat16 Vector Loads and Stores Intrinsics") g.function_group(load_template, "Vector Unit-Stride Load Intrinsics", - "bf16-vector-unit-stride-load", ["vle"], TYPES, SEWS, LMULS, - decorators.has_masking_maskedoff_policy) + "bf16-vector-unit-stride-load", ["vle"], BFTYPES, SEWS, + LMULS, decorators.has_masking_maskedoff_policy) g.function_group(store_template, "Vector Unit-Stride Store Intrinsics", - "bf16-vector-unit-stride-store", ["vse"], TYPES, SEWS, LMULS, - decorators.has_masking_no_maskedoff) + "bf16-vector-unit-stride-store", ["vse"], BFTYPES, SEWS, + LMULS, decorators.has_masking_no_maskedoff) g.function_group(load_template, "Vector Strided Load Intrinsics", - "vector-strided-load", ["vlse"], TYPES, SEWS, LMULS, + "vector-strided-load", ["vlse"], BFTYPES, SEWS, LMULS, decorators.has_masking_maskedoff_policy) g.function_group(store_template, "Vector Strided Store Intrinsics", - "vector-strided-store", ["vsse"], TYPES, SEWS, LMULS, + "vector-strided-store", ["vsse"], BFTYPES, SEWS, LMULS, decorators.has_masking_no_maskedoff) g.function_group(load_template, "Vector Indexed Load Intrinsics", - "vector-indexed-load", ["vloxei", "vluxei"], TYPES, SEWS, + "vector-indexed-load", ["vloxei", "vluxei"], BFTYPES, SEWS, LMULS, decorators.has_masking_maskedoff_policy) g.function_group(store_template, "Vector Indexed Store Intrinsics", - "vector-indexed-store", ["vsoxei", "vsuxei"], TYPES, SEWS, + "vector-indexed-store", ["vsoxei", "vsuxei"], BFTYPES, SEWS, LMULS, decorators.has_masking_no_maskedoff) g.function_group(load_template, "Unit-stride Fault-Only-First Loads Intrinsics", - "unit-stride-fault-only-first-loads", ["vleff"], TYPES, SEWS, - LMULS, decorators.has_masking_maskedoff_policy) + "unit-stride-fault-only-first-loads", ["vleff"], BFTYPES, + SEWS, LMULS, decorators.has_masking_maskedoff_policy) #################################################################### g.start_group("BFloat16 Vector Loads and Stores Segment Intrinsics") @@ -81,30 +80,32 @@ def gen(g): g.function_group(seg_load_template, "Vector Unit-Stride Segment Load Intrinsics", "vector-unit-stride-segment-load", ["vlseg", "vlsegff"], - TYPES, SEWS, LMULS, decorators.has_masking_maskedoff_policy) + BFTYPES, SEWS, LMULS, + decorators.has_masking_maskedoff_policy) g.function_group(seg_store_template, "Vector Unit-Stride Segment Store Intrinsics", - "vecrtor-unit-stride-segment-store", ["vsseg"], TYPES, SEWS, - LMULS, decorators.has_masking_no_maskedoff) + "vecrtor-unit-stride-segment-store", ["vsseg"], BFTYPES, + SEWS, LMULS, decorators.has_masking_no_maskedoff) g.function_group(seg_load_template, "Vector Strided Segment Load Intrinsics", - "vector-strided-segment-load", ["vlsseg"], TYPES, SEWS, + "vector-strided-segment-load", ["vlsseg"], BFTYPES, SEWS, LMULS, decorators.has_masking_maskedoff_policy) g.function_group(seg_store_template, "Vector Strided Segment Store Intrinsics", - "vector-strided-segment-store", ["vssseg"], TYPES, SEWS, + "vector-strided-segment-store", ["vssseg"], BFTYPES, SEWS, LMULS, decorators.has_masking_no_maskedoff) g.function_group(seg_load_template, "Vector Indexed Segment Load Intrinsics", - "vector-indexed-segment-load", ["vloxseg", "vluxseg"], TYPES, - SEWS, LMULS, decorators.has_masking_maskedoff_policy) + "vector-indexed-segment-load", ["vloxseg", "vluxseg"], + BFTYPES, SEWS, LMULS, + decorators.has_masking_maskedoff_policy) g.function_group(seg_store_template, "Vector Indexed Segment Store Intrinsics", "vector-indexed-segment-store", ["vsoxseg", "vsuxseg"], - TYPES, SEWS, LMULS, decorators.has_masking_no_maskedoff) + BFTYPES, SEWS, LMULS, decorators.has_masking_no_maskedoff) #################################################################### g.start_group("BFloat16 Convert Intrinsics") @@ -123,7 +124,7 @@ def gen(g): g.function_group(mac_template, "Vector Widening Multiply-Accumulate Intrinsics", - "bf16-widening-multiply-accumulate", ["wmaccbf16"], TYPES, + "bf16-widening-multiply-accumulate", ["wmaccbf16"], BFTYPES, SEWS, WLMULS, decorators.has_masking_no_maskedoff_policy_frm) #################################################################### @@ -134,27 +135,27 @@ def gen(g): SEWS, LMULS, decorators.has_no_masking) g.function_group(misc_op_template, "Vector LMUL Extension Intrinsics", - "vector-lmul-extensionn", ["vlmul_ext_v"], TYPES, SEWS, + "vector-lmul-extensionn", ["vlmul_ext_v"], BFTYPES, SEWS, LMULS, decorators.has_no_masking) g.function_group(misc_op_template, "Vector LMUL Truncation Intrinsics", - "vector-lmul-truncation", ["vlmul_trunc_v"], TYPES, SEWS, + "vector-lmul-truncation", ["vlmul_trunc_v"], BFTYPES, SEWS, LMULS, decorators.has_no_masking) g.function_group(misc_op_template, "Vector Initialization Intrinsics", - "vector-initialization", ["vundefined"], TYPES, SEWS, LMULS, - decorators.has_no_masking) + "vector-initialization", ["vundefined"], BFTYPES, SEWS, + LMULS, decorators.has_no_masking) g.function_group(get_set_diff_lmul_op_template, "Vector Insertion Intrinsics", - "vector-insertion", ["vset"], TYPES, SEWS, LMULS, + "vector-insertion", ["vset"], BFTYPES, SEWS, LMULS, decorators.has_no_masking) g.function_group(get_set_diff_lmul_op_template, "Vector Extraction Intrinsics", "vector-extraction", - ["vget"], TYPES, SEWS, LMULS, decorators.has_no_masking) + ["vget"], BFTYPES, SEWS, LMULS, decorators.has_no_masking) g.function_group(misc_op_template, "Vector Creation Intrinsics", - "vector-creation", ["vcreate"], TYPES, SEWS, LMULS, + "vector-creation", ["vcreate"], BFTYPES, SEWS, LMULS, decorators.has_no_masking) #################################################################### diff --git a/rvv-intrinsic-generator/rvv_intrinsic_gen/constants.py b/rvv-intrinsic-generator/rvv_intrinsic_gen/constants.py index 5d3f20c6c..0895181eb 100644 --- a/rvv-intrinsic-generator/rvv_intrinsic_gen/constants.py +++ b/rvv-intrinsic-generator/rvv_intrinsic_gen/constants.py @@ -30,5 +30,6 @@ ITYPES = ["int", "uint"] UITYPE = ["uint"] FTYPES = ["float"] +BFTYPES = ["bfloat"] MTYPES = ["bool"] MLENS = [1, 2, 4, 8, 16, 32, 64]