Stream: git-wasmtime

Topic: wasmtime / issue #7189 riscv64: Improve `scalar_to_vector...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2023 at 13:37):

afonso360 opened issue #7189:

:wave: Hey,

This is a fairly simple improvement. Cranelift's scalar_to_vector instruction grabs a scalar value and places it at the bottom of a vector register.

We translate this into the vmerge.vxm instruction in the RISC-V backend.

This is all fairly ok, but we don't have a rule to match the vmerge.vim instruction that can instead place an immediate value instead of a register.

Implementing this should be fairly simple, we can create a rule similar to the existing ones but using a imm5_from_value extractror:

(rule 2 (lower (has_type (ty_vec_fits_in_register ty) (scalar_to_vector (imm5_from_value x))))

This imm5_from_value extractor doesn't exist yet, but we already have an equivalent in the replicated_imm5 extractor. It should be fairly easy to extract that into it's own separate extractor for use in this new rule.

See the existing uimm5_from_value extractor for help.

If anyone needs help working on this issue let me know!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2023 at 13:37):

afonso360 added the cranelift:E-easy label to Issue #7189.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2023 at 13:37):

afonso360 added the cranelift:area:riscv64 label to Issue #7189.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2023 at 13:37):

afonso360 edited issue #7189:

:wave: Hey,

This is a fairly simple improvement. Cranelift's scalar_to_vector instruction grabs a scalar value and places it at the bottom of a vector register.

We translate this into the vmerge.vxm instruction in the RISC-V backend.

This is all fairly ok, but we don't have a rule to match the vmerge.vim instruction that can instead place an immediate value instead of a register.

Implementing this should be fairly simple, we can create a rule similar to the existing ones but using a imm5_from_value extractror:

(rule 2 (lower (has_type (ty_vec_fits_in_register ty) (scalar_to_vector (imm5_from_value x))))

This imm5_from_value extractor doesn't exist yet, but we already have an equivalent in the replicated_imm5 extractor. It should be fairly easy to extract that into it's own separate extractor for use in this new rule.

See the existing uimm5_from_value extractor for help.

If anyone needs help working on this issue let me know!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2023 at 13:40):

afonso360 edited issue #7189:

:wave: Hey,

This is a fairly simple improvement. Cranelift's scalar_to_vector instruction grabs a scalar value and places it at the bottom of a vector register.

We translate this into the vmerge.vxm instruction in the RISC-V backend.

This is all fairly ok, but we don't have a rule to match the vmerge.vim instruction that can place an immediate value instead of a register.

Implementing this should be fairly simple, we can create a rule similar to the existing ones but using a imm5_from_value extractror:

(rule 2 (lower (has_type (ty_vec_fits_in_register ty) (scalar_to_vector (imm5_from_value x))))

This imm5_from_value extractor doesn't exist yet, but we already have an equivalent in the replicated_imm5 extractor. It should be fairly easy to extract that into it's own separate extractor for use in this new rule.

See the existing uimm5_from_value extractor for help.

If anyone needs help working on this issue let me know!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2023 at 09:14):

BieVic commented on issue #7189:

Hey! I'm fairly new to Cranelift but would like to give it a try.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2023 at 12:13):

afonso360 commented on issue #7189:

Awesome :tada: Let me know if you need any help getting started!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2023 at 16:52):

afonso360 closed issue #7189:

:wave: Hey,

This is a fairly simple improvement. Cranelift's scalar_to_vector instruction grabs a scalar value and places it at the bottom of a vector register.

We translate this into the vmerge.vxm instruction in the RISC-V backend.

This is all fairly ok, but we don't have a rule to match the vmerge.vim instruction that can place an immediate value instead of a register.

Implementing this should be fairly simple, we can create a rule similar to the existing ones but using a imm5_from_value extractror:

(rule 2 (lower (has_type (ty_vec_fits_in_register ty) (scalar_to_vector (imm5_from_value x))))

This imm5_from_value extractor doesn't exist yet, but we already have an equivalent in the replicated_imm5 extractor. It should be fairly easy to extract that into it's own separate extractor for use in this new rule.

See the existing uimm5_from_value extractor for help.

If anyone needs help working on this issue let me know!


Last updated: Nov 22 2024 at 16:03 UTC