Skip to content

Commit

Permalink
[NFC] Put bfloat type into constants
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Zhang Jian <[email protected]>
  • Loading branch information
jerryzj authored and kito-cheng committed Sep 12, 2024
1 parent 97cb963 commit 01db6b1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
57 changes: 29 additions & 28 deletions rvv-intrinsic-generator/rvv_intrinsic_gen/bfloat16_inst.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -47,64 +46,66 @@ 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")

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")
Expand All @@ -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)

####################################################################
Expand All @@ -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)

####################################################################
Expand Down
1 change: 1 addition & 0 deletions rvv-intrinsic-generator/rvv_intrinsic_gen/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
ITYPES = ["int", "uint"]
UITYPE = ["uint"]
FTYPES = ["float"]
BFTYPES = ["bfloat"]
MTYPES = ["bool"]
MLENS = [1, 2, 4, 8, 16, 32, 64]

0 comments on commit 01db6b1

Please sign in to comment.